bauxite 0.6.18 → 0.6.19
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +21 -21
- data/README.md +293 -293
- data/Rakefile +128 -128
- data/bin/bauxite +27 -27
- data/doc/Bauxite.html +6 -9
- data/doc/Bauxite/Action.html +298 -315
- data/doc/Bauxite/ActionModule.html +23 -26
- data/doc/Bauxite/Application.html +36 -38
- data/doc/Bauxite/Context.html +303 -303
- data/doc/Bauxite/Errors.html +6 -9
- data/doc/Bauxite/Errors/AssertionError.html +6 -9
- data/doc/Bauxite/Errors/FileNotFoundError.html +6 -9
- data/doc/Bauxite/Errors/FormatError.html +6 -9
- data/doc/Bauxite/Loggers.html +6 -9
- data/doc/Bauxite/Loggers/CompositeLogger.html +29 -32
- data/doc/Bauxite/Loggers/EchoLogger.html +10 -13
- data/doc/Bauxite/Loggers/FileLogger.html +25 -28
- data/doc/Bauxite/Loggers/HtmlLogger.html +99 -102
- data/doc/Bauxite/Loggers/NullLogger.html +16 -19
- data/doc/Bauxite/Loggers/ReportLogger.html +43 -46
- data/doc/Bauxite/Loggers/TerminalLogger.html +76 -79
- data/doc/Bauxite/Loggers/XtermLogger.html +28 -31
- data/doc/Bauxite/Parser.html +87 -89
- data/doc/Bauxite/ParserModule.html +19 -22
- data/doc/Bauxite/Selector.html +99 -105
- data/doc/Bauxite/SelectorModule.html +27 -30
- data/doc/README_md.html +117 -103
- data/doc/created.rid +58 -58
- data/doc/fonts.css +167 -167
- data/doc/fonts/Lato-Light.ttf +0 -0
- data/doc/fonts/Lato-LightItalic.ttf +0 -0
- data/doc/fonts/Lato-Regular.ttf +0 -0
- data/doc/fonts/Lato-RegularItalic.ttf +0 -0
- data/doc/fonts/SourceCodePro-Bold.ttf +0 -0
- data/doc/fonts/SourceCodePro-Regular.ttf +0 -0
- data/doc/images/add.png +0 -0
- data/doc/images/arrow_up.png +0 -0
- data/doc/images/brick.png +0 -0
- data/doc/images/brick_link.png +0 -0
- data/doc/images/bug.png +0 -0
- data/doc/images/bullet_black.png +0 -0
- data/doc/images/bullet_toggle_minus.png +0 -0
- data/doc/images/bullet_toggle_plus.png +0 -0
- data/doc/images/date.png +0 -0
- data/doc/images/delete.png +0 -0
- data/doc/images/find.png +0 -0
- data/doc/images/loadingAnimation.gif +0 -0
- data/doc/images/macFFBgHack.png +0 -0
- data/doc/images/package.png +0 -0
- data/doc/images/page_green.png +0 -0
- data/doc/images/page_white_text.png +0 -0
- data/doc/images/page_white_width.png +0 -0
- data/doc/images/plugin.png +0 -0
- data/doc/images/ruby.png +0 -0
- data/doc/images/tag_blue.png +0 -0
- data/doc/images/tag_green.png +0 -0
- data/doc/images/transparent.png +0 -0
- data/doc/images/wrench.png +0 -0
- data/doc/images/wrench_orange.png +0 -0
- data/doc/images/zoom.png +0 -0
- data/doc/index.html +117 -103
- data/doc/js/darkfish.js +32 -11
- data/doc/js/jquery.js +0 -0
- data/doc/js/navigation.js +0 -0
- data/doc/js/search.js +0 -0
- data/doc/js/search_index.js +1 -1
- data/doc/js/searcher.js +0 -0
- data/doc/rdoc.css +580 -580
- data/doc/table_of_contents.html +69 -72
- data/lib/bauxite.rb +28 -28
- data/lib/bauxite/actions/alias.rb +51 -51
- data/lib/bauxite/actions/assert.rb +49 -49
- data/lib/bauxite/actions/asserth.rb +60 -60
- data/lib/bauxite/actions/assertm.rb +49 -49
- data/lib/bauxite/actions/assertv.rb +40 -40
- data/lib/bauxite/actions/assertw.rb +47 -47
- data/lib/bauxite/actions/break.rb +39 -39
- data/lib/bauxite/actions/capture.rb +61 -61
- data/lib/bauxite/actions/click.rb +36 -36
- data/lib/bauxite/actions/debug.rb +103 -103
- data/lib/bauxite/actions/doif.rb +43 -43
- data/lib/bauxite/actions/dounless.rb +43 -43
- data/lib/bauxite/actions/echo.rb +36 -36
- data/lib/bauxite/actions/exec.rb +46 -46
- data/lib/bauxite/actions/exit.rb +35 -35
- data/lib/bauxite/actions/failif.rb +52 -52
- data/lib/bauxite/actions/js.rb +41 -41
- data/lib/bauxite/actions/load.rb +49 -49
- data/lib/bauxite/actions/open.rb +35 -35
- data/lib/bauxite/actions/params.rb +40 -40
- data/lib/bauxite/actions/replace.rb +37 -37
- data/lib/bauxite/actions/reset.rb +38 -38
- data/lib/bauxite/actions/return.rb +68 -68
- data/lib/bauxite/actions/ruby.rb +58 -58
- data/lib/bauxite/actions/select.rb +48 -48
- data/lib/bauxite/actions/set.rb +39 -39
- data/lib/bauxite/actions/setif.rb +44 -44
- data/lib/bauxite/actions/source.rb +44 -44
- data/lib/bauxite/actions/store.rb +38 -38
- data/lib/bauxite/actions/submit.rb +37 -37
- data/lib/bauxite/actions/test.rb +67 -67
- data/lib/bauxite/actions/tryload.rb +71 -71
- data/lib/bauxite/actions/wait.rb +38 -38
- data/lib/bauxite/actions/write.rb +44 -44
- data/lib/bauxite/application.rb +349 -349
- data/lib/bauxite/core/action.rb +199 -199
- data/lib/bauxite/core/context.rb +791 -791
- data/lib/bauxite/core/errors.rb +41 -41
- data/lib/bauxite/core/logger.rb +169 -169
- data/lib/bauxite/core/parser.rb +85 -85
- data/lib/bauxite/core/selector.rb +152 -152
- data/lib/bauxite/loggers/composite.rb +91 -91
- data/lib/bauxite/loggers/echo.rb +36 -36
- data/lib/bauxite/loggers/file.rb +68 -68
- data/lib/bauxite/loggers/html.rb +154 -154
- data/lib/bauxite/loggers/terminal.rb +134 -134
- data/lib/bauxite/loggers/xterm.rb +101 -101
- data/lib/bauxite/parsers/csv.rb +43 -43
- data/lib/bauxite/parsers/default.rb +42 -42
- data/lib/bauxite/parsers/html.rb +79 -79
- data/lib/bauxite/selectors/attr.rb +39 -39
- data/lib/bauxite/selectors/frame.rb +60 -60
- data/lib/bauxite/selectors/json.rb +88 -88
- data/lib/bauxite/selectors/sid.rb +38 -38
- data/lib/bauxite/selectors/smart.rb +80 -80
- data/lib/bauxite/selectors/window.rb +77 -77
- data/test/alert.bxt +3 -3
- data/test/alert/page.html +4 -4
- data/test/alias.bxt +9 -9
- data/test/asserth.bxt +2 -2
- data/test/assertv.bxt +1 -1
- data/test/assertw.bxt +7 -7
- data/test/broken.bxt.manual +0 -0
- data/test/bug_load_path.bxt.manual +0 -0
- data/test/bug_load_path/broken.bxt.manual +0 -0
- data/test/bug_load_path/test.bxt +0 -0
- data/test/capture.bxt.manual +20 -20
- data/test/capture/my_test.bxt +1 -1
- data/test/capture/page.html +6 -6
- data/test/capture_on_error.bxt.manual +3 -3
- data/test/capture_on_error/my_test.bxt +1 -1
- data/test/capture_on_error/page.html +2 -2
- data/test/debug.bxt.manual +0 -0
- data/test/default_selector.bxt.manual +7 -7
- data/test/default_selector/page.html +10 -10
- data/test/default_selector_var.bxt +1 -1
- data/test/delay.bxt +2 -2
- data/test/delay/page.html +4 -4
- data/test/doif.bxt +6 -6
- data/test/dounless.bxt +6 -6
- data/test/exec.bxt +6 -6
- data/test/exit.bxt +3 -3
- data/test/exit/test.bxt +3 -3
- data/test/extension.bxt.manual +4 -4
- data/test/extension/custom.rb +12 -12
- data/test/extension/page.html +4 -4
- data/test/failif.bxt +7 -7
- data/test/failif/page.html +5 -5
- data/test/format.bxt +17 -17
- data/test/format/page.html +6 -6
- data/test/frame.bxt +6 -6
- data/test/frame/child_frame.html +6 -6
- data/test/frame/grandchild_frame.html +4 -4
- data/test/frame/page.html +4 -4
- data/test/js.bxt +4 -4
- data/test/json.bxt +19 -19
- data/test/json/array.json +3 -3
- data/test/json/object.json +13 -13
- data/test/load.bxt +18 -18
- data/test/load/child.bxt +12 -12
- data/test/parsers.bxt +1 -1
- data/test/parsers.csv +7 -7
- data/test/parsers.html +32 -32
- data/test/parsers/page.html +6 -6
- data/test/return.bxt +1 -1
- data/test/return/f1.bxt +1 -1
- data/test/return/f2.bxt +1 -1
- data/test/return/f3.bxt +1 -1
- data/test/return/f4.bxt +2 -2
- data/test/ruby.bxt +1 -1
- data/test/ruby/custom.rb +5 -5
- data/test/select.bxt +9 -9
- data/test/select/page.html +8 -8
- data/test/selectors.bxt +7 -7
- data/test/selectors/page.html +6 -6
- data/test/set_builtin.bxt +5 -0
- data/test/set_builtin/page.html +5 -0
- data/test/setif.bxt +3 -3
- data/test/smart_selector.bxt +17 -17
- data/test/smart_selector/page.html +17 -17
- data/test/stdin.bxt +0 -0
- data/test/submit.bxt +4 -4
- data/test/submit/page.html +6 -6
- data/test/submit/page2.html +4 -4
- data/test/test.bxt.manual +6 -6
- data/test/test/test1.bxt +2 -2
- data/test/test/test2.bxt +3 -3
- data/test/test/test3.bxt +2 -2
- data/test/test/test4.bxt +1 -1
- data/test/test/test5.bxt +1 -1
- data/test/window.bxt +14 -14
- data/test/window/page.html +5 -5
- data/test/window/popup.html +4 -4
- metadata +5 -3
@@ -6,20 +6,17 @@
|
|
6
6
|
|
7
7
|
<title>module Bauxite::ActionModule - RDoc Documentation</title>
|
8
8
|
|
9
|
-
<link href="../fonts.css" rel="stylesheet">
|
10
|
-
<link href="../rdoc.css" rel="stylesheet">
|
11
|
-
|
12
9
|
<script type="text/javascript">
|
13
10
|
var rdoc_rel_prefix = "../";
|
14
11
|
</script>
|
15
12
|
|
16
13
|
<script src="../js/jquery.js"></script>
|
17
|
-
<script src="../js/navigation.js"></script>
|
18
|
-
<script src="../js/search_index.js"></script>
|
19
|
-
<script src="../js/search.js"></script>
|
20
|
-
<script src="../js/searcher.js"></script>
|
21
14
|
<script src="../js/darkfish.js"></script>
|
22
15
|
|
16
|
+
<link href="../css/fonts.css" rel="stylesheet">
|
17
|
+
<link href="../css/rdoc.css" rel="stylesheet">
|
18
|
+
|
19
|
+
|
23
20
|
|
24
21
|
<body id="top" role="document" class="module">
|
25
22
|
<nav role="navigation">
|
@@ -175,17 +172,17 @@
|
|
175
172
|
|
176
173
|
<div class="method-source-code" id="new-source">
|
177
174
|
<pre><span class="ruby-comment"># File lib/bauxite/core/action.rb, line 36</span>
|
178
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">ctx</span>, <span class="ruby-identifier">cmd</span>, <span class="ruby-identifier">args</span>, <span class="ruby-identifier">text</span>, <span class="ruby-identifier">file</span>, <span class="ruby-identifier">line</span>)
|
179
|
-
<span class="ruby-ivar">@ctx</span> = <span class="ruby-identifier">ctx</span>
|
180
|
-
<span class="ruby-ivar">@cmd</span> = <span class="ruby-identifier">cmd</span>
|
181
|
-
<span class="ruby-ivar">@args</span> = <span class="ruby-identifier">args</span>
|
182
|
-
<span class="ruby-ivar">@text</span> = <span class="ruby-identifier">text</span>
|
183
|
-
|
184
|
-
<span class="ruby-ivar">@cmd_real</span> = (<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">cmd</span><span class="ruby-operator">+</span><span class="ruby-string">'_action'</span>) <span class="ruby-operator">?</span> (<span class="ruby-identifier">cmd</span><span class="ruby-operator">+</span><span class="ruby-string">'_action'</span>) <span class="ruby-operator">:</span> <span class="ruby-identifier">cmd</span>
|
185
|
-
|
186
|
-
<span class="ruby-keyword">unless</span> <span class="ruby-identifier">respond_to?</span> <span class="ruby-ivar">@cmd_real</span> <span class="ruby-keyword">and</span> <span class="ruby-constant">Context</span><span class="ruby-operator">::</span><span class="ruby-identifier">actions</span>.<span class="ruby-identifier">include?</span> <span class="ruby-ivar">@cmd</span>
|
187
|
-
<span class="ruby-identifier">raise</span> <span class="ruby-node">"#{file} (line #{line+1}): Unknown command #{cmd}."</span>
|
188
|
-
<span class="ruby-keyword">end</span>
|
175
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">ctx</span>, <span class="ruby-identifier">cmd</span>, <span class="ruby-identifier">args</span>, <span class="ruby-identifier">text</span>, <span class="ruby-identifier">file</span>, <span class="ruby-identifier">line</span>)
|
176
|
+
<span class="ruby-ivar">@ctx</span> = <span class="ruby-identifier">ctx</span>
|
177
|
+
<span class="ruby-ivar">@cmd</span> = <span class="ruby-identifier">cmd</span>
|
178
|
+
<span class="ruby-ivar">@args</span> = <span class="ruby-identifier">args</span>
|
179
|
+
<span class="ruby-ivar">@text</span> = <span class="ruby-identifier">text</span>
|
180
|
+
|
181
|
+
<span class="ruby-ivar">@cmd_real</span> = (<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">cmd</span><span class="ruby-operator">+</span><span class="ruby-string">'_action'</span>) <span class="ruby-operator">?</span> (<span class="ruby-identifier">cmd</span><span class="ruby-operator">+</span><span class="ruby-string">'_action'</span>) <span class="ruby-operator">:</span> <span class="ruby-identifier">cmd</span>
|
182
|
+
|
183
|
+
<span class="ruby-keyword">unless</span> <span class="ruby-identifier">respond_to?</span> <span class="ruby-ivar">@cmd_real</span> <span class="ruby-keyword">and</span> <span class="ruby-constant">Context</span><span class="ruby-operator">::</span><span class="ruby-identifier">actions</span>.<span class="ruby-identifier">include?</span> <span class="ruby-ivar">@cmd</span>
|
184
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-node">"#{file} (line #{line+1}): Unknown command #{cmd}."</span>
|
185
|
+
<span class="ruby-keyword">end</span>
|
189
186
|
<span class="ruby-keyword">end</span></pre>
|
190
187
|
</div>
|
191
188
|
|
@@ -245,10 +242,10 @@ quote characters (“) and every quote inside an argument is doubled.</p>
|
|
245
242
|
|
246
243
|
<div class="method-source-code" id="args-source">
|
247
244
|
<pre><span class="ruby-comment"># File lib/bauxite/core/action.rb, line 69</span>
|
248
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">args</span>(<span class="ruby-identifier">quote</span> = <span class="ruby-keyword">false</span>)
|
249
|
-
<span class="ruby-identifier">ret</span> = <span class="ruby-ivar">@args</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">a</span><span class="ruby-operator">|</span> <span class="ruby-ivar">@ctx</span>.<span class="ruby-identifier">expand</span>(<span class="ruby-identifier">a</span>) }
|
250
|
-
<span class="ruby-identifier">ret</span> = <span class="ruby-identifier">ret</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">a</span><span class="ruby-operator">|</span> <span class="ruby-string">'"'</span><span class="ruby-operator">+</span><span class="ruby-identifier">a</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-string">'"'</span>, <span class="ruby-string">'""'</span>)<span class="ruby-operator">+</span><span class="ruby-string">'"'</span> } <span class="ruby-keyword">if</span> <span class="ruby-identifier">quote</span>
|
251
|
-
<span class="ruby-identifier">ret</span>
|
245
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">args</span>(<span class="ruby-identifier">quote</span> = <span class="ruby-keyword">false</span>)
|
246
|
+
<span class="ruby-identifier">ret</span> = <span class="ruby-ivar">@args</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">a</span><span class="ruby-operator">|</span> <span class="ruby-ivar">@ctx</span>.<span class="ruby-identifier">expand</span>(<span class="ruby-identifier">a</span>) }
|
247
|
+
<span class="ruby-identifier">ret</span> = <span class="ruby-identifier">ret</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">a</span><span class="ruby-operator">|</span> <span class="ruby-string">'"'</span><span class="ruby-operator">+</span><span class="ruby-identifier">a</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-string">'"'</span>, <span class="ruby-string">'""'</span>)<span class="ruby-operator">+</span><span class="ruby-string">'"'</span> } <span class="ruby-keyword">if</span> <span class="ruby-identifier">quote</span>
|
248
|
+
<span class="ruby-identifier">ret</span>
|
252
249
|
<span class="ruby-keyword">end</span></pre>
|
253
250
|
</div>
|
254
251
|
|
@@ -299,8 +296,8 @@ might yield different results.</p>
|
|
299
296
|
|
300
297
|
<div class="method-source-code" id="execute-source">
|
301
298
|
<pre><span class="ruby-comment"># File lib/bauxite/core/action.rb, line 91</span>
|
302
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">execute</span>()
|
303
|
-
<span class="ruby-identifier">send</span>(<span class="ruby-ivar">@cmd_real</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
|
299
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">execute</span>()
|
300
|
+
<span class="ruby-identifier">send</span>(<span class="ruby-ivar">@cmd_real</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
|
304
301
|
<span class="ruby-keyword">end</span></pre>
|
305
302
|
</div>
|
306
303
|
|
@@ -320,7 +317,7 @@ might yield different results.</p>
|
|
320
317
|
|
321
318
|
<footer id="validator-badges" role="contentinfo">
|
322
319
|
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
323
|
-
<p>Generated by <a href="http://
|
324
|
-
<p>Based on <a href="http://deveiate.org/projects/Darkfish-
|
320
|
+
<p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.0.
|
321
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
325
322
|
</footer>
|
326
323
|
|
@@ -6,20 +6,17 @@
|
|
6
6
|
|
7
7
|
<title>class Bauxite::Application - RDoc Documentation</title>
|
8
8
|
|
9
|
-
<link href="../fonts.css" rel="stylesheet">
|
10
|
-
<link href="../rdoc.css" rel="stylesheet">
|
11
|
-
|
12
9
|
<script type="text/javascript">
|
13
10
|
var rdoc_rel_prefix = "../";
|
14
11
|
</script>
|
15
12
|
|
16
13
|
<script src="../js/jquery.js"></script>
|
17
|
-
<script src="../js/navigation.js"></script>
|
18
|
-
<script src="../js/search_index.js"></script>
|
19
|
-
<script src="../js/search.js"></script>
|
20
|
-
<script src="../js/searcher.js"></script>
|
21
14
|
<script src="../js/darkfish.js"></script>
|
22
15
|
|
16
|
+
<link href="../css/fonts.css" rel="stylesheet">
|
17
|
+
<link href="../css/rdoc.css" rel="stylesheet">
|
18
|
+
|
19
|
+
|
23
20
|
|
24
21
|
<body id="top" role="document" class="class">
|
25
22
|
<nav role="navigation">
|
@@ -93,24 +90,24 @@
|
|
93
90
|
<p>This program executes <a href="../Bauxite.html">Bauxite</a> tests and
|
94
91
|
outputs the execution progress and tests results to the terminal.</p>
|
95
92
|
|
96
|
-
<h2 id="class-Bauxite::Application-label-Synopsis">Synopsis<span><a href="#class-Bauxite::Application-label-Synopsis">¶</a> <a href="#
|
93
|
+
<h2 id="class-Bauxite::Application-label-Synopsis">Synopsis<span><a href="#class-Bauxite::Application-label-Synopsis">¶</a> <a href="#top">↑</a></span></h2>
|
97
94
|
|
98
|
-
<pre
|
99
|
-
|
95
|
+
<pre>bauxite [OPTIONS] file1 file2 ...
|
96
|
+
# => Executes file1, then file2, and so on.
|
100
97
|
|
101
|
-
|
102
|
-
|
98
|
+
bauxite [OPTIONS] -d
|
99
|
+
# => Start Bauxite directly in the debug console.
|
103
100
|
|
104
|
-
|
105
|
-
|
106
|
-
</pre>
|
101
|
+
bauxite [OPTIONS]
|
102
|
+
# => Start Bauxite and read test actions from the standard input.</pre>
|
107
103
|
|
108
|
-
<h2 id="class-Bauxite::Application-label-Options">Options<span><a href="#class-Bauxite::Application-label-Options">¶</a> <a href="#
|
104
|
+
<h2 id="class-Bauxite::Application-label-Options">Options<span><a href="#class-Bauxite::Application-label-Options">¶</a> <a href="#top">↑</a></span></h2>
|
109
105
|
|
110
106
|
<p>For a detailed list of options for your <a
|
111
107
|
href="../Bauxite.html">Bauxite</a> version execute:</p>
|
112
108
|
|
113
|
-
<pre>bauxite -h</
|
109
|
+
<pre class="ruby"><span class="ruby-identifier">bauxite</span> <span class="ruby-operator">-</span><span class="ruby-identifier">h</span>
|
110
|
+
</pre>
|
114
111
|
<dl class="rdoc-list label-list"><dt>-v, --verbose
|
115
112
|
<dd>
|
116
113
|
<p>Show verbose error messages (i.e. print exception names and backtraces).</p>
|
@@ -164,7 +161,8 @@ otherwise it defaults to <code>terminal</code>.</p>
|
|
164
161
|
|
165
162
|
<p>To see a complete list of the available loggers execute:</p>
|
166
163
|
|
167
|
-
<pre>bauxite -h</
|
164
|
+
<pre class="ruby"><span class="ruby-identifier">bauxite</span> <span class="ruby-operator">-</span><span class="ruby-identifier">h</span>
|
165
|
+
</pre>
|
168
166
|
|
169
167
|
<p>Note that multiple instances of this option can be specified.</p>
|
170
168
|
</dd><dt>-L, --logger-option OPTION
|
@@ -189,7 +187,8 @@ does not contain an <code>=</code> sign.</p>
|
|
189
187
|
|
190
188
|
<p>To see a complete list of the available selectors execute:</p>
|
191
189
|
|
192
|
-
<pre>bauxite -h</
|
190
|
+
<pre class="ruby"><span class="ruby-identifier">bauxite</span> <span class="ruby-operator">-</span><span class="ruby-identifier">h</span>
|
191
|
+
</pre>
|
193
192
|
</dd><dt>-c, --capture
|
194
193
|
<dd>
|
195
194
|
<p>If the test fails, capture a screenshot in the <code>output</code>
|
@@ -233,28 +232,27 @@ href="Loggers.html">Loggers</a>, etc.) for a specific test run.</p>
|
|
233
232
|
|
234
233
|
<p>For example:</p>
|
235
234
|
|
236
|
-
<pre
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
</pre>
|
235
|
+
<pre># === custom/my_selector.rb ======= #
|
236
|
+
class Bauxite::Selector
|
237
|
+
def by_attr(value)
|
238
|
+
attr "by_attr:#{value}"
|
239
|
+
end
|
240
|
+
end
|
241
|
+
# === end custom/my_selector.rb === #
|
242
|
+
|
243
|
+
# === custom/my_test.bxt ========== #
|
244
|
+
# ...
|
245
|
+
assert "by_attr=attr_value" hello
|
246
|
+
# ...
|
247
|
+
# === end custom/my_test.bxt ====== #
|
248
|
+
|
249
|
+
bauxite -e custom custom/my_test.bxt</pre>
|
252
250
|
</dd><dt>--version
|
253
251
|
<dd>
|
254
252
|
<p>Shows the <a href="../Bauxite.html">Bauxite</a> version.</p>
|
255
253
|
</dd></dl>
|
256
254
|
|
257
|
-
<h2 id="class-Bauxite::Application-label-Exit+Status">Exit Status<span><a href="#class-Bauxite::Application-label-Exit+Status">¶</a> <a href="#
|
255
|
+
<h2 id="class-Bauxite::Application-label-Exit+Status">Exit Status<span><a href="#class-Bauxite::Application-label-Exit+Status">¶</a> <a href="#top">↑</a></span></h2>
|
258
256
|
|
259
257
|
<p>The <code>bauxite</code> program exits with <code>zero</code> if every
|
260
258
|
action in the test succeeded and <code>non-zero</code> otherwise.</p>
|
@@ -285,7 +283,7 @@ indicates success).</p>
|
|
285
283
|
|
286
284
|
<footer id="validator-badges" role="contentinfo">
|
287
285
|
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
288
|
-
<p>Generated by <a href="http://
|
289
|
-
<p>Based on <a href="http://deveiate.org/projects/Darkfish-
|
286
|
+
<p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.0.
|
287
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
290
288
|
</footer>
|
291
289
|
|
data/doc/Bauxite/Context.html
CHANGED
@@ -6,20 +6,17 @@
|
|
6
6
|
|
7
7
|
<title>class Bauxite::Context - RDoc Documentation</title>
|
8
8
|
|
9
|
-
<link href="../fonts.css" rel="stylesheet">
|
10
|
-
<link href="../rdoc.css" rel="stylesheet">
|
11
|
-
|
12
9
|
<script type="text/javascript">
|
13
10
|
var rdoc_rel_prefix = "../";
|
14
11
|
</script>
|
15
12
|
|
16
13
|
<script src="../js/jquery.js"></script>
|
17
|
-
<script src="../js/navigation.js"></script>
|
18
|
-
<script src="../js/search_index.js"></script>
|
19
|
-
<script src="../js/search.js"></script>
|
20
|
-
<script src="../js/searcher.js"></script>
|
21
14
|
<script src="../js/darkfish.js"></script>
|
22
15
|
|
16
|
+
<link href="../css/fonts.css" rel="stylesheet">
|
17
|
+
<link href="../css/rdoc.css" rel="stylesheet">
|
18
|
+
|
19
|
+
|
23
20
|
|
24
21
|
<body id="top" role="document" class="class">
|
25
22
|
<nav role="navigation">
|
@@ -173,7 +170,7 @@
|
|
173
170
|
by clients execute tests and by actions and selectors to interact with the
|
174
171
|
test engine (i.e. Selenium WebDriver).</p>
|
175
172
|
|
176
|
-
<h3 id="class-Bauxite::Context-label-Context+variables"><a href="Context.html">Context</a> variables<span><a href="#class-Bauxite::Context-label-Context+variables">¶</a> <a href="#
|
173
|
+
<h3 id="class-Bauxite::Context-label-Context+variables"><a href="Context.html">Context</a> variables<span><a href="#class-Bauxite::Context-label-Context+variables">¶</a> <a href="#top">↑</a></span></h3>
|
177
174
|
|
178
175
|
<p><a href="Context.html">Context</a> variables are a key/value pairs scoped
|
179
176
|
to the a test context.</p>
|
@@ -193,7 +190,7 @@ variable to the output of an external command (i.e. stdout).</p>
|
|
193
190
|
the result of Javascript command.</p>
|
194
191
|
</li><li>
|
195
192
|
<p><a href="Action.html#method-i-replace">Bauxite::Action#replace</a> sets a
|
196
|
-
variable to the result of doing a
|
193
|
+
variable to the result of doing a find-and-replace operation on a literal.</p>
|
197
194
|
</li></ul>
|
198
195
|
|
199
196
|
<p>Variables can be expanded in every <a href="Action.html">Action</a>
|
@@ -204,12 +201,13 @@ a variable through variable expansion the following syntax must be used:</p>
|
|
204
201
|
|
205
202
|
<p>For example:</p>
|
206
203
|
|
207
|
-
<pre>set field
|
208
|
-
set name
|
209
|
-
write
|
210
|
-
click
|
204
|
+
<pre class="ruby"><span class="ruby-identifier">set</span> <span class="ruby-identifier">field</span> <span class="ruby-string">"greeting"</span>
|
205
|
+
<span class="ruby-identifier">set</span> <span class="ruby-identifier">name</span> <span class="ruby-string">"John"</span>
|
206
|
+
<span class="ruby-identifier">write</span> <span class="ruby-string">"${field}_textbox"</span> <span class="ruby-string">"Hi, my name is ${name}!"</span>
|
207
|
+
<span class="ruby-identifier">click</span> <span class="ruby-string">"${field}_button"</span>
|
208
|
+
</pre>
|
211
209
|
|
212
|
-
<h3 id="class-Bauxite::Context-label-Variable+scope">Variable scope<span><a href="#class-Bauxite::Context-label-Variable+scope">¶</a> <a href="#
|
210
|
+
<h3 id="class-Bauxite::Context-label-Variable+scope">Variable scope<span><a href="#class-Bauxite::Context-label-Variable+scope">¶</a> <a href="#top">↑</a></span></h3>
|
213
211
|
|
214
212
|
<p>When the main test starts (via the <a
|
215
213
|
href="Context.html#method-i-start">start</a> method), the test is bound to
|
@@ -239,7 +237,7 @@ action:</p>
|
|
239
237
|
href="Action.html#method-i-return_action">Bauxite::Action#return_action</a></p>
|
240
238
|
</li></ul>
|
241
239
|
|
242
|
-
<h3 id="class-Bauxite::Context-label-Built-in+variable">Built-in variable<span><a href="#class-Bauxite::Context-label-Built-in+variable">¶</a> <a href="#
|
240
|
+
<h3 id="class-Bauxite::Context-label-Built-in+variable">Built-in variable<span><a href="#class-Bauxite::Context-label-Built-in+variable">¶</a> <a href="#top">↑</a></span></h3>
|
243
241
|
|
244
242
|
<p><a href="../Bauxite.html">Bauxite</a> has a series of built-in variables
|
245
243
|
that provide information of the current test context and allow dynamic
|
@@ -404,29 +402,29 @@ href="Context.html#method-i-stop">stop</a> (defaults to <code>false</code>)</p>
|
|
404
402
|
|
405
403
|
<div class="method-source-code" id="new-source">
|
406
404
|
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 138</span>
|
407
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">options</span>)
|
408
|
-
<span class="ruby-ivar">@options</span> = <span class="ruby-identifier">options</span>
|
409
|
-
<span class="ruby-ivar">@driver_name</span> = (<span class="ruby-identifier">options</span>[<span class="ruby-value">:driver</span>] <span class="ruby-operator">||</span> <span class="ruby-value">:firefox</span>).<span class="ruby-identifier">to_sym</span>
|
410
|
-
<span class="ruby-ivar">@variables</span> = {
|
411
|
-
<span class="ruby-string">'__TIMEOUT__'</span> =<span class="ruby-operator">></span> (<span class="ruby-identifier">options</span>[<span class="ruby-value">:timeout</span>] <span class="ruby-operator">||</span> <span class="ruby-value">10</span>).<span class="ruby-identifier">to_i</span>,
|
412
|
-
<span class="ruby-string">'__DEBUG__'</span> =<span class="ruby-operator">></span> <span class="ruby-keyword">false</span>,
|
413
|
-
<span class="ruby-string">'__SELECTOR__'</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">options</span>[<span class="ruby-value">:selector</span>] <span class="ruby-operator">||</span> <span class="ruby-string">'sid'</span>,
|
414
|
-
<span class="ruby-string">'__OUTPUT__'</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">options</span>[<span class="ruby-value">:output</span>],
|
415
|
-
<span class="ruby-string">'__DIR__'</span> =<span class="ruby-operator">></span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">absolute_path</span>(<span class="ruby-constant">Dir</span>.<span class="ruby-identifier">pwd</span>)
|
416
|
-
}
|
417
|
-
<span class="ruby-ivar">@aliases</span> = {}
|
418
|
-
<span class="ruby-ivar">@tests</span> = []
|
419
|
-
|
420
|
-
<span class="ruby-identifier">client</span> = <span class="ruby-constant">Selenium</span><span class="ruby-operator">::</span><span class="ruby-constant">WebDriver</span><span class="ruby-operator">::</span><span class="ruby-constant">Remote</span><span class="ruby-operator">::</span><span class="ruby-constant">Http</span><span class="ruby-operator">::</span><span class="ruby-constant">Default</span>.<span class="ruby-identifier">new</span>
|
421
|
-
<span class="ruby-identifier">client</span>.<span class="ruby-identifier">timeout</span> = (<span class="ruby-ivar">@options</span>[<span class="ruby-value">:open_timeout</span>] <span class="ruby-operator">||</span> <span class="ruby-value">60</span>).<span class="ruby-identifier">to_i</span>
|
422
|
-
<span class="ruby-ivar">@options</span>[<span class="ruby-value">:driver_opt</span>] = {} <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@options</span>[<span class="ruby-value">:driver_opt</span>]
|
423
|
-
<span class="ruby-ivar">@options</span>[<span class="ruby-value">:driver_opt</span>][<span class="ruby-value">:http_client</span>] = <span class="ruby-identifier">client</span>
|
424
|
-
|
425
|
-
<span class="ruby-identifier">_load_extensions</span>(<span class="ruby-identifier">options</span>[<span class="ruby-value">:extensions</span>] <span class="ruby-operator">||</span> [])
|
426
|
-
|
427
|
-
<span class="ruby-ivar">@logger</span> = <span class="ruby-constant">Context</span><span class="ruby-operator">::</span><span class="ruby-identifier">load_logger</span>(<span class="ruby-identifier">options</span>[<span class="ruby-value">:logger</span>], <span class="ruby-identifier">options</span>[<span class="ruby-value">:logger_opt</span>])
|
428
|
-
|
429
|
-
<span class="ruby-ivar">@parser</span> = <span class="ruby-constant">Parser</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword">self</span>)
|
405
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">options</span>)
|
406
|
+
<span class="ruby-ivar">@options</span> = <span class="ruby-identifier">options</span>
|
407
|
+
<span class="ruby-ivar">@driver_name</span> = (<span class="ruby-identifier">options</span>[<span class="ruby-value">:driver</span>] <span class="ruby-operator">||</span> <span class="ruby-value">:firefox</span>).<span class="ruby-identifier">to_sym</span>
|
408
|
+
<span class="ruby-ivar">@variables</span> = {
|
409
|
+
<span class="ruby-string">'__TIMEOUT__'</span> =<span class="ruby-operator">></span> (<span class="ruby-identifier">options</span>[<span class="ruby-value">:timeout</span>] <span class="ruby-operator">||</span> <span class="ruby-value">10</span>).<span class="ruby-identifier">to_i</span>,
|
410
|
+
<span class="ruby-string">'__DEBUG__'</span> =<span class="ruby-operator">></span> <span class="ruby-keyword">false</span>,
|
411
|
+
<span class="ruby-string">'__SELECTOR__'</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">options</span>[<span class="ruby-value">:selector</span>] <span class="ruby-operator">||</span> <span class="ruby-string">'sid'</span>,
|
412
|
+
<span class="ruby-string">'__OUTPUT__'</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">options</span>[<span class="ruby-value">:output</span>],
|
413
|
+
<span class="ruby-string">'__DIR__'</span> =<span class="ruby-operator">></span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">absolute_path</span>(<span class="ruby-constant">Dir</span>.<span class="ruby-identifier">pwd</span>)
|
414
|
+
}
|
415
|
+
<span class="ruby-ivar">@aliases</span> = {}
|
416
|
+
<span class="ruby-ivar">@tests</span> = []
|
417
|
+
|
418
|
+
<span class="ruby-identifier">client</span> = <span class="ruby-constant">Selenium</span><span class="ruby-operator">::</span><span class="ruby-constant">WebDriver</span><span class="ruby-operator">::</span><span class="ruby-constant">Remote</span><span class="ruby-operator">::</span><span class="ruby-constant">Http</span><span class="ruby-operator">::</span><span class="ruby-constant">Default</span>.<span class="ruby-identifier">new</span>
|
419
|
+
<span class="ruby-identifier">client</span>.<span class="ruby-identifier">timeout</span> = (<span class="ruby-ivar">@options</span>[<span class="ruby-value">:open_timeout</span>] <span class="ruby-operator">||</span> <span class="ruby-value">60</span>).<span class="ruby-identifier">to_i</span>
|
420
|
+
<span class="ruby-ivar">@options</span>[<span class="ruby-value">:driver_opt</span>] = {} <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@options</span>[<span class="ruby-value">:driver_opt</span>]
|
421
|
+
<span class="ruby-ivar">@options</span>[<span class="ruby-value">:driver_opt</span>][<span class="ruby-value">:http_client</span>] = <span class="ruby-identifier">client</span>
|
422
|
+
|
423
|
+
<span class="ruby-identifier">_load_extensions</span>(<span class="ruby-identifier">options</span>[<span class="ruby-value">:extensions</span>] <span class="ruby-operator">||</span> [])
|
424
|
+
|
425
|
+
<span class="ruby-ivar">@logger</span> = <span class="ruby-constant">Context</span><span class="ruby-operator">::</span><span class="ruby-identifier">load_logger</span>(<span class="ruby-identifier">options</span>[<span class="ruby-value">:logger</span>], <span class="ruby-identifier">options</span>[<span class="ruby-value">:logger_opt</span>])
|
426
|
+
|
427
|
+
<span class="ruby-ivar">@parser</span> = <span class="ruby-constant">Parser</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword">self</span>)
|
430
428
|
<span class="ruby-keyword">end</span></pre>
|
431
429
|
</div>
|
432
430
|
|
@@ -472,8 +470,8 @@ href="Context.html#method-i-stop">stop</a> (defaults to <code>false</code>)</p>
|
|
472
470
|
|
473
471
|
<div class="method-source-code" id="debug-source">
|
474
472
|
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 269</span>
|
475
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">debug</span>
|
476
|
-
<span class="ruby-identifier">exec_parsed_action</span>(<span class="ruby-string">'debug'</span>, [], <span class="ruby-keyword">false</span>)
|
473
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">debug</span>
|
474
|
+
<span class="ruby-identifier">exec_parsed_action</span>(<span class="ruby-string">'debug'</span>, [], <span class="ruby-keyword">false</span>)
|
477
475
|
<span class="ruby-keyword">end</span></pre>
|
478
476
|
</div>
|
479
477
|
|
@@ -505,9 +503,9 @@ href="Context.html#method-i-stop">stop</a> (defaults to <code>false</code>)</p>
|
|
505
503
|
|
506
504
|
<div class="method-source-code" id="driver-source">
|
507
505
|
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 259</span>
|
508
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">driver</span>
|
509
|
-
<span class="ruby-identifier">_load_driver</span> <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@driver</span>
|
510
|
-
<span class="ruby-ivar">@driver</span>
|
506
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">driver</span>
|
507
|
+
<span class="ruby-identifier">_load_driver</span> <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@driver</span>
|
508
|
+
<span class="ruby-ivar">@driver</span>
|
511
509
|
<span class="ruby-keyword">end</span></pre>
|
512
510
|
</div>
|
513
511
|
|
@@ -537,7 +535,7 @@ href="Context.html#method-i-stop">stop</a> (defaults to <code>false</code>)</p>
|
|
537
535
|
<p>The element found is yielded to the given <code>block</code> (if any) and
|
538
536
|
returned.</p>
|
539
537
|
|
540
|
-
<p>Note that the recommeneded way to call this method is by passing a
|
538
|
+
<p>Note that the recommeneded way to call this method is by passing a
|
541
539
|
<code>block</code>. This is because the method ensures that the element
|
542
540
|
context is maintained for the duration of the <code>block</code> but it
|
543
541
|
makes no guarantees after the <code>block</code> completes (the same
|
@@ -563,10 +561,10 @@ applies if no <code>block</code> was given).</p>
|
|
563
561
|
|
564
562
|
<div class="method-source-code" id="find-source">
|
565
563
|
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 252</span>
|
566
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">find</span>(<span class="ruby-identifier">selector</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>) <span class="ruby-comment"># yields: element
|
567
|
-
<span class="ruby-identifier">with_timeout</span> <span class="ruby-constant">Selenium</span><span class="ruby-operator">::</span><span class="ruby-constant">WebDriver</span><span class="ruby-operator">::</span><span class="ruby-constant">Error</span><span class="ruby-operator">::</span><span class="ruby-constant">NoSuchElementError</span> <span class="ruby-keyword">do</span>
|
568
|
-
<span class="ruby-constant">Selector</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword">self</span>, <span class="ruby-ivar">@variables</span>[<span class="ruby-string">'__SELECTOR__'</span>]).<span class="ruby-identifier">find</span>(<span class="ruby-identifier">selector</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
569
|
-
<span class="ruby-keyword">end</span>
|
564
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">find</span>(<span class="ruby-identifier">selector</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>) <span class="ruby-comment"># yields: element
|
565
|
+
<span class="ruby-identifier">with_timeout</span> <span class="ruby-constant">Selenium</span><span class="ruby-operator">::</span><span class="ruby-constant">WebDriver</span><span class="ruby-operator">::</span><span class="ruby-constant">Error</span><span class="ruby-operator">::</span><span class="ruby-constant">NoSuchElementError</span> <span class="ruby-keyword">do</span>
|
566
|
+
<span class="ruby-constant">Selector</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword">self</span>, <span class="ruby-ivar">@variables</span>[<span class="ruby-string">'__SELECTOR__'</span>]).<span class="ruby-identifier">find</span>(<span class="ruby-identifier">selector</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
567
|
+
<span class="ruby-keyword">end</span>
|
570
568
|
<span class="ruby-keyword">end</span></pre>
|
571
569
|
</div>
|
572
570
|
|
@@ -613,12 +611,12 @@ the inner text or the value of the <code>value</code> attribute.</p>
|
|
613
611
|
|
614
612
|
<div class="method-source-code" id="get_value-source">
|
615
613
|
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 288</span>
|
616
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">get_value</span>(<span class="ruby-identifier">element</span>)
|
617
|
-
<span class="ruby-keyword">if</span> [<span class="ruby-string">'input'</span>,<span class="ruby-string">'select'</span>,<span class="ruby-string">'textarea'</span>].<span class="ruby-identifier">include?</span> <span class="ruby-identifier">element</span>.<span class="ruby-identifier">tag_name</span>.<span class="ruby-identifier">downcase</span>
|
618
|
-
<span class="ruby-identifier">element</span>.<span class="ruby-identifier">attribute</span>(<span class="ruby-string">'value'</span>)
|
619
|
-
<span class="ruby-keyword">else</span>
|
620
|
-
<span class="ruby-identifier">element</span>.<span class="ruby-identifier">text</span>
|
621
|
-
<span class="ruby-keyword">end</span>
|
614
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">get_value</span>(<span class="ruby-identifier">element</span>)
|
615
|
+
<span class="ruby-keyword">if</span> [<span class="ruby-string">'input'</span>,<span class="ruby-string">'select'</span>,<span class="ruby-string">'textarea'</span>].<span class="ruby-identifier">include?</span> <span class="ruby-identifier">element</span>.<span class="ruby-identifier">tag_name</span>.<span class="ruby-identifier">downcase</span>
|
616
|
+
<span class="ruby-identifier">element</span>.<span class="ruby-identifier">attribute</span>(<span class="ruby-string">'value'</span>)
|
617
|
+
<span class="ruby-keyword">else</span>
|
618
|
+
<span class="ruby-identifier">element</span>.<span class="ruby-identifier">text</span>
|
619
|
+
<span class="ruby-keyword">end</span>
|
622
620
|
<span class="ruby-keyword">end</span></pre>
|
623
621
|
</div>
|
624
622
|
|
@@ -647,18 +645,17 @@ the inner text or the value of the <code>value</code> attribute.</p>
|
|
647
645
|
|
648
646
|
<p>For example:</p>
|
649
647
|
|
650
|
-
<pre
|
651
|
-
|
652
|
-
</pre>
|
648
|
+
<pre>ctx.reset_driver
|
649
|
+
=> closes the browser and opens a new one</pre>
|
653
650
|
|
654
651
|
|
655
652
|
|
656
653
|
|
657
654
|
<div class="method-source-code" id="reset_driver-source">
|
658
655
|
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 200</span>
|
659
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">reset_driver</span>
|
660
|
-
<span class="ruby-ivar">@driver</span>.<span class="ruby-identifier">quit</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@driver</span>
|
661
|
-
<span class="ruby-ivar">@driver</span> = <span class="ruby-keyword">nil</span>
|
656
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">reset_driver</span>
|
657
|
+
<span class="ruby-ivar">@driver</span>.<span class="ruby-identifier">quit</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@driver</span>
|
658
|
+
<span class="ruby-ivar">@driver</span> = <span class="ruby-keyword">nil</span>
|
662
659
|
<span class="ruby-keyword">end</span></pre>
|
663
660
|
</div>
|
664
661
|
|
@@ -705,21 +702,21 @@ href="Context.html#method-i-stop">stop</a>).</p>
|
|
705
702
|
|
706
703
|
<div class="method-source-code" id="start-source">
|
707
704
|
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 177</span>
|
708
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">start</span>(<span class="ruby-identifier">actions</span> = [])
|
709
|
-
<span class="ruby-keyword">return</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">actions</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
|
710
|
-
<span class="ruby-keyword">begin</span>
|
711
|
-
<span class="ruby-identifier">actions</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">action</span><span class="ruby-operator">|</span>
|
712
|
-
<span class="ruby-keyword">begin</span>
|
713
|
-
<span class="ruby-keyword">break</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">exec_action</span>(<span class="ruby-identifier">action</span>) <span class="ruby-operator">==</span> <span class="ruby-value">:break</span>
|
714
|
-
<span class="ruby-keyword">rescue</span> <span class="ruby-constant">StandardError</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
|
715
|
-
<span class="ruby-identifier">print_error</span>(<span class="ruby-identifier">e</span>)
|
716
|
-
<span class="ruby-identifier">raise</span> <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@options</span>[<span class="ruby-value">:debug</span>]
|
717
|
-
<span class="ruby-identifier">debug</span>
|
718
|
-
<span class="ruby-keyword">end</span>
|
719
|
-
<span class="ruby-keyword">end</span>
|
720
|
-
<span class="ruby-keyword">ensure</span>
|
721
|
-
<span class="ruby-identifier">stop</span>
|
722
|
-
<span class="ruby-keyword">end</span>
|
705
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">start</span>(<span class="ruby-identifier">actions</span> = [])
|
706
|
+
<span class="ruby-keyword">return</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">actions</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
|
707
|
+
<span class="ruby-keyword">begin</span>
|
708
|
+
<span class="ruby-identifier">actions</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">action</span><span class="ruby-operator">|</span>
|
709
|
+
<span class="ruby-keyword">begin</span>
|
710
|
+
<span class="ruby-keyword">break</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">exec_action</span>(<span class="ruby-identifier">action</span>) <span class="ruby-operator">==</span> <span class="ruby-value">:break</span>
|
711
|
+
<span class="ruby-keyword">rescue</span> <span class="ruby-constant">StandardError</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
|
712
|
+
<span class="ruby-identifier">print_error</span>(<span class="ruby-identifier">e</span>)
|
713
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@options</span>[<span class="ruby-value">:debug</span>]
|
714
|
+
<span class="ruby-identifier">debug</span>
|
715
|
+
<span class="ruby-keyword">end</span>
|
716
|
+
<span class="ruby-keyword">end</span>
|
717
|
+
<span class="ruby-keyword">ensure</span>
|
718
|
+
<span class="ruby-identifier">stop</span>
|
719
|
+
<span class="ruby-keyword">end</span>
|
723
720
|
<span class="ruby-keyword">end</span></pre>
|
724
721
|
</div>
|
725
722
|
|
@@ -769,16 +766,16 @@ href="Context.html#method-i-stop">stop</a> pattern.</p>
|
|
769
766
|
|
770
767
|
<div class="method-source-code" id="stop-source">
|
771
768
|
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 220</span>
|
772
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">stop</span>
|
773
|
-
<span class="ruby-constant">Context</span><span class="ruby-operator">::</span><span class="ruby-identifier">wait</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@options</span>[<span class="ruby-value">:wait</span>]
|
774
|
-
<span class="ruby-keyword">begin</span>
|
775
|
-
<span class="ruby-ivar">@logger</span>.<span class="ruby-identifier">finalize</span>(<span class="ruby-keyword">self</span>)
|
776
|
-
<span class="ruby-keyword">rescue</span> <span class="ruby-constant">StandardError</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
|
777
|
-
<span class="ruby-identifier">print_error</span>(<span class="ruby-identifier">e</span>)
|
778
|
-
<span class="ruby-identifier">raise</span>
|
779
|
-
<span class="ruby-keyword">ensure</span>
|
780
|
-
<span class="ruby-ivar">@driver</span>.<span class="ruby-identifier">quit</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@driver</span>
|
781
|
-
<span class="ruby-keyword">end</span>
|
769
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">stop</span>
|
770
|
+
<span class="ruby-constant">Context</span><span class="ruby-operator">::</span><span class="ruby-identifier">wait</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@options</span>[<span class="ruby-value">:wait</span>]
|
771
|
+
<span class="ruby-keyword">begin</span>
|
772
|
+
<span class="ruby-ivar">@logger</span>.<span class="ruby-identifier">finalize</span>(<span class="ruby-keyword">self</span>)
|
773
|
+
<span class="ruby-keyword">rescue</span> <span class="ruby-constant">StandardError</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
|
774
|
+
<span class="ruby-identifier">print_error</span>(<span class="ruby-identifier">e</span>)
|
775
|
+
<span class="ruby-identifier">raise</span>
|
776
|
+
<span class="ruby-keyword">ensure</span>
|
777
|
+
<span class="ruby-ivar">@driver</span>.<span class="ruby-identifier">quit</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@driver</span>
|
778
|
+
<span class="ruby-keyword">end</span>
|
782
779
|
<span class="ruby-keyword">end</span></pre>
|
783
780
|
</div>
|
784
781
|
|
@@ -842,23 +839,23 @@ logger type.</p>
|
|
842
839
|
|
843
840
|
<div class="method-source-code" id="load_logger-source">
|
844
841
|
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 432</span>
|
845
|
-
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">load_logger</span>(<span class="ruby-identifier">loggers</span>, <span class="ruby-identifier">options</span>)
|
846
|
-
<span class="ruby-keyword">if</span> <span class="ruby-identifier">loggers</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">Array</span>
|
847
|
-
<span class="ruby-keyword">return</span> <span class="ruby-constant">Loggers</span><span class="ruby-operator">::</span><span class="ruby-constant">CompositeLogger</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">options</span>, <span class="ruby-identifier">loggers</span>)
|
848
|
-
<span class="ruby-keyword">end</span>
|
849
|
-
|
850
|
-
<span class="ruby-identifier">name</span> = <span class="ruby-identifier">loggers</span>
|
851
|
-
|
852
|
-
<span class="ruby-identifier">log_name</span> = (<span class="ruby-identifier">name</span> <span class="ruby-operator">||</span> <span class="ruby-string">'null'</span>).<span class="ruby-identifier">downcase</span>
|
853
|
-
|
854
|
-
<span class="ruby-identifier">class_name</span> = <span class="ruby-node">"#{log_name.capitalize}Logger"</span>
|
855
|
-
|
856
|
-
<span class="ruby-keyword">unless</span> <span class="ruby-constant">Loggers</span>.<span class="ruby-identifier">const_defined?</span> <span class="ruby-identifier">class_name</span>.<span class="ruby-identifier">to_sym</span>
|
857
|
-
<span class="ruby-identifier">raise</span> <span class="ruby-constant">NameError</span>,
|
858
|
-
<span class="ruby-node">"Invalid logger '#{log_name}'"</span>
|
859
|
-
<span class="ruby-keyword">end</span>
|
860
|
-
|
861
|
-
<span class="ruby-constant">Loggers</span>.<span class="ruby-identifier">const_get</span>(<span class="ruby-identifier">class_name</span>).<span class="ruby-identifier">new</span>(<span class="ruby-identifier">options</span>)
|
842
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">load_logger</span>(<span class="ruby-identifier">loggers</span>, <span class="ruby-identifier">options</span>)
|
843
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">loggers</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">Array</span>
|
844
|
+
<span class="ruby-keyword">return</span> <span class="ruby-constant">Loggers</span><span class="ruby-operator">::</span><span class="ruby-constant">CompositeLogger</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">options</span>, <span class="ruby-identifier">loggers</span>)
|
845
|
+
<span class="ruby-keyword">end</span>
|
846
|
+
|
847
|
+
<span class="ruby-identifier">name</span> = <span class="ruby-identifier">loggers</span>
|
848
|
+
|
849
|
+
<span class="ruby-identifier">log_name</span> = (<span class="ruby-identifier">name</span> <span class="ruby-operator">||</span> <span class="ruby-string">'null'</span>).<span class="ruby-identifier">downcase</span>
|
850
|
+
|
851
|
+
<span class="ruby-identifier">class_name</span> = <span class="ruby-node">"#{log_name.capitalize}Logger"</span>
|
852
|
+
|
853
|
+
<span class="ruby-keyword">unless</span> <span class="ruby-constant">Loggers</span>.<span class="ruby-identifier">const_defined?</span> <span class="ruby-identifier">class_name</span>.<span class="ruby-identifier">to_sym</span>
|
854
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">NameError</span>,
|
855
|
+
<span class="ruby-node">"Invalid logger '#{log_name}'"</span>
|
856
|
+
<span class="ruby-keyword">end</span>
|
857
|
+
|
858
|
+
<span class="ruby-constant">Loggers</span>.<span class="ruby-identifier">const_get</span>(<span class="ruby-identifier">class_name</span>).<span class="ruby-identifier">new</span>(<span class="ruby-identifier">options</span>)
|
862
859
|
<span class="ruby-keyword">end</span></pre>
|
863
860
|
</div>
|
864
861
|
|
@@ -890,37 +887,37 @@ logger type.</p>
|
|
890
887
|
|
891
888
|
<div class="method-source-code" id="parse_action_default-source">
|
892
889
|
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 460</span>
|
893
|
-
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">parse_action_default</span>(<span class="ruby-identifier">text</span>, <span class="ruby-identifier">file</span> = <span class="ruby-string">'<unknown>'</span>, <span class="ruby-identifier">line</span> = <span class="ruby-value">0</span>)
|
894
|
-
<span class="ruby-identifier">data</span> = <span class="ruby-identifier">text</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">' '</span>, <span class="ruby-value">2</span>)
|
895
|
-
<span class="ruby-keyword">begin</span>
|
896
|
-
<span class="ruby-identifier">args_text</span> = <span class="ruby-identifier">data</span>[<span class="ruby-value">1</span>] <span class="ruby-operator">?</span> <span class="ruby-identifier">data</span>[<span class="ruby-value">1</span>].<span class="ruby-identifier">strip</span> <span class="ruby-operator">:</span> <span class="ruby-string">''</span>
|
897
|
-
<span class="ruby-identifier">args</span> = []
|
898
|
-
|
899
|
-
<span class="ruby-keyword">unless</span> <span class="ruby-identifier">args_text</span> <span class="ruby-operator">==</span> <span class="ruby-string">''</span>
|
900
|
-
<span class="ruby-comment"># col_sep must be a regex because String.split has a
|
901
|
-
<span class="ruby-comment"># special case for a single space char (' ') that produced
|
902
|
-
<span class="ruby-comment"># unexpected results (i.e. if line is '"a b"' the
|
903
|
-
<span class="ruby-comment"># resulting array contains ["a b"])
|
904
|
-
<span class="ruby-comment"
|
905
|
-
<span class="ruby-comment"># ...but...
|
906
|
-
<span class="ruby-comment"
|
907
|
-
<span class="ruby-comment"># CSV expects col_sep to be a string so we need to work
|
908
|
-
<span class="ruby-comment"># some dark magic here. Basically we proxy the StringIO
|
909
|
-
<span class="ruby-comment"># received by CSV to returns strings for which the split
|
910
|
-
<span class="ruby-comment"># method does not fold the whitespaces
|
911
|
-
<span class="ruby-comment"
|
912
|
-
<span class="ruby-identifier">args</span> = <span class="ruby-constant">CSV</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">StringIOProxy</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">args_text</span>), { <span class="ruby-value">:col_sep</span> =<span class="ruby-operator">></span> <span class="ruby-string">' '</span> })
|
913
|
-
.<span class="ruby-identifier">shift</span>
|
914
|
-
.<span class="ruby-identifier">select</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">a</span><span class="ruby-operator">|</span> <span class="ruby-identifier">a</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword">nil</span> } <span class="ruby-operator">||</span> []
|
915
|
-
<span class="ruby-keyword">end</span>
|
916
|
-
|
917
|
-
{
|
918
|
-
<span class="ruby-value">:action</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">data</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">strip</span>.<span class="ruby-identifier">downcase</span>,
|
919
|
-
<span class="ruby-value">:args</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">args</span>
|
920
|
-
}
|
921
|
-
<span class="ruby-keyword">rescue</span> <span class="ruby-constant">StandardError</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
|
922
|
-
<span class="ruby-identifier">raise</span> <span class="ruby-node">"#{file} (line #{line+1}): #{e.message}"</span>
|
923
|
-
<span class="ruby-keyword">end</span>
|
890
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">parse_action_default</span>(<span class="ruby-identifier">text</span>, <span class="ruby-identifier">file</span> = <span class="ruby-string">'<unknown>'</span>, <span class="ruby-identifier">line</span> = <span class="ruby-value">0</span>)
|
891
|
+
<span class="ruby-identifier">data</span> = <span class="ruby-identifier">text</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">' '</span>, <span class="ruby-value">2</span>)
|
892
|
+
<span class="ruby-keyword">begin</span>
|
893
|
+
<span class="ruby-identifier">args_text</span> = <span class="ruby-identifier">data</span>[<span class="ruby-value">1</span>] <span class="ruby-operator">?</span> <span class="ruby-identifier">data</span>[<span class="ruby-value">1</span>].<span class="ruby-identifier">strip</span> <span class="ruby-operator">:</span> <span class="ruby-string">''</span>
|
894
|
+
<span class="ruby-identifier">args</span> = []
|
895
|
+
|
896
|
+
<span class="ruby-keyword">unless</span> <span class="ruby-identifier">args_text</span> <span class="ruby-operator">==</span> <span class="ruby-string">''</span>
|
897
|
+
<span class="ruby-comment"># col_sep must be a regex because String.split has a
|
898
|
+
<span class="ruby-comment"># special case for a single space char (' ') that produced
|
899
|
+
<span class="ruby-comment"># unexpected results (i.e. if line is '"a b"' the
|
900
|
+
<span class="ruby-comment"># resulting array contains ["a b"]).
|
901
|
+
<span class="ruby-comment">#
|
902
|
+
<span class="ruby-comment"># ...but...
|
903
|
+
<span class="ruby-comment">#
|
904
|
+
<span class="ruby-comment"># CSV expects col_sep to be a string so we need to work
|
905
|
+
<span class="ruby-comment"># some dark magic here. Basically we proxy the StringIO
|
906
|
+
<span class="ruby-comment"># received by CSV to returns strings for which the split
|
907
|
+
<span class="ruby-comment"># method does not fold the whitespaces.
|
908
|
+
<span class="ruby-comment">#
|
909
|
+
<span class="ruby-identifier">args</span> = <span class="ruby-constant">CSV</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">StringIOProxy</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">args_text</span>), { <span class="ruby-value">:col_sep</span> =<span class="ruby-operator">></span> <span class="ruby-string">' '</span> })
|
910
|
+
.<span class="ruby-identifier">shift</span>
|
911
|
+
.<span class="ruby-identifier">select</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">a</span><span class="ruby-operator">|</span> <span class="ruby-identifier">a</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword">nil</span> } <span class="ruby-operator">||</span> []
|
912
|
+
<span class="ruby-keyword">end</span>
|
913
|
+
|
914
|
+
{
|
915
|
+
<span class="ruby-value">:action</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">data</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">strip</span>.<span class="ruby-identifier">downcase</span>,
|
916
|
+
<span class="ruby-value">:args</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">args</span>
|
917
|
+
}
|
918
|
+
<span class="ruby-keyword">rescue</span> <span class="ruby-constant">StandardError</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
|
919
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-node">"#{file} (line #{line+1}): #{e.message}"</span>
|
920
|
+
<span class="ruby-keyword">end</span>
|
924
921
|
<span class="ruby-keyword">end</span></pre>
|
925
922
|
</div>
|
926
923
|
|
@@ -958,8 +955,8 @@ logger type.</p>
|
|
958
955
|
|
959
956
|
<div class="method-source-code" id="wait-source">
|
960
957
|
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 425</span>
|
961
|
-
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">wait</span>
|
962
|
-
<span class="ruby-constant">Readline</span>.<span class="ruby-identifier">readline</span>(<span class="ruby-string">"Press ENTER to continue\n"</span>)
|
958
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">wait</span>
|
959
|
+
<span class="ruby-constant">Readline</span>.<span class="ruby-identifier">readline</span>(<span class="ruby-string">"Press ENTER to continue\n"</span>)
|
963
960
|
<span class="ruby-keyword">end</span></pre>
|
964
961
|
</div>
|
965
962
|
|
@@ -1000,8 +997,8 @@ with the arguments specified in <code>args</code>.</p>
|
|
1000
997
|
|
1001
998
|
<div class="method-source-code" id="add_alias-source">
|
1002
999
|
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 454</span>
|
1003
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">add_alias</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">action</span>, <span class="ruby-identifier">args</span>)
|
1004
|
-
<span class="ruby-ivar">@aliases</span>[<span class="ruby-identifier">name</span>] = { <span class="ruby-value">:action</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">action</span>, <span class="ruby-value">:args</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">args</span> }
|
1000
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">add_alias</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">action</span>, <span class="ruby-identifier">args</span>)
|
1001
|
+
<span class="ruby-ivar">@aliases</span>[<span class="ruby-identifier">name</span>] = { <span class="ruby-value">:action</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">action</span>, <span class="ruby-value">:args</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">args</span> }
|
1005
1002
|
<span class="ruby-keyword">end</span></pre>
|
1006
1003
|
</div>
|
1007
1004
|
|
@@ -1043,9 +1040,9 @@ behavior).</p>
|
|
1043
1040
|
|
1044
1041
|
<div class="method-source-code" id="exec_action-source">
|
1045
1042
|
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 309</span>
|
1046
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">exec_action</span>(<span class="ruby-identifier">text</span>)
|
1047
|
-
<span class="ruby-identifier">data</span> = <span class="ruby-constant">Context</span><span class="ruby-operator">::</span><span class="ruby-identifier">parse_action_default</span>(<span class="ruby-identifier">text</span>, <span class="ruby-string">'<unknown>'</span>, <span class="ruby-value">0</span>)
|
1048
|
-
<span class="ruby-identifier">exec_parsed_action</span>(<span class="ruby-identifier">data</span>[<span class="ruby-value">:action</span>], <span class="ruby-identifier">data</span>[<span class="ruby-value">:args</span>], <span class="ruby-keyword">true</span>, <span class="ruby-identifier">text</span>)
|
1043
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">exec_action</span>(<span class="ruby-identifier">text</span>)
|
1044
|
+
<span class="ruby-identifier">data</span> = <span class="ruby-constant">Context</span><span class="ruby-operator">::</span><span class="ruby-identifier">parse_action_default</span>(<span class="ruby-identifier">text</span>, <span class="ruby-string">'<unknown>'</span>, <span class="ruby-value">0</span>)
|
1045
|
+
<span class="ruby-identifier">exec_parsed_action</span>(<span class="ruby-identifier">data</span>[<span class="ruby-value">:action</span>], <span class="ruby-identifier">data</span>[<span class="ruby-value">:args</span>], <span class="ruby-keyword">true</span>, <span class="ruby-identifier">text</span>)
|
1049
1046
|
<span class="ruby-keyword">end</span></pre>
|
1050
1047
|
</div>
|
1051
1048
|
|
@@ -1082,17 +1079,18 @@ preferred.</p>
|
|
1082
1079
|
|
1083
1080
|
<p>For example:</p>
|
1084
1081
|
|
1085
|
-
<pre>action = ctx
|
1086
|
-
ret = ctx
|
1087
|
-
ret
|
1082
|
+
<pre class="ruby"><span class="ruby-identifier">action</span> = <span class="ruby-identifier">ctx</span>.<span class="ruby-identifier">get_action</span>(<span class="ruby-string">"echo"</span>, [<span class="ruby-string">'Hi!'</span>], <span class="ruby-string">'echo "Hi!"'</span>)
|
1083
|
+
<span class="ruby-identifier">ret</span> = <span class="ruby-identifier">ctx</span>.<span class="ruby-identifier">exec_action_object</span>(<span class="ruby-identifier">action</span>)
|
1084
|
+
<span class="ruby-identifier">ret</span>.<span class="ruby-identifier">call</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">ret</span>.<span class="ruby-identifier">respond_to?</span> :<span class="ruby-identifier">call</span>
|
1085
|
+
</pre>
|
1088
1086
|
|
1089
1087
|
|
1090
1088
|
|
1091
1089
|
|
1092
1090
|
<div class="method-source-code" id="exec_action_object-source">
|
1093
1091
|
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 540</span>
|
1094
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">exec_action_object</span>(<span class="ruby-identifier">action</span>)
|
1095
|
-
<span class="ruby-identifier">action</span>.<span class="ruby-identifier">execute</span>
|
1092
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">exec_action_object</span>(<span class="ruby-identifier">action</span>)
|
1093
|
+
<span class="ruby-identifier">action</span>.<span class="ruby-identifier">execute</span>
|
1096
1094
|
<span class="ruby-keyword">end</span></pre>
|
1097
1095
|
</div>
|
1098
1096
|
|
@@ -1130,21 +1128,21 @@ ret.call if ret.respond_to? :call</pre>
|
|
1130
1128
|
|
1131
1129
|
<div class="method-source-code" id="exec_file-source">
|
1132
1130
|
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 320</span>
|
1133
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">exec_file</span>(<span class="ruby-identifier">file</span>)
|
1134
|
-
<span class="ruby-identifier">current_dir</span> = <span class="ruby-ivar">@variables</span>[<span class="ruby-string">'__DIR__'</span> ]
|
1135
|
-
<span class="ruby-identifier">current_file</span> = <span class="ruby-ivar">@variables</span>[<span class="ruby-string">'__FILE__'</span>]
|
1136
|
-
<span class="ruby-identifier">current_line</span> = <span class="ruby-ivar">@variables</span>[<span class="ruby-string">'__LINE__'</span>]
|
1137
|
-
|
1138
|
-
<span class="ruby-ivar">@parser</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">file</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">action</span>, <span class="ruby-identifier">args</span>, <span class="ruby-identifier">text</span>, <span class="ruby-identifier">file</span>, <span class="ruby-identifier">line</span><span class="ruby-operator">|</span>
|
1139
|
-
<span class="ruby-ivar">@variables</span>[<span class="ruby-string">'__DIR__'</span>] = <span class="ruby-constant">File</span>.<span class="ruby-identifier">absolute_path</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-identifier">file</span>))
|
1140
|
-
<span class="ruby-ivar">@variables</span>[<span class="ruby-string">'__FILE__'</span>] = <span class="ruby-identifier">file</span>
|
1141
|
-
<span class="ruby-ivar">@variables</span>[<span class="ruby-string">'__LINE__'</span>] = <span class="ruby-identifier">line</span>
|
1142
|
-
<span class="ruby-keyword">break</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">exec_parsed_action</span>(<span class="ruby-identifier">action</span>, <span class="ruby-identifier">args</span>, <span class="ruby-keyword">true</span>, <span class="ruby-identifier">text</span>) <span class="ruby-operator">==</span> <span class="ruby-value">:break</span>
|
1143
|
-
<span class="ruby-keyword">end</span>
|
1144
|
-
|
1145
|
-
<span class="ruby-ivar">@variables</span>[<span class="ruby-string">'__DIR__'</span> ] = <span class="ruby-identifier">current_dir</span>
|
1146
|
-
<span class="ruby-ivar">@variables</span>[<span class="ruby-string">'__FILE__'</span>] = <span class="ruby-identifier">current_file</span>
|
1147
|
-
<span class="ruby-ivar">@variables</span>[<span class="ruby-string">'__LINE__'</span>] = <span class="ruby-identifier">current_line</span>
|
1131
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">exec_file</span>(<span class="ruby-identifier">file</span>)
|
1132
|
+
<span class="ruby-identifier">current_dir</span> = <span class="ruby-ivar">@variables</span>[<span class="ruby-string">'__DIR__'</span> ]
|
1133
|
+
<span class="ruby-identifier">current_file</span> = <span class="ruby-ivar">@variables</span>[<span class="ruby-string">'__FILE__'</span>]
|
1134
|
+
<span class="ruby-identifier">current_line</span> = <span class="ruby-ivar">@variables</span>[<span class="ruby-string">'__LINE__'</span>]
|
1135
|
+
|
1136
|
+
<span class="ruby-ivar">@parser</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">file</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">action</span>, <span class="ruby-identifier">args</span>, <span class="ruby-identifier">text</span>, <span class="ruby-identifier">file</span>, <span class="ruby-identifier">line</span><span class="ruby-operator">|</span>
|
1137
|
+
<span class="ruby-ivar">@variables</span>[<span class="ruby-string">'__DIR__'</span>] = <span class="ruby-constant">File</span>.<span class="ruby-identifier">absolute_path</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-identifier">file</span>))
|
1138
|
+
<span class="ruby-ivar">@variables</span>[<span class="ruby-string">'__FILE__'</span>] = <span class="ruby-identifier">file</span>
|
1139
|
+
<span class="ruby-ivar">@variables</span>[<span class="ruby-string">'__LINE__'</span>] = <span class="ruby-identifier">line</span>
|
1140
|
+
<span class="ruby-keyword">break</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">exec_parsed_action</span>(<span class="ruby-identifier">action</span>, <span class="ruby-identifier">args</span>, <span class="ruby-keyword">true</span>, <span class="ruby-identifier">text</span>) <span class="ruby-operator">==</span> <span class="ruby-value">:break</span>
|
1141
|
+
<span class="ruby-keyword">end</span>
|
1142
|
+
|
1143
|
+
<span class="ruby-ivar">@variables</span>[<span class="ruby-string">'__DIR__'</span> ] = <span class="ruby-identifier">current_dir</span>
|
1144
|
+
<span class="ruby-ivar">@variables</span>[<span class="ruby-string">'__FILE__'</span>] = <span class="ruby-identifier">current_file</span>
|
1145
|
+
<span class="ruby-ivar">@variables</span>[<span class="ruby-string">'__LINE__'</span>] = <span class="ruby-identifier">current_line</span>
|
1148
1146
|
<span class="ruby-keyword">end</span></pre>
|
1149
1147
|
</div>
|
1150
1148
|
|
@@ -1191,25 +1189,25 @@ preferred.</p>
|
|
1191
1189
|
|
1192
1190
|
<div class="method-source-code" id="exec_parsed_action-source">
|
1193
1191
|
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 350</span>
|
1194
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">exec_parsed_action</span>(<span class="ruby-identifier">action</span>, <span class="ruby-identifier">args</span>, <span class="ruby-identifier">log</span> = <span class="ruby-keyword">true</span>, <span class="ruby-identifier">text</span> = <span class="ruby-keyword">nil</span>)
|
1195
|
-
<span class="ruby-identifier">action</span> = <span class="ruby-identifier">get_action</span>(<span class="ruby-identifier">action</span>, <span class="ruby-identifier">args</span>, <span class="ruby-identifier">text</span>)
|
1196
|
-
<span class="ruby-identifier">ret</span> = <span class="ruby-keyword">nil</span>
|
1197
|
-
<span class="ruby-keyword">if</span> <span class="ruby-identifier">log</span>
|
1198
|
-
<span class="ruby-ivar">@logger</span>.<span class="ruby-identifier">log_cmd</span>(<span class="ruby-identifier">action</span>) <span class="ruby-keyword">do</span>
|
1199
|
-
<span class="ruby-constant">Readline</span><span class="ruby-operator">::</span><span class="ruby-constant">HISTORY</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">action</span>.<span class="ruby-identifier">text</span>
|
1200
|
-
<span class="ruby-identifier">ret</span> = <span class="ruby-identifier">exec_action_object</span>(<span class="ruby-identifier">action</span>)
|
1201
|
-
<span class="ruby-keyword">end</span>
|
1202
|
-
<span class="ruby-keyword">else</span>
|
1203
|
-
<span class="ruby-identifier">ret</span> = <span class="ruby-identifier">exec_action_object</span>(<span class="ruby-identifier">action</span>)
|
1204
|
-
<span class="ruby-keyword">end</span>
|
1205
|
-
|
1206
|
-
<span class="ruby-keyword">if</span> <span class="ruby-identifier">ret</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-value">:call</span> <span class="ruby-comment"># delayed actions (after log_cmd)
|
1207
|
-
<span class="ruby-identifier">ret</span>.<span class="ruby-identifier">call</span>
|
1208
|
-
<span class="ruby-keyword">else</span>
|
1209
|
-
<span class="ruby-identifier">ret</span>
|
1210
|
-
<span class="ruby-keyword">end</span>
|
1211
|
-
<span class="ruby-keyword">rescue</span> <span class="ruby-constant">Selenium</span><span class="ruby-operator">::</span><span class="ruby-constant">WebDriver</span><span class="ruby-operator">::</span><span class="ruby-constant">Error</span><span class="ruby-operator">::</span><span class="ruby-constant">UnhandledAlertError</span>
|
1212
|
-
<span class="ruby-identifier">raise</span> <span class="ruby-constant">Bauxite</span><span class="ruby-operator">::</span><span class="ruby-constant">Errors</span><span class="ruby-operator">::</span><span class="ruby-constant">AssertionError</span>, <span class="ruby-string">"Unexpected modal present"</span>
|
1192
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">exec_parsed_action</span>(<span class="ruby-identifier">action</span>, <span class="ruby-identifier">args</span>, <span class="ruby-identifier">log</span> = <span class="ruby-keyword">true</span>, <span class="ruby-identifier">text</span> = <span class="ruby-keyword">nil</span>)
|
1193
|
+
<span class="ruby-identifier">action</span> = <span class="ruby-identifier">get_action</span>(<span class="ruby-identifier">action</span>, <span class="ruby-identifier">args</span>, <span class="ruby-identifier">text</span>)
|
1194
|
+
<span class="ruby-identifier">ret</span> = <span class="ruby-keyword">nil</span>
|
1195
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">log</span>
|
1196
|
+
<span class="ruby-ivar">@logger</span>.<span class="ruby-identifier">log_cmd</span>(<span class="ruby-identifier">action</span>) <span class="ruby-keyword">do</span>
|
1197
|
+
<span class="ruby-constant">Readline</span><span class="ruby-operator">::</span><span class="ruby-constant">HISTORY</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">action</span>.<span class="ruby-identifier">text</span>
|
1198
|
+
<span class="ruby-identifier">ret</span> = <span class="ruby-identifier">exec_action_object</span>(<span class="ruby-identifier">action</span>)
|
1199
|
+
<span class="ruby-keyword">end</span>
|
1200
|
+
<span class="ruby-keyword">else</span>
|
1201
|
+
<span class="ruby-identifier">ret</span> = <span class="ruby-identifier">exec_action_object</span>(<span class="ruby-identifier">action</span>)
|
1202
|
+
<span class="ruby-keyword">end</span>
|
1203
|
+
|
1204
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">ret</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-value">:call</span> <span class="ruby-comment"># delayed actions (after log_cmd)
|
1205
|
+
<span class="ruby-identifier">ret</span>.<span class="ruby-identifier">call</span>
|
1206
|
+
<span class="ruby-keyword">else</span>
|
1207
|
+
<span class="ruby-identifier">ret</span>
|
1208
|
+
<span class="ruby-keyword">end</span>
|
1209
|
+
<span class="ruby-keyword">rescue</span> <span class="ruby-constant">Selenium</span><span class="ruby-operator">::</span><span class="ruby-constant">WebDriver</span><span class="ruby-operator">::</span><span class="ruby-constant">Error</span><span class="ruby-operator">::</span><span class="ruby-constant">UnhandledAlertError</span>
|
1210
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">Bauxite</span><span class="ruby-operator">::</span><span class="ruby-constant">Errors</span><span class="ruby-operator">::</span><span class="ruby-constant">AssertionError</span>, <span class="ruby-string">"Unexpected modal present"</span>
|
1213
1211
|
<span class="ruby-keyword">end</span></pre>
|
1214
1212
|
</div>
|
1215
1213
|
|
@@ -1248,31 +1246,31 @@ preferred.</p>
|
|
1248
1246
|
|
1249
1247
|
<div class="method-source-code" id="get_action-source">
|
1250
1248
|
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 500</span>
|
1251
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">get_action</span>(<span class="ruby-identifier">action</span>, <span class="ruby-identifier">args</span>, <span class="ruby-identifier">text</span> = <span class="ruby-keyword">nil</span>)
|
1252
|
-
<span class="ruby-keyword">while</span> (<span class="ruby-identifier">alias_action</span> = <span class="ruby-ivar">@aliases</span>[<span class="ruby-identifier">action</span>])
|
1253
|
-
<span class="ruby-identifier">action</span> = <span class="ruby-identifier">alias_action</span>[<span class="ruby-value">:action</span>]
|
1254
|
-
<span class="ruby-identifier">args</span> = <span class="ruby-identifier">alias_action</span>[<span class="ruby-value">:args</span>].<span class="ruby-identifier">map</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">a</span><span class="ruby-operator">|</span>
|
1255
|
-
<span class="ruby-identifier">a</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp">/\$\{(\d+)(\*q?)?\}/</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">match</span><span class="ruby-operator">|</span>
|
1256
|
-
<span class="ruby-comment"># expand ${1} to args[0], ${2} to args[1], etc
|
1257
|
-
<span class="ruby-comment"># expand ${4*} to "#{args[4]} #{args[5]} ..."
|
1258
|
-
<span class="ruby-comment"># expand ${4*q} to "\"#{args[4]}\" \"#{args[5]}\" ..."
|
1259
|
-
<span class="ruby-identifier">idx</span> = <span class="ruby-node">$1</span>.<span class="ruby-identifier">to_i</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>
|
1260
|
-
<span class="ruby-keyword">if</span> <span class="ruby-node">$2</span> <span class="ruby-operator">==</span> <span class="ruby-keyword">nil</span>
|
1261
|
-
<span class="ruby-identifier">args</span>[<span class="ruby-identifier">idx</span>] <span class="ruby-operator">||</span> <span class="ruby-string">''</span>
|
1262
|
-
<span class="ruby-keyword">else</span>
|
1263
|
-
<span class="ruby-identifier">range</span> = <span class="ruby-identifier">args</span>[<span class="ruby-identifier">idx</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>]
|
1264
|
-
<span class="ruby-identifier">range</span> = <span class="ruby-identifier">range</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">arg</span><span class="ruby-operator">|</span> <span class="ruby-string">'"'</span><span class="ruby-operator">+</span><span class="ruby-identifier">arg</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-string">'"'</span>, <span class="ruby-string">'""'</span>)<span class="ruby-operator">+</span><span class="ruby-string">'"'</span> } <span class="ruby-keyword">if</span> <span class="ruby-node">$2</span> <span class="ruby-operator">==</span> <span class="ruby-string">'*q'</span>
|
1265
|
-
<span class="ruby-identifier">range</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">' '</span>)
|
1266
|
-
<span class="ruby-keyword">end</span>
|
1267
|
-
<span class="ruby-keyword">end</span>
|
1268
|
-
<span class="ruby-keyword">end</span>
|
1269
|
-
<span class="ruby-keyword">end</span>
|
1270
|
-
|
1271
|
-
<span class="ruby-identifier">text</span> = ([<span class="ruby-identifier">action</span>] <span class="ruby-operator">+</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">a</span><span class="ruby-operator">|</span> <span class="ruby-string">'"'</span><span class="ruby-operator">+</span><span class="ruby-identifier">a</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-string">'"'</span>, <span class="ruby-string">'""'</span>)<span class="ruby-operator">+</span><span class="ruby-string">'"'</span> }).<span class="ruby-identifier">join</span>(<span class="ruby-string">' '</span>) <span class="ruby-keyword">unless</span> <span class="ruby-identifier">text</span>
|
1272
|
-
<span class="ruby-identifier">file</span> = <span class="ruby-ivar">@variables</span>[<span class="ruby-string">'__FILE__'</span>]
|
1273
|
-
<span class="ruby-identifier">line</span> = <span class="ruby-ivar">@variables</span>[<span class="ruby-string">'__LINE__'</span>]
|
1274
|
-
|
1275
|
-
<span class="ruby-constant">Action</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword">self</span>, <span class="ruby-identifier">action</span>, <span class="ruby-identifier">args</span>, <span class="ruby-identifier">text</span>, <span class="ruby-identifier">file</span>, <span class="ruby-identifier">line</span>)
|
1249
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">get_action</span>(<span class="ruby-identifier">action</span>, <span class="ruby-identifier">args</span>, <span class="ruby-identifier">text</span> = <span class="ruby-keyword">nil</span>)
|
1250
|
+
<span class="ruby-keyword">while</span> (<span class="ruby-identifier">alias_action</span> = <span class="ruby-ivar">@aliases</span>[<span class="ruby-identifier">action</span>])
|
1251
|
+
<span class="ruby-identifier">action</span> = <span class="ruby-identifier">alias_action</span>[<span class="ruby-value">:action</span>]
|
1252
|
+
<span class="ruby-identifier">args</span> = <span class="ruby-identifier">alias_action</span>[<span class="ruby-value">:args</span>].<span class="ruby-identifier">map</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">a</span><span class="ruby-operator">|</span>
|
1253
|
+
<span class="ruby-identifier">a</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp">/\$\{(\d+)(\*q?)?\}/</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">match</span><span class="ruby-operator">|</span>
|
1254
|
+
<span class="ruby-comment"># expand ${1} to args[0], ${2} to args[1], etc.
|
1255
|
+
<span class="ruby-comment"># expand ${4*} to "#{args[4]} #{args[5]} ..."
|
1256
|
+
<span class="ruby-comment"># expand ${4*q} to "\"#{args[4]}\" \"#{args[5]}\" ..."
|
1257
|
+
<span class="ruby-identifier">idx</span> = <span class="ruby-node">$1</span>.<span class="ruby-identifier">to_i</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>
|
1258
|
+
<span class="ruby-keyword">if</span> <span class="ruby-node">$2</span> <span class="ruby-operator">==</span> <span class="ruby-keyword">nil</span>
|
1259
|
+
<span class="ruby-identifier">args</span>[<span class="ruby-identifier">idx</span>] <span class="ruby-operator">||</span> <span class="ruby-string">''</span>
|
1260
|
+
<span class="ruby-keyword">else</span>
|
1261
|
+
<span class="ruby-identifier">range</span> = <span class="ruby-identifier">args</span>[<span class="ruby-identifier">idx</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>]
|
1262
|
+
<span class="ruby-identifier">range</span> = <span class="ruby-identifier">range</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">arg</span><span class="ruby-operator">|</span> <span class="ruby-string">'"'</span><span class="ruby-operator">+</span><span class="ruby-identifier">arg</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-string">'"'</span>, <span class="ruby-string">'""'</span>)<span class="ruby-operator">+</span><span class="ruby-string">'"'</span> } <span class="ruby-keyword">if</span> <span class="ruby-node">$2</span> <span class="ruby-operator">==</span> <span class="ruby-string">'*q'</span>
|
1263
|
+
<span class="ruby-identifier">range</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">' '</span>)
|
1264
|
+
<span class="ruby-keyword">end</span>
|
1265
|
+
<span class="ruby-keyword">end</span>
|
1266
|
+
<span class="ruby-keyword">end</span>
|
1267
|
+
<span class="ruby-keyword">end</span>
|
1268
|
+
|
1269
|
+
<span class="ruby-identifier">text</span> = ([<span class="ruby-identifier">action</span>] <span class="ruby-operator">+</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">a</span><span class="ruby-operator">|</span> <span class="ruby-string">'"'</span><span class="ruby-operator">+</span><span class="ruby-identifier">a</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-string">'"'</span>, <span class="ruby-string">'""'</span>)<span class="ruby-operator">+</span><span class="ruby-string">'"'</span> }).<span class="ruby-identifier">join</span>(<span class="ruby-string">' '</span>) <span class="ruby-keyword">unless</span> <span class="ruby-identifier">text</span>
|
1270
|
+
<span class="ruby-identifier">file</span> = <span class="ruby-ivar">@variables</span>[<span class="ruby-string">'__FILE__'</span>]
|
1271
|
+
<span class="ruby-identifier">line</span> = <span class="ruby-ivar">@variables</span>[<span class="ruby-string">'__LINE__'</span>]
|
1272
|
+
|
1273
|
+
<span class="ruby-constant">Action</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword">self</span>, <span class="ruby-identifier">action</span>, <span class="ruby-identifier">args</span>, <span class="ruby-identifier">text</span>, <span class="ruby-identifier">file</span>, <span class="ruby-identifier">line</span>)
|
1276
1274
|
<span class="ruby-keyword">end</span></pre>
|
1277
1275
|
</div>
|
1278
1276
|
|
@@ -1297,7 +1295,7 @@ preferred.</p>
|
|
1297
1295
|
|
1298
1296
|
<div class="method-description">
|
1299
1297
|
|
1300
|
-
<p>Returns the output path for <code>path</code> accounting for the
|
1298
|
+
<p>Returns the output path for <code>path</code> accounting for the
|
1301
1299
|
<code>__OUTPUT__</code> variable.</p>
|
1302
1300
|
|
1303
1301
|
<p>For example:</p>
|
@@ -1316,15 +1314,15 @@ preferred.</p>
|
|
1316
1314
|
|
1317
1315
|
<div class="method-source-code" id="output_path-source">
|
1318
1316
|
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 585</span>
|
1319
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">output_path</span>(<span class="ruby-identifier">path</span>)
|
1320
|
-
<span class="ruby-keyword">unless</span> <span class="ruby-constant">Pathname</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">path</span>).<span class="ruby-identifier">absolute?</span>
|
1321
|
-
<span class="ruby-identifier">output</span> = <span class="ruby-ivar">@variables</span>[<span class="ruby-string">'__OUTPUT__'</span>]
|
1322
|
-
<span class="ruby-keyword">if</span> <span class="ruby-identifier">output</span>
|
1323
|
-
<span class="ruby-constant">Dir</span>.<span class="ruby-identifier">mkdir</span> <span class="ruby-identifier">output</span> <span class="ruby-keyword">unless</span> <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">exists?</span> <span class="ruby-identifier">output</span>
|
1324
|
-
<span class="ruby-identifier">path</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">output</span>, <span class="ruby-identifier">path</span>)
|
1325
|
-
<span class="ruby-keyword">end</span>
|
1326
|
-
<span class="ruby-keyword">end</span>
|
1327
|
-
<span class="ruby-identifier">path</span>
|
1317
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">output_path</span>(<span class="ruby-identifier">path</span>)
|
1318
|
+
<span class="ruby-keyword">unless</span> <span class="ruby-constant">Pathname</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">path</span>).<span class="ruby-identifier">absolute?</span>
|
1319
|
+
<span class="ruby-identifier">output</span> = <span class="ruby-ivar">@variables</span>[<span class="ruby-string">'__OUTPUT__'</span>]
|
1320
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">output</span>
|
1321
|
+
<span class="ruby-constant">Dir</span>.<span class="ruby-identifier">mkdir</span> <span class="ruby-identifier">output</span> <span class="ruby-keyword">unless</span> <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">exists?</span> <span class="ruby-identifier">output</span>
|
1322
|
+
<span class="ruby-identifier">path</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">output</span>, <span class="ruby-identifier">path</span>)
|
1323
|
+
<span class="ruby-keyword">end</span>
|
1324
|
+
<span class="ruby-keyword">end</span>
|
1325
|
+
<span class="ruby-identifier">path</span>
|
1328
1326
|
<span class="ruby-keyword">end</span></pre>
|
1329
1327
|
</div>
|
1330
1328
|
|
@@ -1349,7 +1347,7 @@ preferred.</p>
|
|
1349
1347
|
|
1350
1348
|
<div class="method-description">
|
1351
1349
|
|
1352
|
-
<p>Prints the specified <code>error</code> using the Logger configured and
|
1350
|
+
<p>Prints the specified <code>error</code> using the Logger configured and
|
1353
1351
|
handling the verbose option.</p>
|
1354
1352
|
|
1355
1353
|
<p>For example:</p>
|
@@ -1367,22 +1365,22 @@ handling the verbose option.</p>
|
|
1367
1365
|
|
1368
1366
|
<div class="method-source-code" id="print_error-source">
|
1369
1367
|
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 555</span>
|
1370
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">print_error</span>(<span class="ruby-identifier">e</span>, <span class="ruby-identifier">capture</span> = <span class="ruby-keyword">true</span>)
|
1371
|
-
<span class="ruby-keyword">if</span> <span class="ruby-ivar">@logger</span>
|
1372
|
-
<span class="ruby-ivar">@logger</span>.<span class="ruby-identifier">log</span> <span class="ruby-node">"#{e.message}\n"</span>, <span class="ruby-value">:error</span>
|
1373
|
-
<span class="ruby-keyword">else</span>
|
1374
|
-
<span class="ruby-identifier">puts</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">message</span>
|
1375
|
-
<span class="ruby-keyword">end</span>
|
1376
|
-
<span class="ruby-keyword">if</span> <span class="ruby-ivar">@options</span>[<span class="ruby-value">:verbose</span>]
|
1377
|
-
<span class="ruby-identifier">p</span> <span class="ruby-identifier">e</span>
|
1378
|
-
<span class="ruby-identifier">puts</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">backtrace</span>
|
1379
|
-
<span class="ruby-keyword">end</span>
|
1380
|
-
<span class="ruby-keyword">if</span> <span class="ruby-identifier">capture</span> <span class="ruby-keyword">and</span> <span class="ruby-ivar">@options</span>[<span class="ruby-value">:capture</span>]
|
1381
|
-
<span class="ruby-identifier">with_vars</span>(<span class="ruby-identifier">e</span>.<span class="ruby-identifier">variables</span>) <span class="ruby-keyword">do</span>
|
1382
|
-
<span class="ruby-identifier">exec_parsed_action</span>(<span class="ruby-string">'capture'</span>, [] , <span class="ruby-keyword">false</span>)
|
1383
|
-
<span class="ruby-identifier">e</span>.<span class="ruby-identifier">variables</span>[<span class="ruby-string">'__CAPTURE__'</span>] = <span class="ruby-ivar">@variables</span>[<span class="ruby-string">'__CAPTURE__'</span>]
|
1384
|
-
<span class="ruby-keyword">end</span>
|
1385
|
-
<span class="ruby-keyword">end</span>
|
1368
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">print_error</span>(<span class="ruby-identifier">e</span>, <span class="ruby-identifier">capture</span> = <span class="ruby-keyword">true</span>)
|
1369
|
+
<span class="ruby-keyword">if</span> <span class="ruby-ivar">@logger</span>
|
1370
|
+
<span class="ruby-ivar">@logger</span>.<span class="ruby-identifier">log</span> <span class="ruby-node">"#{e.message}\n"</span>, <span class="ruby-value">:error</span>
|
1371
|
+
<span class="ruby-keyword">else</span>
|
1372
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">message</span>
|
1373
|
+
<span class="ruby-keyword">end</span>
|
1374
|
+
<span class="ruby-keyword">if</span> <span class="ruby-ivar">@options</span>[<span class="ruby-value">:verbose</span>]
|
1375
|
+
<span class="ruby-identifier">p</span> <span class="ruby-identifier">e</span>
|
1376
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">backtrace</span>
|
1377
|
+
<span class="ruby-keyword">end</span>
|
1378
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">capture</span> <span class="ruby-keyword">and</span> <span class="ruby-ivar">@options</span>[<span class="ruby-value">:capture</span>]
|
1379
|
+
<span class="ruby-identifier">with_vars</span>(<span class="ruby-identifier">e</span>.<span class="ruby-identifier">variables</span>) <span class="ruby-keyword">do</span>
|
1380
|
+
<span class="ruby-identifier">exec_parsed_action</span>(<span class="ruby-string">'capture'</span>, [] , <span class="ruby-keyword">false</span>)
|
1381
|
+
<span class="ruby-identifier">e</span>.<span class="ruby-identifier">variables</span>[<span class="ruby-string">'__CAPTURE__'</span>] = <span class="ruby-ivar">@variables</span>[<span class="ruby-string">'__CAPTURE__'</span>]
|
1382
|
+
<span class="ruby-keyword">end</span>
|
1383
|
+
<span class="ruby-keyword">end</span>
|
1386
1384
|
<span class="ruby-keyword">end</span></pre>
|
1387
1385
|
</div>
|
1388
1386
|
|
@@ -1427,13 +1425,13 @@ available <a href="Selector.html">Selector</a> strategies).</p>
|
|
1427
1425
|
|
1428
1426
|
<div class="method-source-code" id="with_driver_timeout-source">
|
1429
1427
|
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 410</span>
|
1430
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">with_driver_timeout</span>(<span class="ruby-identifier">timeout</span>)
|
1431
|
-
<span class="ruby-identifier">current</span> = <span class="ruby-ivar">@driver_timeout</span>
|
1432
|
-
<span class="ruby-identifier">driver</span>.<span class="ruby-identifier">manage</span>.<span class="ruby-identifier">timeouts</span>.<span class="ruby-identifier">implicit_wait</span> = <span class="ruby-identifier">timeout</span>
|
1433
|
-
<span class="ruby-keyword">yield</span>
|
1434
|
-
<span class="ruby-keyword">ensure</span>
|
1435
|
-
<span class="ruby-ivar">@driver_timeout</span> = <span class="ruby-identifier">current</span>
|
1436
|
-
<span class="ruby-identifier">driver</span>.<span class="ruby-identifier">manage</span>.<span class="ruby-identifier">timeouts</span>.<span class="ruby-identifier">implicit_wait</span> = <span class="ruby-identifier">current</span>
|
1428
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">with_driver_timeout</span>(<span class="ruby-identifier">timeout</span>)
|
1429
|
+
<span class="ruby-identifier">current</span> = <span class="ruby-ivar">@driver_timeout</span>
|
1430
|
+
<span class="ruby-identifier">driver</span>.<span class="ruby-identifier">manage</span>.<span class="ruby-identifier">timeouts</span>.<span class="ruby-identifier">implicit_wait</span> = <span class="ruby-identifier">timeout</span>
|
1431
|
+
<span class="ruby-keyword">yield</span>
|
1432
|
+
<span class="ruby-keyword">ensure</span>
|
1433
|
+
<span class="ruby-ivar">@driver_timeout</span> = <span class="ruby-identifier">current</span>
|
1434
|
+
<span class="ruby-identifier">driver</span>.<span class="ruby-identifier">manage</span>.<span class="ruby-identifier">timeouts</span>.<span class="ruby-identifier">implicit_wait</span> = <span class="ruby-identifier">current</span>
|
1437
1435
|
<span class="ruby-keyword">end</span></pre>
|
1438
1436
|
</div>
|
1439
1437
|
|
@@ -1476,19 +1474,19 @@ to execute the block itself.</p>
|
|
1476
1474
|
|
1477
1475
|
<div class="method-source-code" id="with_timeout-source">
|
1478
1476
|
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 382</span>
|
1479
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">with_timeout</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">error_types</span>)
|
1480
|
-
<span class="ruby-identifier">stime</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>
|
1481
|
-
<span class="ruby-identifier">timeout</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">stime</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@variables</span>[<span class="ruby-string">'__TIMEOUT__'</span>]
|
1482
|
-
<span class="ruby-keyword">yield</span>
|
1483
|
-
<span class="ruby-keyword">rescue</span> <span class="ruby-operator">*</span><span class="ruby-identifier">error_types</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
|
1484
|
-
<span class="ruby-identifier">t</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>
|
1485
|
-
<span class="ruby-identifier">rem</span> = <span class="ruby-identifier">timeout</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">t</span>
|
1486
|
-
<span class="ruby-identifier">raise</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">rem</span> <span class="ruby-operator"><</span> <span class="ruby-value">0</span>
|
1487
|
-
|
1488
|
-
<span class="ruby-ivar">@logger</span>.<span class="ruby-identifier">progress</span>(<span class="ruby-identifier">rem</span>.<span class="ruby-identifier">round</span>)
|
1489
|
-
|
1490
|
-
<span class="ruby-identifier">sleep</span>(<span class="ruby-value">1.0</span><span class="ruby-operator">/</span><span class="ruby-value">10.0</span>) <span class="ruby-keyword">if</span> (<span class="ruby-identifier">t</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">stime</span>).<span class="ruby-identifier">to_i</span> <span class="ruby-operator"><</span> <span class="ruby-value">1</span>
|
1491
|
-
<span class="ruby-keyword">retry</span>
|
1477
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">with_timeout</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">error_types</span>)
|
1478
|
+
<span class="ruby-identifier">stime</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>
|
1479
|
+
<span class="ruby-identifier">timeout</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">stime</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@variables</span>[<span class="ruby-string">'__TIMEOUT__'</span>].<span class="ruby-identifier">to_i</span>
|
1480
|
+
<span class="ruby-keyword">yield</span>
|
1481
|
+
<span class="ruby-keyword">rescue</span> <span class="ruby-operator">*</span><span class="ruby-identifier">error_types</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
|
1482
|
+
<span class="ruby-identifier">t</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>
|
1483
|
+
<span class="ruby-identifier">rem</span> = <span class="ruby-identifier">timeout</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">t</span>
|
1484
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">rem</span> <span class="ruby-operator"><</span> <span class="ruby-value">0</span>
|
1485
|
+
|
1486
|
+
<span class="ruby-ivar">@logger</span>.<span class="ruby-identifier">progress</span>(<span class="ruby-identifier">rem</span>.<span class="ruby-identifier">round</span>)
|
1487
|
+
|
1488
|
+
<span class="ruby-identifier">sleep</span>(<span class="ruby-value">1.0</span><span class="ruby-operator">/</span><span class="ruby-value">10.0</span>) <span class="ruby-keyword">if</span> (<span class="ruby-identifier">t</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">stime</span>).<span class="ruby-identifier">to_i</span> <span class="ruby-operator"><</span> <span class="ruby-value">1</span>
|
1489
|
+
<span class="ruby-keyword">retry</span>
|
1492
1490
|
<span class="ruby-keyword">end</span></pre>
|
1493
1491
|
</div>
|
1494
1492
|
|
@@ -1557,9 +1555,9 @@ to execute the block itself.</p>
|
|
1557
1555
|
|
1558
1556
|
<div class="method-source-code" id="action_args-source">
|
1559
1557
|
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 616</span>
|
1560
|
-
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">action_args</span>(<span class="ruby-identifier">action</span>)
|
1561
|
-
<span class="ruby-identifier">action</span> <span class="ruby-operator">+=</span> <span class="ruby-string">'_action'</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">_action_methods</span>.<span class="ruby-identifier">include?</span> <span class="ruby-identifier">action</span>
|
1562
|
-
<span class="ruby-constant">Action</span>.<span class="ruby-identifier">public_instance_method</span>(<span class="ruby-identifier">action</span>).<span class="ruby-identifier">parameters</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">att</span>, <span class="ruby-identifier">name</span><span class="ruby-operator">|</span> <span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_s</span> }
|
1558
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">action_args</span>(<span class="ruby-identifier">action</span>)
|
1559
|
+
<span class="ruby-identifier">action</span> <span class="ruby-operator">+=</span> <span class="ruby-string">'_action'</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">_action_methods</span>.<span class="ruby-identifier">include?</span> <span class="ruby-identifier">action</span>
|
1560
|
+
<span class="ruby-constant">Action</span>.<span class="ruby-identifier">public_instance_method</span>(<span class="ruby-identifier">action</span>).<span class="ruby-identifier">parameters</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">att</span>, <span class="ruby-identifier">name</span><span class="ruby-operator">|</span> <span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_s</span> }
|
1563
1561
|
<span class="ruby-keyword">end</span></pre>
|
1564
1562
|
</div>
|
1565
1563
|
|
@@ -1597,8 +1595,8 @@ to execute the block itself.</p>
|
|
1597
1595
|
|
1598
1596
|
<div class="method-source-code" id="actions-source">
|
1599
1597
|
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 606</span>
|
1600
|
-
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">actions</span>
|
1601
|
-
<span class="ruby-identifier">_action_methods</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">m</span><span class="ruby-operator">|</span> <span class="ruby-identifier">m</span>.<span class="ruby-identifier">sub</span>(<span class="ruby-regexp">/_action$/</span>, <span class="ruby-string">''</span>) }
|
1598
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">actions</span>
|
1599
|
+
<span class="ruby-identifier">_action_methods</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">m</span><span class="ruby-operator">|</span> <span class="ruby-identifier">m</span>.<span class="ruby-identifier">sub</span>(<span class="ruby-regexp">/_action$/</span>, <span class="ruby-string">''</span>) }
|
1602
1600
|
<span class="ruby-keyword">end</span></pre>
|
1603
1601
|
</div>
|
1604
1602
|
|
@@ -1636,8 +1634,8 @@ to execute the block itself.</p>
|
|
1636
1634
|
|
1637
1635
|
<div class="method-source-code" id="loggers-source">
|
1638
1636
|
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 645</span>
|
1639
|
-
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">loggers</span>
|
1640
|
-
<span class="ruby-constant">Loggers</span>.<span class="ruby-identifier">constants</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">l</span><span class="ruby-operator">|</span> <span class="ruby-identifier">l</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">downcase</span>.<span class="ruby-identifier">sub</span>(<span class="ruby-regexp">/logger$/</span>, <span class="ruby-string">''</span>) }
|
1637
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">loggers</span>
|
1638
|
+
<span class="ruby-constant">Loggers</span>.<span class="ruby-identifier">constants</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">l</span><span class="ruby-operator">|</span> <span class="ruby-identifier">l</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">downcase</span>.<span class="ruby-identifier">sub</span>(<span class="ruby-regexp">/logger$/</span>, <span class="ruby-string">''</span>) }
|
1641
1639
|
<span class="ruby-keyword">end</span></pre>
|
1642
1640
|
</div>
|
1643
1641
|
|
@@ -1678,8 +1676,8 @@ to execute the block itself.</p>
|
|
1678
1676
|
|
1679
1677
|
<div class="method-source-code" id="max_action_name_size-source">
|
1680
1678
|
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 669</span>
|
1681
|
-
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">max_action_name_size</span>
|
1682
|
-
<span class="ruby-identifier">actions</span>.<span class="ruby-identifier">inject</span>(<span class="ruby-value">0</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">s</span>,<span class="ruby-identifier">a</span><span class="ruby-operator">|</span> <span class="ruby-identifier">a</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">></span> <span class="ruby-identifier">s</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">a</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">s</span> }
|
1679
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">max_action_name_size</span>
|
1680
|
+
<span class="ruby-identifier">actions</span>.<span class="ruby-identifier">inject</span>(<span class="ruby-value">0</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">s</span>,<span class="ruby-identifier">a</span><span class="ruby-operator">|</span> <span class="ruby-identifier">a</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">></span> <span class="ruby-identifier">s</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">a</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">s</span> }
|
1683
1681
|
<span class="ruby-keyword">end</span></pre>
|
1684
1682
|
</div>
|
1685
1683
|
|
@@ -1717,9 +1715,10 @@ to execute the block itself.</p>
|
|
1717
1715
|
|
1718
1716
|
<div class="method-source-code" id="parsers-source">
|
1719
1717
|
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 655</span>
|
1720
|
-
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">parsers</span>
|
1721
|
-
(<span class="ruby-constant">Parser</span>.<span class="ruby-identifier">public_instance_methods</span>(<span class="ruby-keyword">false</span>)
|
1722
|
-
|
1718
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">parsers</span>
|
1719
|
+
(<span class="ruby-constant">Parser</span>.<span class="ruby-identifier">public_instance_methods</span>(<span class="ruby-keyword">false</span>) \
|
1720
|
+
<span class="ruby-operator">-</span> <span class="ruby-constant">ParserModule</span>.<span class="ruby-identifier">public_instance_methods</span>(<span class="ruby-keyword">false</span>))
|
1721
|
+
.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">p</span><span class="ruby-operator">|</span> <span class="ruby-identifier">p</span>.<span class="ruby-identifier">to_s</span> }
|
1723
1722
|
<span class="ruby-keyword">end</span></pre>
|
1724
1723
|
</div>
|
1725
1724
|
|
@@ -1748,7 +1747,7 @@ to execute the block itself.</p>
|
|
1748
1747
|
|
1749
1748
|
<p>If <code>include_standard_selectors</code> is <code>true</code> (default
|
1750
1749
|
behavior) both standard and custom selector are returned, otherwise only
|
1751
|
-
custom
|
1750
|
+
custom selectors are returned.</p>
|
1752
1751
|
|
1753
1752
|
<p>For example:</p>
|
1754
1753
|
|
@@ -1761,12 +1760,12 @@ custom selectors are returned.</p>
|
|
1761
1760
|
|
1762
1761
|
<div class="method-source-code" id="selectors-source">
|
1763
1762
|
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 631</span>
|
1764
|
-
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">selectors</span>(<span class="ruby-identifier">include_standard_selectors</span> = <span class="ruby-keyword">true</span>)
|
1765
|
-
<span class="ruby-identifier">ret</span> = <span class="ruby-constant">Selector</span>.<span class="ruby-identifier">public_instance_methods</span>(<span class="ruby-keyword">false</span>).<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">a</span><span class="ruby-operator">|</span> <span class="ruby-identifier">a</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">sub</span>(<span class="ruby-regexp">/_selector$/</span>, <span class="ruby-string">''</span>) }
|
1766
|
-
<span class="ruby-keyword">if</span> <span class="ruby-identifier">include_standard_selectors</span>
|
1767
|
-
<span class="ruby-identifier">ret</span> <span class="ruby-operator">+=</span> <span class="ruby-constant">Selenium</span><span class="ruby-operator">::</span><span class="ruby-constant">WebDriver</span><span class="ruby-operator">::</span><span class="ruby-constant">SearchContext</span><span class="ruby-operator">::</span><span class="ruby-constant">FINDERS</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">k</span>.<span class="ruby-identifier">to_s</span> }
|
1768
|
-
<span class="ruby-keyword">end</span>
|
1769
|
-
<span class="ruby-identifier">ret</span>
|
1763
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">selectors</span>(<span class="ruby-identifier">include_standard_selectors</span> = <span class="ruby-keyword">true</span>)
|
1764
|
+
<span class="ruby-identifier">ret</span> = <span class="ruby-constant">Selector</span>.<span class="ruby-identifier">public_instance_methods</span>(<span class="ruby-keyword">false</span>).<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">a</span><span class="ruby-operator">|</span> <span class="ruby-identifier">a</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">sub</span>(<span class="ruby-regexp">/_selector$/</span>, <span class="ruby-string">''</span>) }
|
1765
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">include_standard_selectors</span>
|
1766
|
+
<span class="ruby-identifier">ret</span> <span class="ruby-operator">+=</span> <span class="ruby-constant">Selenium</span><span class="ruby-operator">::</span><span class="ruby-constant">WebDriver</span><span class="ruby-operator">::</span><span class="ruby-constant">SearchContext</span><span class="ruby-operator">::</span><span class="ruby-constant">FINDERS</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">k</span>.<span class="ruby-identifier">to_s</span> }
|
1767
|
+
<span class="ruby-keyword">end</span>
|
1768
|
+
<span class="ruby-identifier">ret</span>
|
1770
1769
|
<span class="ruby-keyword">end</span></pre>
|
1771
1770
|
</div>
|
1772
1771
|
|
@@ -1827,7 +1826,8 @@ with the corresponding variable value.</p>
|
|
1827
1826
|
|
1828
1827
|
<p>The variable expansion expression format is:</p>
|
1829
1828
|
|
1830
|
-
<pre>'${variable_name}'</
|
1829
|
+
<pre class="ruby"><span class="ruby-string">'${variable_name}'</span>
|
1830
|
+
</pre>
|
1831
1831
|
|
1832
1832
|
<p>For example:</p>
|
1833
1833
|
|
@@ -1843,12 +1843,12 @@ with the corresponding variable value.</p>
|
|
1843
1843
|
|
1844
1844
|
<div class="method-source-code" id="expand-source">
|
1845
1845
|
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 690</span>
|
1846
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">expand</span>(<span class="ruby-identifier">s</span>)
|
1847
|
-
<span class="ruby-identifier">result</span> = <span class="ruby-ivar">@variables</span>.<span class="ruby-identifier">inject</span>(<span class="ruby-identifier">s</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">s</span>,<span class="ruby-identifier">kv</span><span class="ruby-operator">|</span>
|
1848
|
-
<span class="ruby-identifier">s</span> = <span class="ruby-identifier">s</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-node">/\$\{#{kv[0]}\}/</span>, <span class="ruby-identifier">kv</span>[<span class="ruby-value">1</span>].<span class="ruby-identifier">to_s</span>)
|
1849
|
-
<span class="ruby-keyword">end</span>
|
1850
|
-
<span class="ruby-identifier">result</span> = <span class="ruby-identifier">expand</span>(<span class="ruby-identifier">result</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">result</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">s</span>
|
1851
|
-
<span class="ruby-identifier">result</span>
|
1846
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">expand</span>(<span class="ruby-identifier">s</span>)
|
1847
|
+
<span class="ruby-identifier">result</span> = <span class="ruby-ivar">@variables</span>.<span class="ruby-identifier">inject</span>(<span class="ruby-identifier">s</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">s</span>,<span class="ruby-identifier">kv</span><span class="ruby-operator">|</span>
|
1848
|
+
<span class="ruby-identifier">s</span> = <span class="ruby-identifier">s</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-node">/\$\{#{kv[0]}\}/</span>, <span class="ruby-identifier">kv</span>[<span class="ruby-value">1</span>].<span class="ruby-identifier">to_s</span>)
|
1849
|
+
<span class="ruby-keyword">end</span>
|
1850
|
+
<span class="ruby-identifier">result</span> = <span class="ruby-identifier">expand</span>(<span class="ruby-identifier">result</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">result</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">s</span>
|
1851
|
+
<span class="ruby-identifier">result</span>
|
1852
1852
|
<span class="ruby-keyword">end</span></pre>
|
1853
1853
|
</div>
|
1854
1854
|
|
@@ -1896,30 +1896,30 @@ variables is restored.</p>
|
|
1896
1896
|
|
1897
1897
|
<div class="method-source-code" id="with_vars-source">
|
1898
1898
|
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 713</span>
|
1899
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">with_vars</span>(<span class="ruby-identifier">vars</span>)
|
1900
|
-
<span class="ruby-identifier">current</span> = <span class="ruby-ivar">@variables</span>
|
1901
|
-
<span class="ruby-ivar">@variables</span> = <span class="ruby-ivar">@variables</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">vars</span>)
|
1902
|
-
<span class="ruby-identifier">ret_vars</span> = <span class="ruby-keyword">nil</span>
|
1903
|
-
|
1904
|
-
<span class="ruby-identifier">ret</span> = <span class="ruby-keyword">yield</span>
|
1905
|
-
|
1906
|
-
<span class="ruby-identifier">returned</span> = <span class="ruby-ivar">@variables</span>[<span class="ruby-string">'__RETURN__'</span>]
|
1907
|
-
<span class="ruby-keyword">if</span> <span class="ruby-identifier">returned</span> <span class="ruby-operator">==</span> [<span class="ruby-string">'*'</span>]
|
1908
|
-
<span class="ruby-identifier">ret_vars</span> = <span class="ruby-ivar">@variables</span>.<span class="ruby-identifier">clone</span>
|
1909
|
-
<span class="ruby-identifier">ret_vars</span>.<span class="ruby-identifier">delete</span> <span class="ruby-string">'__RETURN__'</span>
|
1910
|
-
<span class="ruby-keyword">elsif</span> <span class="ruby-identifier">returned</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword">nil</span>
|
1911
|
-
<span class="ruby-identifier">ret_vars</span> = <span class="ruby-ivar">@variables</span>.<span class="ruby-identifier">select</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">returned</span>.<span class="ruby-identifier">include?</span> <span class="ruby-identifier">k</span> }
|
1912
|
-
<span class="ruby-keyword">end</span>
|
1913
|
-
<span class="ruby-keyword">rescue</span> <span class="ruby-constant">StandardError</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
|
1914
|
-
<span class="ruby-identifier">e</span>.<span class="ruby-identifier">instance_variable_set</span> <span class="ruby-string">"@variables"</span>, <span class="ruby-ivar">@variables</span>
|
1915
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">variables</span>
|
1916
|
-
<span class="ruby-ivar">@variables</span>
|
1917
|
-
<span class="ruby-keyword">end</span>
|
1918
|
-
<span class="ruby-identifier">raise</span>
|
1919
|
-
<span class="ruby-keyword">ensure</span>
|
1920
|
-
<span class="ruby-ivar">@variables</span> = <span class="ruby-identifier">current</span>
|
1921
|
-
<span class="ruby-ivar">@variables</span>.<span class="ruby-identifier">merge!</span>(<span class="ruby-identifier">ret_vars</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">ret_vars</span>
|
1922
|
-
<span class="ruby-identifier">ret</span>
|
1899
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">with_vars</span>(<span class="ruby-identifier">vars</span>)
|
1900
|
+
<span class="ruby-identifier">current</span> = <span class="ruby-ivar">@variables</span>
|
1901
|
+
<span class="ruby-ivar">@variables</span> = <span class="ruby-ivar">@variables</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">vars</span>)
|
1902
|
+
<span class="ruby-identifier">ret_vars</span> = <span class="ruby-keyword">nil</span>
|
1903
|
+
|
1904
|
+
<span class="ruby-identifier">ret</span> = <span class="ruby-keyword">yield</span>
|
1905
|
+
|
1906
|
+
<span class="ruby-identifier">returned</span> = <span class="ruby-ivar">@variables</span>[<span class="ruby-string">'__RETURN__'</span>]
|
1907
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">returned</span> <span class="ruby-operator">==</span> [<span class="ruby-string">'*'</span>]
|
1908
|
+
<span class="ruby-identifier">ret_vars</span> = <span class="ruby-ivar">@variables</span>.<span class="ruby-identifier">clone</span>
|
1909
|
+
<span class="ruby-identifier">ret_vars</span>.<span class="ruby-identifier">delete</span> <span class="ruby-string">'__RETURN__'</span>
|
1910
|
+
<span class="ruby-keyword">elsif</span> <span class="ruby-identifier">returned</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword">nil</span>
|
1911
|
+
<span class="ruby-identifier">ret_vars</span> = <span class="ruby-ivar">@variables</span>.<span class="ruby-identifier">select</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">returned</span>.<span class="ruby-identifier">include?</span> <span class="ruby-identifier">k</span> }
|
1912
|
+
<span class="ruby-keyword">end</span>
|
1913
|
+
<span class="ruby-keyword">rescue</span> <span class="ruby-constant">StandardError</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
|
1914
|
+
<span class="ruby-identifier">e</span>.<span class="ruby-identifier">instance_variable_set</span> <span class="ruby-string">"@variables"</span>, <span class="ruby-ivar">@variables</span>
|
1915
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">variables</span>
|
1916
|
+
<span class="ruby-ivar">@variables</span>
|
1917
|
+
<span class="ruby-keyword">end</span>
|
1918
|
+
<span class="ruby-identifier">raise</span>
|
1919
|
+
<span class="ruby-keyword">ensure</span>
|
1920
|
+
<span class="ruby-ivar">@variables</span> = <span class="ruby-identifier">current</span>
|
1921
|
+
<span class="ruby-ivar">@variables</span>.<span class="ruby-identifier">merge!</span>(<span class="ruby-identifier">ret_vars</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">ret_vars</span>
|
1922
|
+
<span class="ruby-identifier">ret</span>
|
1923
1923
|
<span class="ruby-keyword">end</span></pre>
|
1924
1924
|
</div>
|
1925
1925
|
|
@@ -1939,7 +1939,7 @@ variables is restored.</p>
|
|
1939
1939
|
|
1940
1940
|
<footer id="validator-badges" role="contentinfo">
|
1941
1941
|
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
1942
|
-
<p>Generated by <a href="http://
|
1943
|
-
<p>Based on <a href="http://deveiate.org/projects/Darkfish-
|
1942
|
+
<p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.0.
|
1943
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
1944
1944
|
</footer>
|
1945
1945
|
|