bauxite 0.4.4 → 0.4.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +84 -0
- data/doc/Bauxite.html +1 -1
- data/doc/Bauxite/Action.html +71 -1
- data/doc/Bauxite/ActionModule.html +1 -1
- data/doc/Bauxite/Application.html +1 -1
- data/doc/Bauxite/Context.html +127 -10
- data/doc/Bauxite/Errors.html +1 -1
- data/doc/Bauxite/Errors/AssertionError.html +1 -1
- data/doc/Bauxite/Errors/FileNotFoundError.html +1 -1
- data/doc/Bauxite/Errors/FormatError.html +1 -1
- data/doc/Bauxite/Loggers.html +1 -1
- data/doc/Bauxite/Loggers/CompositeLogger.html +1 -1
- data/doc/Bauxite/Loggers/EchoLogger.html +1 -1
- data/doc/Bauxite/Loggers/FileLogger.html +1 -1
- data/doc/Bauxite/Loggers/NullLogger.html +1 -1
- data/doc/Bauxite/Loggers/TerminalLogger.html +1 -1
- data/doc/Bauxite/Loggers/XtermLogger.html +1 -1
- data/doc/Bauxite/Parser.html +1 -1
- data/doc/Bauxite/ParserModule.html +1 -1
- data/doc/Bauxite/Selector.html +1 -1
- data/doc/Bauxite/SelectorModule.html +1 -1
- data/doc/README_md.html +96 -1
- data/doc/created.rid +47 -46
- data/doc/index.html +95 -1
- data/doc/js/jquery.js +4 -18
- data/doc/js/search_index.js +1 -1
- data/doc/table_of_contents.html +38 -22
- data/lib/bauxite.rb +1 -1
- data/lib/bauxite/actions/failif.rb +55 -0
- data/lib/bauxite/core/context.rb +59 -31
- data/test/failif.bxt +6 -0
- data/test/failif/page.html +5 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b814f19ff06421cccdeaeaf132a5977ec7db4e8f
|
4
|
+
data.tar.gz: 99a5eeab70836e91ae71e4d46a6cafba25b1e2a4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf31de624cb941fc831973d51adee95b78632e87ff75cf4ff01a818a2f85aaab7312de68b68eef282dd1ef30a3b92e75baf13d12e6346b76ca47ed1b8a5dbe47
|
7
|
+
data.tar.gz: e4f7a6a65891bd76a3428b61457a488fd3ef3b624a7132e3cd822f94a1fc9697434bb821ad6aca6a9397d185ab7c900baf7bfcaa710e6f7678556ba70a12f501
|
data/README.md
CHANGED
@@ -254,3 +254,87 @@ Now we can change our test to look like this:
|
|
254
254
|
Finally, to execute Bauxite loading our plugin we can type:
|
255
255
|
|
256
256
|
bauxite -e plugins my_test.bxt
|
257
|
+
|
258
|
+
Jenkins Integration
|
259
|
+
-------------------
|
260
|
+
|
261
|
+
If you want to run Bauxite tests in your [Jenkins CI](http://jenkins-ci.org/) server you must install `xvfb` and `selenium-server-standalone`. Googling for `selenium headless jenkins <your distro>` is a great start. Assuming you installed Ruby and Bauxite for the `jenkins` user (see the instructions above), you can create an execute shell build task with the following text:
|
262
|
+
|
263
|
+
#!/bin/bash
|
264
|
+
source ~/.rvm/scripts/rvm
|
265
|
+
bauxite -l echo -u http://localhost:4444/wd/hub \
|
266
|
+
-t 60 -o 240 --csv-summary "$WORKSPACE/test.csv" \
|
267
|
+
"$WORKSPACE/test/suite.bxt"
|
268
|
+
|
269
|
+
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.
|
270
|
+
|
271
|
+
`suite.bxt` could be something like:
|
272
|
+
|
273
|
+
# === suite.bxt === #
|
274
|
+
test login.bxt
|
275
|
+
test register.bxt
|
276
|
+
test browse_arround.bxt
|
277
|
+
test purchase_something.bxt
|
278
|
+
# more tests here...
|
279
|
+
|
280
|
+
Note the `--csv-summary` option in the configuration above. That option generates a single-ling CSV file ideal to feed the `Plot` Jenkins plugin. I won't go into the details of configuring the Plot plugin, but instead here is a fragment of a possible Jenkins config.xml plotting the Bauxite test results:
|
281
|
+
|
282
|
+
<publishers>
|
283
|
+
...
|
284
|
+
<hudson.plugins.plot.PlotPublisher plugin="plot@1.5">
|
285
|
+
<plots>
|
286
|
+
<hudson.plugins.plot.Plot>
|
287
|
+
<title>Number of tests</title>
|
288
|
+
<yaxis>Number of tests</yaxis>
|
289
|
+
<series>
|
290
|
+
<hudson.plugins.plot.CSVSeries>
|
291
|
+
<file>test.csv</file>
|
292
|
+
<label></label>
|
293
|
+
<fileType>csv</fileType>
|
294
|
+
<strExclusionSet>
|
295
|
+
<string>OK</string>
|
296
|
+
<string>Failed</string>
|
297
|
+
<string>Total</string>
|
298
|
+
</strExclusionSet>
|
299
|
+
<inclusionFlag>INCLUDE_BY_STRING</inclusionFlag>
|
300
|
+
<exclusionValues>Total,OK,Failed</exclusionValues>
|
301
|
+
<url></url>
|
302
|
+
<displayTableFlag>false</displayTableFlag>
|
303
|
+
</hudson.plugins.plot.CSVSeries>
|
304
|
+
</series>
|
305
|
+
<group>Test</group>
|
306
|
+
<numBuilds>100</numBuilds>
|
307
|
+
<csvFileName>1620406039.csv</csvFileName>
|
308
|
+
<csvLastModification>0</csvLastModification>
|
309
|
+
<style>line</style>
|
310
|
+
<useDescr>false</useDescr>
|
311
|
+
</hudson.plugins.plot.Plot>
|
312
|
+
<hudson.plugins.plot.Plot>
|
313
|
+
<title>Test Execution Time</title>
|
314
|
+
<yaxis>Test time (s)</yaxis>
|
315
|
+
<series>
|
316
|
+
<hudson.plugins.plot.CSVSeries>
|
317
|
+
<file>test.csv</file>
|
318
|
+
<label></label>
|
319
|
+
<fileType>csv</fileType>
|
320
|
+
<strExclusionSet>
|
321
|
+
<string>Time</string>
|
322
|
+
</strExclusionSet>
|
323
|
+
<inclusionFlag>INCLUDE_BY_STRING</inclusionFlag>
|
324
|
+
<exclusionValues>Time</exclusionValues>
|
325
|
+
<url></url>
|
326
|
+
<displayTableFlag>false</displayTableFlag>
|
327
|
+
</hudson.plugins.plot.CSVSeries>
|
328
|
+
</series>
|
329
|
+
<group>Test</group>
|
330
|
+
<numBuilds>100</numBuilds>
|
331
|
+
<csvFileName>336296054.csv</csvFileName>
|
332
|
+
<csvLastModification>0</csvLastModification>
|
333
|
+
<style>line</style>
|
334
|
+
<useDescr>false</useDescr>
|
335
|
+
</hudson.plugins.plot.Plot>
|
336
|
+
</plots>
|
337
|
+
</hudson.plugins.plot.PlotPublisher>
|
338
|
+
...
|
339
|
+
</publishers>
|
340
|
+
|
data/doc/Bauxite.html
CHANGED
@@ -94,7 +94,7 @@
|
|
94
94
|
|
95
95
|
<footer id="validator-badges" role="contentinfo">
|
96
96
|
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
97
|
-
<p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> 4.1.
|
97
|
+
<p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> 4.1.1.
|
98
98
|
<p>Based on <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
99
99
|
</footer>
|
100
100
|
|
data/doc/Bauxite/Action.html
CHANGED
@@ -111,6 +111,8 @@
|
|
111
111
|
|
112
112
|
<li ><a href="#method-i-exec">#exec</a>
|
113
113
|
|
114
|
+
<li ><a href="#method-i-failif">#failif</a>
|
115
|
+
|
114
116
|
<li ><a href="#method-i-js">#js</a>
|
115
117
|
|
116
118
|
<li ><a href="#method-i-load">#load</a>
|
@@ -690,6 +692,74 @@ results of the execution will be assigned to the variable named
|
|
690
692
|
|
691
693
|
|
692
694
|
|
695
|
+
</div>
|
696
|
+
|
697
|
+
|
698
|
+
<div id="method-i-failif" class="method-detail ">
|
699
|
+
|
700
|
+
<div class="method-heading">
|
701
|
+
<span class="method-name">failif</span><span
|
702
|
+
class="method-args">(action, *args)</span>
|
703
|
+
|
704
|
+
<span class="method-click-advice">click to toggle source</span>
|
705
|
+
|
706
|
+
</div>
|
707
|
+
|
708
|
+
|
709
|
+
<div class="method-description">
|
710
|
+
|
711
|
+
<p>Executes the specified <code>action</code> expected to fail. If
|
712
|
+
<code>action</code> succeeds the <a
|
713
|
+
href="Action.html#method-i-failif">failif</a> action fails. If
|
714
|
+
<code>action</code> fails, <a href="Action.html#method-i-failif">failif</a>
|
715
|
+
succeeds.</p>
|
716
|
+
|
717
|
+
<p><a href="Action.html#method-i-failif">failif</a> effectively negates the
|
718
|
+
value of <code>action</code>. Note that this method is intended to negate
|
719
|
+
assertions (e.g. <a href="Action.html#method-i-assert">assert</a>, <a
|
720
|
+
href="Action.html#method-i-assertv">assertv</a>, <a
|
721
|
+
href="Action.html#method-i-source">source</a>, etc.). The behavior when
|
722
|
+
applied to other actions (e.g. <a
|
723
|
+
href="Action.html#method-i-load">load</a>, <a
|
724
|
+
href="Action.html#method-i-ruby">ruby</a>, <a
|
725
|
+
href="Action.html#method-i-test">test</a>, etc.) is undefined.</p>
|
726
|
+
|
727
|
+
<p>For example:</p>
|
728
|
+
|
729
|
+
<pre class="ruby"><span class="ruby-comment"># assuming <input type="text" id="hello" value="world" /></span>
|
730
|
+
<span class="ruby-identifier">assert</span> <span class="ruby-identifier">hello</span> <span class="ruby-identifier">world</span>
|
731
|
+
<span class="ruby-identifier">failif</span> <span class="ruby-identifier">assert</span> <span class="ruby-identifier">hello</span> <span class="ruby-identifier">universe</span>
|
732
|
+
<span class="ruby-identifier">failif</span> <span class="ruby-identifier">assertv</span> <span class="ruby-keyword">true</span> <span class="ruby-keyword">false</span>
|
733
|
+
<span class="ruby-comment"># => these assertions would pass</span>
|
734
|
+
</pre>
|
735
|
+
|
736
|
+
|
737
|
+
|
738
|
+
|
739
|
+
<div class="method-source-code" id="failif-source">
|
740
|
+
<pre><span class="ruby-comment"># File lib/bauxite/actions/failif.rb, line 40</span>
|
741
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">failif</span>(<span class="ruby-identifier">action</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
|
742
|
+
<span class="ruby-identifier">action</span> = <span class="ruby-ivar">@ctx</span>.<span class="ruby-identifier">get_action</span>(<span class="ruby-identifier">action</span>, <span class="ruby-identifier">args</span>, <span class="ruby-keyword">nil</span>, <span class="ruby-ivar">@ctx</span>.<span class="ruby-identifier">variables</span>[<span class="ruby-string">'__FILE__'</span>], <span class="ruby-ivar">@ctx</span>.<span class="ruby-identifier">variables</span>[<span class="ruby-string">'__LINE__'</span>])
|
743
|
+
|
744
|
+
<span class="ruby-ivar">@ctx</span>.<span class="ruby-identifier">with_timeout</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-keyword">do</span>
|
745
|
+
<span class="ruby-ivar">@ctx</span>.<span class="ruby-identifier">with_vars</span>({ <span class="ruby-string">'__TIMEOUT__'</span> =<span class="ruby-operator">></span> <span class="ruby-value">0</span>}) <span class="ruby-keyword">do</span>
|
746
|
+
<span class="ruby-keyword">begin</span>
|
747
|
+
<span class="ruby-identifier">ret</span> = <span class="ruby-ivar">@ctx</span>.<span class="ruby-identifier">exec_action_object</span>(<span class="ruby-identifier">action</span>)
|
748
|
+
<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-value">:call</span>
|
749
|
+
<span class="ruby-keyword">rescue</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>
|
750
|
+
<span class="ruby-keyword">return</span> <span class="ruby-keyword">true</span>
|
751
|
+
<span class="ruby-keyword">end</span>
|
752
|
+
<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-node">"Assertion did not failed as expected:#{action.text}"</span>
|
753
|
+
<span class="ruby-keyword">end</span>
|
754
|
+
<span class="ruby-keyword">end</span>
|
755
|
+
<span class="ruby-keyword">end</span></pre>
|
756
|
+
</div>
|
757
|
+
|
758
|
+
</div>
|
759
|
+
|
760
|
+
|
761
|
+
|
762
|
+
|
693
763
|
</div>
|
694
764
|
|
695
765
|
|
@@ -1563,7 +1633,7 @@ href="Context.html#method-i-expand">Bauxite::Context#expand</a>).</p>
|
|
1563
1633
|
|
1564
1634
|
<footer id="validator-badges" role="contentinfo">
|
1565
1635
|
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
1566
|
-
<p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> 4.1.
|
1636
|
+
<p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> 4.1.1.
|
1567
1637
|
<p>Based on <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
1568
1638
|
</footer>
|
1569
1639
|
|
@@ -336,7 +336,7 @@ might yield different results.</p>
|
|
336
336
|
|
337
337
|
<footer id="validator-badges" role="contentinfo">
|
338
338
|
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
339
|
-
<p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> 4.1.
|
339
|
+
<p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> 4.1.1.
|
340
340
|
<p>Based on <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
341
341
|
</footer>
|
342
342
|
|
@@ -253,7 +253,7 @@ indicates success).</p>
|
|
253
253
|
|
254
254
|
<footer id="validator-badges" role="contentinfo">
|
255
255
|
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
256
|
-
<p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> 4.1.
|
256
|
+
<p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> 4.1.1.
|
257
257
|
<p>Based on <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
258
258
|
</footer>
|
259
259
|
|
data/doc/Bauxite/Context.html
CHANGED
@@ -123,12 +123,16 @@
|
|
123
123
|
|
124
124
|
<li ><a href="#method-i-exec_action">#exec_action</a>
|
125
125
|
|
126
|
+
<li ><a href="#method-i-exec_action_object">#exec_action_object</a>
|
127
|
+
|
126
128
|
<li ><a href="#method-i-exec_file">#exec_file</a>
|
127
129
|
|
128
130
|
<li ><a href="#method-i-expand">#expand</a>
|
129
131
|
|
130
132
|
<li ><a href="#method-i-find">#find</a>
|
131
133
|
|
134
|
+
<li ><a href="#method-i-get_action">#get_action</a>
|
135
|
+
|
132
136
|
<li ><a href="#method-i-get_value">#get_value</a>
|
133
137
|
|
134
138
|
<li ><a href="#method-i-handle_errors">#handle_errors</a>
|
@@ -630,7 +634,7 @@ href="Context.html#method-i-stop">stop</a>).</p>
|
|
630
634
|
<span class="ruby-string">'click "name=sa"'</span>,
|
631
635
|
<span class="ruby-string">'break'</span>
|
632
636
|
]
|
633
|
-
<span class="ruby-identifier">ctx</span>.<span class="ruby-identifier">start</span>(<span class="ruby-identifier">lines</span
|
637
|
+
<span class="ruby-identifier">ctx</span>.<span class="ruby-identifier">start</span>(<span class="ruby-identifier">lines</span>)
|
634
638
|
<span class="ruby-comment"># => navigates to www.ruby-lang.org, types ljust in the search box</span>
|
635
639
|
<span class="ruby-comment"># and clicks the "Search" button.</span>
|
636
640
|
</pre>
|
@@ -971,6 +975,58 @@ behavior).</p>
|
|
971
975
|
|
972
976
|
|
973
977
|
|
978
|
+
</div>
|
979
|
+
|
980
|
+
|
981
|
+
<div id="method-i-exec_action_object" class="method-detail ">
|
982
|
+
|
983
|
+
<div class="method-heading">
|
984
|
+
<span class="method-name">exec_action_object</span><span
|
985
|
+
class="method-args">(action)</span>
|
986
|
+
|
987
|
+
<span class="method-click-advice">click to toggle source</span>
|
988
|
+
|
989
|
+
</div>
|
990
|
+
|
991
|
+
|
992
|
+
<div class="method-description">
|
993
|
+
|
994
|
+
<p>Executes the specified action object injecting built-in variables. Note
|
995
|
+
that the result returned by this method might be a lambda. If this is the
|
996
|
+
case, a further <code>call</code> method must be issued.</p>
|
997
|
+
|
998
|
+
<p>This method if part of the action execution chain and is intended for
|
999
|
+
advanced use (e.g. in complex actions). To execute an <a
|
1000
|
+
href="Action.html">Action</a> directly, the <a
|
1001
|
+
href="Context.html#method-i-exec_action">exec_action</a> method is
|
1002
|
+
preferred.</p>
|
1003
|
+
|
1004
|
+
<p>For example:</p>
|
1005
|
+
|
1006
|
+
<pre>action = ctx.get_action("echo", ['Hi!'], 'echo "Hi!"')
|
1007
|
+
ret = ctx.exec_action_object(action)
|
1008
|
+
ret.call if ret.respond_to? :call</pre>
|
1009
|
+
|
1010
|
+
|
1011
|
+
|
1012
|
+
|
1013
|
+
<div class="method-source-code" id="exec_action_object-source">
|
1014
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 488</span>
|
1015
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">exec_action_object</span>(<span class="ruby-identifier">action</span>)
|
1016
|
+
<span class="ruby-comment"># Inject built-in variables</span>
|
1017
|
+
<span class="ruby-identifier">file</span> = <span class="ruby-identifier">action</span>.<span class="ruby-identifier">file</span>
|
1018
|
+
<span class="ruby-identifier">dir</span> = (<span class="ruby-constant">File</span>.<span class="ruby-identifier">exists?</span> <span class="ruby-identifier">file</span>) <span class="ruby-operator">?</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-identifier">file</span>) <span class="ruby-operator">:</span> <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">pwd</span>
|
1019
|
+
<span class="ruby-ivar">@variables</span>[<span class="ruby-string">'__FILE__'</span>] = <span class="ruby-identifier">file</span>
|
1020
|
+
<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-identifier">dir</span>)
|
1021
|
+
<span class="ruby-identifier">action</span>.<span class="ruby-identifier">execute</span>
|
1022
|
+
<span class="ruby-keyword">end</span></pre>
|
1023
|
+
</div>
|
1024
|
+
|
1025
|
+
</div>
|
1026
|
+
|
1027
|
+
|
1028
|
+
|
1029
|
+
|
974
1030
|
</div>
|
975
1031
|
|
976
1032
|
|
@@ -1012,6 +1068,67 @@ behavior).</p>
|
|
1012
1068
|
|
1013
1069
|
|
1014
1070
|
|
1071
|
+
</div>
|
1072
|
+
|
1073
|
+
|
1074
|
+
<div id="method-i-get_action" class="method-detail ">
|
1075
|
+
|
1076
|
+
<div class="method-heading">
|
1077
|
+
<span class="method-name">get_action</span><span
|
1078
|
+
class="method-args">(action, args, text, file, line)</span>
|
1079
|
+
|
1080
|
+
<span class="method-click-advice">click to toggle source</span>
|
1081
|
+
|
1082
|
+
</div>
|
1083
|
+
|
1084
|
+
|
1085
|
+
<div class="method-description">
|
1086
|
+
|
1087
|
+
<p>Returns an executable <a href="Action.html">Action</a> object constructed
|
1088
|
+
from the specified arguments resolving action aliases.</p>
|
1089
|
+
|
1090
|
+
<p>This method if part of the action execution chain and is intended for
|
1091
|
+
advanced use (e.g. in complex actions). To execute an <a
|
1092
|
+
href="Action.html">Action</a> directly, the <a
|
1093
|
+
href="Context.html#method-i-exec_action">exec_action</a> method is
|
1094
|
+
preferred.</p>
|
1095
|
+
|
1096
|
+
|
1097
|
+
|
1098
|
+
|
1099
|
+
<div class="method-source-code" id="get_action-source">
|
1100
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 450</span>
|
1101
|
+
<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-identifier">file</span>, <span class="ruby-identifier">line</span>)
|
1102
|
+
<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>])
|
1103
|
+
<span class="ruby-identifier">action</span> = <span class="ruby-identifier">alias_action</span>[<span class="ruby-value">:action</span>]
|
1104
|
+
<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>
|
1105
|
+
<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>
|
1106
|
+
<span class="ruby-comment"># expand ${1} to args[0], ${2} to args[1], etc.</span>
|
1107
|
+
<span class="ruby-comment"># expand ${4*} to "#{args[4]} #{args[5]} ..."</span>
|
1108
|
+
<span class="ruby-comment"># expand ${4*q} to "\"#{args[4]}\" \"#{args[5]}\" ..."</span>
|
1109
|
+
<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>
|
1110
|
+
<span class="ruby-keyword">if</span> <span class="ruby-node">$2</span> <span class="ruby-operator">==</span> <span class="ruby-keyword">nil</span>
|
1111
|
+
<span class="ruby-identifier">args</span>[<span class="ruby-identifier">idx</span>] <span class="ruby-operator">||</span> <span class="ruby-string">''</span>
|
1112
|
+
<span class="ruby-keyword">else</span>
|
1113
|
+
<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>]
|
1114
|
+
<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>
|
1115
|
+
<span class="ruby-identifier">range</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">' '</span>)
|
1116
|
+
<span class="ruby-keyword">end</span>
|
1117
|
+
<span class="ruby-keyword">end</span>
|
1118
|
+
<span class="ruby-keyword">end</span>
|
1119
|
+
<span class="ruby-keyword">end</span>
|
1120
|
+
|
1121
|
+
<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>
|
1122
|
+
|
1123
|
+
<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>)
|
1124
|
+
<span class="ruby-keyword">end</span></pre>
|
1125
|
+
</div>
|
1126
|
+
|
1127
|
+
</div>
|
1128
|
+
|
1129
|
+
|
1130
|
+
|
1131
|
+
|
1015
1132
|
</div>
|
1016
1133
|
|
1017
1134
|
|
@@ -1251,7 +1368,7 @@ to execute the block itself.</p>
|
|
1251
1368
|
|
1252
1369
|
|
1253
1370
|
<div class="method-source-code" id="action_args-source">
|
1254
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
1371
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 518</span>
|
1255
1372
|
<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>)
|
1256
1373
|
<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>
|
1257
1374
|
<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> }
|
@@ -1291,7 +1408,7 @@ to execute the block itself.</p>
|
|
1291
1408
|
|
1292
1409
|
|
1293
1410
|
<div class="method-source-code" id="actions-source">
|
1294
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
1411
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 508</span>
|
1295
1412
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">actions</span>
|
1296
1413
|
<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>) }
|
1297
1414
|
<span class="ruby-keyword">end</span></pre>
|
@@ -1330,7 +1447,7 @@ to execute the block itself.</p>
|
|
1330
1447
|
|
1331
1448
|
|
1332
1449
|
<div class="method-source-code" id="loggers-source">
|
1333
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
1450
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 547</span>
|
1334
1451
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">loggers</span>
|
1335
1452
|
<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>) }
|
1336
1453
|
<span class="ruby-keyword">end</span></pre>
|
@@ -1372,7 +1489,7 @@ to execute the block itself.</p>
|
|
1372
1489
|
|
1373
1490
|
|
1374
1491
|
<div class="method-source-code" id="max_action_name_size-source">
|
1375
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
1492
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 571</span>
|
1376
1493
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">max_action_name_size</span>
|
1377
1494
|
<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> }
|
1378
1495
|
<span class="ruby-keyword">end</span></pre>
|
@@ -1411,7 +1528,7 @@ to execute the block itself.</p>
|
|
1411
1528
|
|
1412
1529
|
|
1413
1530
|
<div class="method-source-code" id="parsers-source">
|
1414
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
1531
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 557</span>
|
1415
1532
|
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">parsers</span>
|
1416
1533
|
(<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>))
|
1417
1534
|
.<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> }
|
@@ -1455,7 +1572,7 @@ custom selectors are returned.</p>
|
|
1455
1572
|
|
1456
1573
|
|
1457
1574
|
<div class="method-source-code" id="selectors-source">
|
1458
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
1575
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 533</span>
|
1459
1576
|
<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>)
|
1460
1577
|
<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>) }
|
1461
1578
|
<span class="ruby-keyword">if</span> <span class="ruby-identifier">include_standard_selectors</span>
|
@@ -1537,7 +1654,7 @@ with the corresponding variable value.</p>
|
|
1537
1654
|
|
1538
1655
|
|
1539
1656
|
<div class="method-source-code" id="expand-source">
|
1540
|
-
<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 592</span>
|
1541
1658
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">expand</span>(<span class="ruby-identifier">s</span>)
|
1542
1659
|
<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>
|
1543
1660
|
<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>)
|
@@ -1590,7 +1707,7 @@ variables is restored.</p>
|
|
1590
1707
|
|
1591
1708
|
|
1592
1709
|
<div class="method-source-code" id="with_vars-source">
|
1593
|
-
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line
|
1710
|
+
<pre><span class="ruby-comment"># File lib/bauxite/core/context.rb, line 615</span>
|
1594
1711
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">with_vars</span>(<span class="ruby-identifier">vars</span>)
|
1595
1712
|
<span class="ruby-identifier">current</span> = <span class="ruby-ivar">@variables</span>
|
1596
1713
|
<span class="ruby-ivar">@variables</span> = <span class="ruby-ivar">@variables</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">vars</span>)
|
@@ -1616,7 +1733,7 @@ variables is restored.</p>
|
|
1616
1733
|
|
1617
1734
|
<footer id="validator-badges" role="contentinfo">
|
1618
1735
|
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
1619
|
-
<p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> 4.1.
|
1736
|
+
<p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> 4.1.1.
|
1620
1737
|
<p>Based on <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
1621
1738
|
</footer>
|
1622
1739
|
|