bauxite 0.6.5 → 0.6.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -5
- data/doc/Bauxite/Action.html +6 -12
- data/doc/Bauxite/Application.html +32 -0
- data/doc/Bauxite/Context.html +95 -30
- data/doc/Bauxite/Loggers/CompositeLogger.html +21 -15
- data/doc/Bauxite/Loggers/FileLogger.html +45 -4
- data/doc/Bauxite/Loggers/HtmlLogger.html +23 -15
- data/doc/Bauxite/Loggers/XtermLogger.html +14 -4
- data/doc/README_md.html +13 -10
- data/doc/created.rid +10 -10
- data/doc/index.html +13 -10
- data/doc/js/search_index.js +1 -1
- data/doc/table_of_contents.html +62 -52
- data/lib/bauxite/actions/capture.rb +5 -13
- data/lib/bauxite/application.rb +62 -11
- data/lib/bauxite/core/context.rb +37 -2
- data/lib/bauxite/loggers/composite.rb +11 -7
- data/lib/bauxite/loggers/file.rb +11 -2
- data/lib/bauxite/loggers/html.rb +23 -11
- data/lib/bauxite/loggers/xterm.rb +8 -0
- data/lib/bauxite.rb +1 -1
- data/test/asserth.bxt +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 90ce48c06f99606d8c8a5c73b576e222dc1dcab3
|
4
|
+
data.tar.gz: f0c003f941b4606eb917a18254e5c12ac5de6d54
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 896b21ed882309deb9cffa5d6efe34071916a0e5574fe7c6dcdda4ed4608b932420829c09d2fee2742c4d6b7d012ad62963fc4e67c8fbfe32b7eb4bcb01a04c4
|
7
|
+
data.tar.gz: 1ce615dc1d7b1d2c3112da20220c58f0f26d9f342f1dc5092c1deffde8bec9c49e4c5e64badfccc263fcf1a8906f81c5064c3d3c921ffb1ec86d338b79f251fa
|
data/README.md
CHANGED
@@ -262,8 +262,7 @@ If you want to run Bauxite tests in your [Jenkins CI](http://jenkins-ci.org/) se
|
|
262
262
|
|
263
263
|
#!/bin/bash
|
264
264
|
source ~/.rvm/scripts/rvm
|
265
|
-
bauxite -
|
266
|
-
-t 60 -o 240 --csv-summary "$WORKSPACE/test.csv" \
|
265
|
+
bauxite -t 60 -o 240 --jenkins "$WORKSPACE/test-results" \
|
267
266
|
"$WORKSPACE/test/suite.bxt"
|
268
267
|
|
269
268
|
Assuming you have Selenium Server running on localhost and your workspace (e.g. GIT repo) contains a folder named `test` with a file named `suite.bxt` the configuration above should work like a charm.
|
@@ -277,7 +276,9 @@ Assuming you have Selenium Server running on localhost and your workspace (e.g.
|
|
277
276
|
test purchase_something.bxt
|
278
277
|
# more tests here...
|
279
278
|
|
280
|
-
Note the `--
|
279
|
+
Note the `--jenkins` option in the configuration above. That option sets the default configuration arguments for Jenkins integration. For more details on the `bauxite` command-line arguments refer to the [RDoc documentation](http://pzavolinsky.github.io/bauxite/Bauxite/Application.html).
|
280
|
+
|
281
|
+
I won't go into the details of configuring the Jenkins publishing plugins to print Bauxite test results, but instead here is a fragment of a possible Jenkins `config.xml`:
|
281
282
|
|
282
283
|
<publishers>
|
283
284
|
...
|
@@ -288,7 +289,7 @@ Note the `--csv-summary` option in the configuration above. That option generate
|
|
288
289
|
<yaxis>Number of tests</yaxis>
|
289
290
|
<series>
|
290
291
|
<hudson.plugins.plot.CSVSeries>
|
291
|
-
<file>test.csv</file>
|
292
|
+
<file>test-results/summary.csv</file>
|
292
293
|
<label></label>
|
293
294
|
<fileType>csv</fileType>
|
294
295
|
<strExclusionSet>
|
@@ -314,7 +315,7 @@ Note the `--csv-summary` option in the configuration above. That option generate
|
|
314
315
|
<yaxis>Test time (s)</yaxis>
|
315
316
|
<series>
|
316
317
|
<hudson.plugins.plot.CSVSeries>
|
317
|
-
<file>test.csv</file>
|
318
|
+
<file>test-results/summary.csv</file>
|
318
319
|
<label></label>
|
319
320
|
<fileType>csv</fileType>
|
320
321
|
<strExclusionSet>
|
data/doc/Bauxite/Action.html
CHANGED
@@ -669,14 +669,14 @@ will be stored in <code>__CAPTURE__</code>.</p>
|
|
669
669
|
|
670
670
|
<span class="ruby-identifier">capture</span> <span class="ruby-identifier">my_file</span>.<span class="ruby-identifier">png</span>
|
671
671
|
<span class="ruby-comment"># => this would capture the screenshot to my_file.png in the current</span>
|
672
|
-
<span class="ruby-comment">#
|
672
|
+
<span class="ruby-comment"># output directory.</span>
|
673
673
|
</pre>
|
674
674
|
|
675
675
|
|
676
676
|
|
677
677
|
|
678
678
|
<div class="method-source-code" id="capture-source">
|
679
|
-
<pre><span class="ruby-comment"># File lib/bauxite/actions/capture.rb, line
|
679
|
+
<pre><span class="ruby-comment"># File lib/bauxite/actions/capture.rb, line 40</span>
|
680
680
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">capture</span>(<span class="ruby-identifier">file</span> = <span class="ruby-keyword">nil</span>)
|
681
681
|
<span class="ruby-keyword">unless</span> <span class="ruby-identifier">file</span>
|
682
682
|
<span class="ruby-identifier">seq</span> = <span class="ruby-ivar">@ctx</span>.<span class="ruby-identifier">variables</span>[<span class="ruby-string">'__CAPTURE_SEQ__'</span>] <span class="ruby-operator">||</span> <span class="ruby-value">0</span>
|
@@ -690,17 +690,11 @@ will be stored in <code>__CAPTURE__</code>.</p>
|
|
690
690
|
<span class="ruby-identifier">file</span> = <span class="ruby-node">"#{test}_#{file}"</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">test</span>
|
691
691
|
<span class="ruby-identifier">file</span> = <span class="ruby-identifier">file</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp">/[^A-Z0-9_-]/i</span>, <span class="ruby-string">'_'</span>) <span class="ruby-operator">+</span> <span class="ruby-string">'.png'</span>
|
692
692
|
<span class="ruby-keyword">end</span>
|
693
|
-
|
694
|
-
<span class="ruby-
|
695
|
-
|
696
|
-
<span class="ruby-keyword">if</span> <span class="ruby-identifier">output</span>
|
697
|
-
<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>
|
698
|
-
<span class="ruby-identifier">file</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">output</span>, <span class="ruby-identifier">file</span>)
|
699
|
-
<span class="ruby-keyword">end</span>
|
700
|
-
<span class="ruby-keyword">end</span>
|
701
|
-
|
693
|
+
|
694
|
+
<span class="ruby-identifier">file</span> = <span class="ruby-ivar">@ctx</span>.<span class="ruby-identifier">output_path</span>(<span class="ruby-identifier">file</span>)
|
695
|
+
|
702
696
|
<span class="ruby-ivar">@ctx</span>.<span class="ruby-identifier">driver</span>.<span class="ruby-identifier">save_screenshot</span>(<span class="ruby-identifier">file</span>)
|
703
|
-
|
697
|
+
|
704
698
|
<span class="ruby-ivar">@ctx</span>.<span class="ruby-identifier">variables</span>[<span class="ruby-string">'__CAPTURE__'</span>] = <span class="ruby-identifier">file</span>
|
705
699
|
<span class="ruby-keyword">true</span>
|
706
700
|
<span class="ruby-keyword">end</span></pre>
|
@@ -118,6 +118,10 @@ href="../Bauxite.html">Bauxite</a> version execute:</p>
|
|
118
118
|
<dd>
|
119
119
|
<p>Number of seconds to wait before issuing a timeout error. This timeout
|
120
120
|
applies only to Selectors.</p>
|
121
|
+
</dd><dt>-o, --open_timeout SECONDS
|
122
|
+
<dd>
|
123
|
+
<p>Number of seconds to wait before issuing a timeout error. This timeout
|
124
|
+
applies only to page loading times (i.e. Net::HTTP).</p>
|
121
125
|
</dd><dt>-d, --debug
|
122
126
|
<dd>
|
123
127
|
<p>If an error occurs, break into the debug console. This mode is very useful
|
@@ -161,6 +165,8 @@ otherwise it defaults to <code>terminal</code>.</p>
|
|
161
165
|
<p>To see a complete list of the available loggers execute:</p>
|
162
166
|
|
163
167
|
<pre>bauxite -h</pre>
|
168
|
+
|
169
|
+
<p>Note that multiple instances of this option can be specified.</p>
|
164
170
|
</dd><dt>-L, --logger-option OPTION
|
165
171
|
<dd>
|
166
172
|
<p>A <code>name=value</code> pair of options that are directly forwarded to
|
@@ -184,6 +190,19 @@ does not contain an <code>=</code> sign.</p>
|
|
184
190
|
<p>To see a complete list of the available selectors execute:</p>
|
185
191
|
|
186
192
|
<pre>bauxite -h</pre>
|
193
|
+
</dd><dt>-c, --capture
|
194
|
+
<dd>
|
195
|
+
<p>If the test fails, capture a screenshot in the <code>output</code>
|
196
|
+
directory. See the --output option below.</p>
|
197
|
+
</dd><dt>--csv-summary FILE
|
198
|
+
<dd>
|
199
|
+
<p>Output a single-line CSV summary ideal to feed into the Plot Jenkins
|
200
|
+
plugin. If <code>FILE</code> is not specified, defaults to
|
201
|
+
<code>summary.csv</code></p>
|
202
|
+
</dd><dt>--output DIR
|
203
|
+
<dd>
|
204
|
+
<p>Output directory for generated artifacts. Defaults to the current working
|
205
|
+
directory.</p>
|
187
206
|
</dd><dt>-u, --url URL
|
188
207
|
<dd>
|
189
208
|
<p>This option is an alias of:</p>
|
@@ -192,6 +211,19 @@ does not contain an <code>=</code> sign.</p>
|
|
192
211
|
|
193
212
|
<p>If <code>URL</code> is not present
|
194
213
|
<code>http://localhost:4444/wd/hub</code> will be assumed.</p>
|
214
|
+
</dd><dt>--jenkins DIR
|
215
|
+
<dd>
|
216
|
+
<p>Configures default options for Jenkins integration. This option is an alias
|
217
|
+
of:</p>
|
218
|
+
|
219
|
+
<pre>-p remote -P url=http://localhost:4444/wd/hub -l echo -l html
|
220
|
+
-L html_package=true -c --csv-summary
|
221
|
+
--output DIR</pre>
|
222
|
+
|
223
|
+
<p>Note that any of the options above can be overridden by specifying the
|
224
|
+
option after the <code>--jenkins</code> option. For example:</p>
|
225
|
+
|
226
|
+
<pre>--jenkins -u selenium.my-organization.com:4445</pre>
|
195
227
|
</dd><dt>-e, --extension DIR
|
196
228
|
<dd>
|
197
229
|
<p>Loads every Ruby file (*.rb) inside <code>DIR</code> (and subdirectories).
|
data/doc/Bauxite/Context.html
CHANGED
@@ -138,6 +138,8 @@
|
|
138
138
|
|
139
139
|
<li ><a href="#method-i-get_value">#get_value</a>
|
140
140
|
|
141
|
+
<li ><a href="#method-i-output_path">#output_path</a>
|
142
|
+
|
141
143
|
<li ><a href="#method-i-print_error">#print_error</a>
|
142
144
|
|
143
145
|
<li ><a href="#method-i-reset_driver">#reset_driver</a>
|
@@ -412,7 +414,7 @@ href="Context.html#method-i-stop">stop</a> (defaults to <code>false</code>)</p>
|
|
412
414
|
|
413
415
|
|
414
416
|
<div class="method-source-code" id="new-source">
|
415
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
417
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 141</span>
|
416
418
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">options</span>)
|
417
419
|
<span class="ruby-ivar">@options</span> = <span class="ruby-identifier">options</span>
|
418
420
|
<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>
|
@@ -480,7 +482,7 @@ href="Context.html#method-i-stop">stop</a> (defaults to <code>false</code>)</p>
|
|
480
482
|
|
481
483
|
|
482
484
|
<div class="method-source-code" id="debug-source">
|
483
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
485
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 272</span>
|
484
486
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">debug</span>
|
485
487
|
<span class="ruby-identifier">exec_parsed_action</span>(<span class="ruby-string">'debug'</span>, [], <span class="ruby-keyword">false</span>)
|
486
488
|
<span class="ruby-keyword">end</span></pre>
|
@@ -537,7 +539,7 @@ applies if no <code>block</code> was given).</p>
|
|
537
539
|
|
538
540
|
|
539
541
|
<div class="method-source-code" id="find-source">
|
540
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
542
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 261</span>
|
541
543
|
<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</span>
|
542
544
|
<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>
|
543
545
|
<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>)
|
@@ -587,7 +589,7 @@ the inner text or the value of the <code>value</code> attribute.</p>
|
|
587
589
|
|
588
590
|
|
589
591
|
<div class="method-source-code" id="get_value-source">
|
590
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
592
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 291</span>
|
591
593
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">get_value</span>(<span class="ruby-identifier">element</span>)
|
592
594
|
<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>
|
593
595
|
<span class="ruby-identifier">element</span>.<span class="ruby-identifier">attribute</span>(<span class="ruby-string">'value'</span>)
|
@@ -630,7 +632,7 @@ the inner text or the value of the <code>value</code> attribute.</p>
|
|
630
632
|
|
631
633
|
|
632
634
|
<div class="method-source-code" id="reset_driver-source">
|
633
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
635
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 209</span>
|
634
636
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">reset_driver</span>
|
635
637
|
<span class="ruby-ivar">@driver</span>.<span class="ruby-identifier">quit</span>
|
636
638
|
<span class="ruby-identifier">_load_driver</span>
|
@@ -679,9 +681,14 @@ href="Context.html#method-i-stop">stop</a>).</p>
|
|
679
681
|
|
680
682
|
|
681
683
|
<div class="method-source-code" id="start-source">
|
682
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
684
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 180</span>
|
683
685
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">start</span>(<span class="ruby-identifier">actions</span> = [])
|
684
|
-
<span class="ruby-
|
686
|
+
<span class="ruby-keyword">begin</span>
|
687
|
+
<span class="ruby-identifier">_load_driver</span>
|
688
|
+
<span class="ruby-keyword">rescue</span> <span class="ruby-constant">StandardError</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
|
689
|
+
<span class="ruby-identifier">print_error</span>(<span class="ruby-identifier">e</span>)
|
690
|
+
<span class="ruby-identifier">raise</span>
|
691
|
+
<span class="ruby-keyword">end</span>
|
685
692
|
<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>
|
686
693
|
<span class="ruby-keyword">begin</span>
|
687
694
|
<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>
|
@@ -744,7 +751,7 @@ href="Context.html#method-i-stop">stop</a> pattern.</p>
|
|
744
751
|
|
745
752
|
|
746
753
|
<div class="method-source-code" id="stop-source">
|
747
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
754
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 229</span>
|
748
755
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">stop</span>
|
749
756
|
<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>]
|
750
757
|
<span class="ruby-keyword">begin</span>
|
@@ -801,7 +808,7 @@ href="Context.html#method-i-stop">stop</a> pattern.</p>
|
|
801
808
|
|
802
809
|
<div class="method-heading">
|
803
810
|
<span class="method-name">load_logger</span><span
|
804
|
-
class="method-args">(
|
811
|
+
class="method-args">(loggers, options)</span>
|
805
812
|
|
806
813
|
<span class="method-click-advice">click to toggle source</span>
|
807
814
|
|
@@ -817,8 +824,14 @@ logger type.</p>
|
|
817
824
|
|
818
825
|
|
819
826
|
<div class="method-source-code" id="load_logger-source">
|
820
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
821
|
-
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">load_logger</span>(<span class="ruby-identifier">
|
827
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 429</span>
|
828
|
+
<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>)
|
829
|
+
<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>
|
830
|
+
<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>)
|
831
|
+
<span class="ruby-keyword">end</span>
|
832
|
+
|
833
|
+
<span class="ruby-identifier">name</span> = <span class="ruby-identifier">loggers</span>
|
834
|
+
|
822
835
|
<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>
|
823
836
|
|
824
837
|
<span class="ruby-identifier">class_name</span> = <span class="ruby-node">"#{log_name.capitalize}Logger"</span>
|
@@ -859,7 +872,7 @@ logger type.</p>
|
|
859
872
|
|
860
873
|
|
861
874
|
<div class="method-source-code" id="parse_action_default-source">
|
862
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
875
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 457</span>
|
863
876
|
<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>)
|
864
877
|
<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>)
|
865
878
|
<span class="ruby-keyword">begin</span>
|
@@ -927,7 +940,7 @@ logger type.</p>
|
|
927
940
|
|
928
941
|
|
929
942
|
<div class="method-source-code" id="wait-source">
|
930
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
943
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 422</span>
|
931
944
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">wait</span>
|
932
945
|
<span class="ruby-constant">Readline</span>.<span class="ruby-identifier">readline</span>(<span class="ruby-string">"Press ENTER to continue\n"</span>)
|
933
946
|
<span class="ruby-keyword">end</span></pre>
|
@@ -969,7 +982,7 @@ with the arguments specified in <code>args</code>.</p>
|
|
969
982
|
|
970
983
|
|
971
984
|
<div class="method-source-code" id="add_alias-source">
|
972
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
985
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 451</span>
|
973
986
|
<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>)
|
974
987
|
<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> }
|
975
988
|
<span class="ruby-keyword">end</span></pre>
|
@@ -1012,7 +1025,7 @@ behavior).</p>
|
|
1012
1025
|
|
1013
1026
|
|
1014
1027
|
<div class="method-source-code" id="exec_action-source">
|
1015
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
1028
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 312</span>
|
1016
1029
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">exec_action</span>(<span class="ruby-identifier">text</span>)
|
1017
1030
|
<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>)
|
1018
1031
|
<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>)
|
@@ -1060,7 +1073,7 @@ ret.call if ret.respond_to? :call</pre>
|
|
1060
1073
|
|
1061
1074
|
|
1062
1075
|
<div class="method-source-code" id="exec_action_object-source">
|
1063
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
1076
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 537</span>
|
1064
1077
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">exec_action_object</span>(<span class="ruby-identifier">action</span>)
|
1065
1078
|
<span class="ruby-identifier">action</span>.<span class="ruby-identifier">execute</span>
|
1066
1079
|
<span class="ruby-keyword">end</span></pre>
|
@@ -1099,7 +1112,7 @@ ret.call if ret.respond_to? :call</pre>
|
|
1099
1112
|
|
1100
1113
|
|
1101
1114
|
<div class="method-source-code" id="exec_file-source">
|
1102
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
1115
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 323</span>
|
1103
1116
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">exec_file</span>(<span class="ruby-identifier">file</span>)
|
1104
1117
|
<span class="ruby-identifier">current_dir</span> = <span class="ruby-ivar">@variables</span>[<span class="ruby-string">'__DIR__'</span> ]
|
1105
1118
|
<span class="ruby-identifier">current_file</span> = <span class="ruby-ivar">@variables</span>[<span class="ruby-string">'__FILE__'</span>]
|
@@ -1160,7 +1173,7 @@ preferred.</p>
|
|
1160
1173
|
|
1161
1174
|
|
1162
1175
|
<div class="method-source-code" id="exec_parsed_action-source">
|
1163
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
1176
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 353</span>
|
1164
1177
|
<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>)
|
1165
1178
|
<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>)
|
1166
1179
|
<span class="ruby-identifier">ret</span> = <span class="ruby-keyword">nil</span>
|
@@ -1211,7 +1224,7 @@ preferred.</p>
|
|
1211
1224
|
|
1212
1225
|
|
1213
1226
|
<div class="method-source-code" id="get_action-source">
|
1214
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
1227
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 497</span>
|
1215
1228
|
<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>)
|
1216
1229
|
<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>])
|
1217
1230
|
<span class="ruby-identifier">action</span> = <span class="ruby-identifier">alias_action</span>[<span class="ruby-value">:action</span>]
|
@@ -1245,6 +1258,58 @@ preferred.</p>
|
|
1245
1258
|
|
1246
1259
|
|
1247
1260
|
|
1261
|
+
</div>
|
1262
|
+
|
1263
|
+
|
1264
|
+
<div id="method-i-output_path" class="method-detail ">
|
1265
|
+
|
1266
|
+
<div class="method-heading">
|
1267
|
+
<span class="method-name">output_path</span><span
|
1268
|
+
class="method-args">(path)</span>
|
1269
|
+
|
1270
|
+
<span class="method-click-advice">click to toggle source</span>
|
1271
|
+
|
1272
|
+
</div>
|
1273
|
+
|
1274
|
+
|
1275
|
+
<div class="method-description">
|
1276
|
+
|
1277
|
+
<p>Returns the output path for <code>path</code> accounting for the
|
1278
|
+
<code>__OUTPUT__</code> variable.</p>
|
1279
|
+
|
1280
|
+
<p>For example:</p>
|
1281
|
+
|
1282
|
+
<pre class="ruby"><span class="ruby-comment"># assuming --output /mnt/disk</span>
|
1283
|
+
|
1284
|
+
<span class="ruby-identifier">ctx</span>.<span class="ruby-identifier">output_path</span> <span class="ruby-string">'/tmp/myfile.txt'</span>
|
1285
|
+
<span class="ruby-comment"># => returns '/tmp/myfile.txt'</span>
|
1286
|
+
|
1287
|
+
<span class="ruby-identifier">ctx</span>.<span class="ruby-identifier">output_path</span> <span class="ruby-string">'myfile.txt'</span>
|
1288
|
+
<span class="ruby-comment"># => returns '/mnt/disk/myfile.txt'</span>
|
1289
|
+
</pre>
|
1290
|
+
|
1291
|
+
|
1292
|
+
|
1293
|
+
|
1294
|
+
<div class="method-source-code" id="output_path-source">
|
1295
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 582</span>
|
1296
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">output_path</span>(<span class="ruby-identifier">path</span>)
|
1297
|
+
<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>
|
1298
|
+
<span class="ruby-identifier">output</span> = <span class="ruby-ivar">@variables</span>[<span class="ruby-string">'__OUTPUT__'</span>]
|
1299
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">output</span>
|
1300
|
+
<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>
|
1301
|
+
<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>)
|
1302
|
+
<span class="ruby-keyword">end</span>
|
1303
|
+
<span class="ruby-keyword">end</span>
|
1304
|
+
<span class="ruby-identifier">path</span>
|
1305
|
+
<span class="ruby-keyword">end</span></pre>
|
1306
|
+
</div>
|
1307
|
+
|
1308
|
+
</div>
|
1309
|
+
|
1310
|
+
|
1311
|
+
|
1312
|
+
|
1248
1313
|
</div>
|
1249
1314
|
|
1250
1315
|
|
@@ -1278,7 +1343,7 @@ handling the verbose option.</p>
|
|
1278
1343
|
|
1279
1344
|
|
1280
1345
|
<div class="method-source-code" id="print_error-source">
|
1281
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
1346
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 552</span>
|
1282
1347
|
<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>)
|
1283
1348
|
<span class="ruby-keyword">if</span> <span class="ruby-ivar">@logger</span>
|
1284
1349
|
<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>
|
@@ -1338,7 +1403,7 @@ available <a href="Selector.html">Selector</a> strategies).</p>
|
|
1338
1403
|
|
1339
1404
|
|
1340
1405
|
<div class="method-source-code" id="with_driver_timeout-source">
|
1341
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
1406
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 407</span>
|
1342
1407
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">with_driver_timeout</span>(<span class="ruby-identifier">timeout</span>)
|
1343
1408
|
<span class="ruby-identifier">current</span> = <span class="ruby-ivar">@driver_timeout</span>
|
1344
1409
|
<span class="ruby-ivar">@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>
|
@@ -1387,7 +1452,7 @@ to execute the block itself.</p>
|
|
1387
1452
|
|
1388
1453
|
|
1389
1454
|
<div class="method-source-code" id="with_timeout-source">
|
1390
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
1455
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 379</span>
|
1391
1456
|
<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>)
|
1392
1457
|
<span class="ruby-identifier">stime</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">new</span>
|
1393
1458
|
<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>]
|
@@ -1468,7 +1533,7 @@ to execute the block itself.</p>
|
|
1468
1533
|
|
1469
1534
|
|
1470
1535
|
<div class="method-source-code" id="action_args-source">
|
1471
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
1536
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 613</span>
|
1472
1537
|
<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>)
|
1473
1538
|
<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>
|
1474
1539
|
<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> }
|
@@ -1508,7 +1573,7 @@ to execute the block itself.</p>
|
|
1508
1573
|
|
1509
1574
|
|
1510
1575
|
<div class="method-source-code" id="actions-source">
|
1511
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
1576
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 603</span>
|
1512
1577
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">actions</span>
|
1513
1578
|
<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>) }
|
1514
1579
|
<span class="ruby-keyword">end</span></pre>
|
@@ -1547,7 +1612,7 @@ to execute the block itself.</p>
|
|
1547
1612
|
|
1548
1613
|
|
1549
1614
|
<div class="method-source-code" id="loggers-source">
|
1550
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
1615
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 642</span>
|
1551
1616
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">loggers</span>
|
1552
1617
|
<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>) }
|
1553
1618
|
<span class="ruby-keyword">end</span></pre>
|
@@ -1589,7 +1654,7 @@ to execute the block itself.</p>
|
|
1589
1654
|
|
1590
1655
|
|
1591
1656
|
<div class="method-source-code" id="max_action_name_size-source">
|
1592
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
1657
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 666</span>
|
1593
1658
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">max_action_name_size</span>
|
1594
1659
|
<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> }
|
1595
1660
|
<span class="ruby-keyword">end</span></pre>
|
@@ -1628,7 +1693,7 @@ to execute the block itself.</p>
|
|
1628
1693
|
|
1629
1694
|
|
1630
1695
|
<div class="method-source-code" id="parsers-source">
|
1631
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
1696
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 652</span>
|
1632
1697
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">parsers</span>
|
1633
1698
|
(<span class="ruby-constant">Parser</span>.<span class="ruby-identifier">public_instance_methods</span>(<span class="ruby-keyword">false</span>) <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>))
|
1634
1699
|
.<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> }
|
@@ -1672,7 +1737,7 @@ custom selectors are returned.</p>
|
|
1672
1737
|
|
1673
1738
|
|
1674
1739
|
<div class="method-source-code" id="selectors-source">
|
1675
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
1740
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 628</span>
|
1676
1741
|
<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>)
|
1677
1742
|
<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>) }
|
1678
1743
|
<span class="ruby-keyword">if</span> <span class="ruby-identifier">include_standard_selectors</span>
|
@@ -1754,7 +1819,7 @@ with the corresponding variable value.</p>
|
|
1754
1819
|
|
1755
1820
|
|
1756
1821
|
<div class="method-source-code" id="expand-source">
|
1757
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
1822
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 687</span>
|
1758
1823
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">expand</span>(<span class="ruby-identifier">s</span>)
|
1759
1824
|
<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>
|
1760
1825
|
<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>)
|
@@ -1807,7 +1872,7 @@ variables is restored.</p>
|
|
1807
1872
|
|
1808
1873
|
|
1809
1874
|
<div class="method-source-code" id="with_vars-source">
|
1810
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
1875
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 710</span>
|
1811
1876
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">with_vars</span>(<span class="ruby-identifier">vars</span>)
|
1812
1877
|
<span class="ruby-identifier">current</span> = <span class="ruby-ivar">@variables</span>
|
1813
1878
|
<span class="ruby-ivar">@variables</span> = <span class="ruby-ivar">@variables</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">vars</span>)
|