action_command 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +50 -6
- data/doc/ActionCommand/Executable.html +1 -1
- data/doc/ActionCommand/InputOutput.html +1 -1
- data/doc/ActionCommand/Result.html +181 -85
- data/doc/ActionCommand.html +2 -2
- data/doc/_index.html +1 -1
- data/doc/file.README.html +49 -9
- data/doc/index.html +49 -9
- data/doc/method_list.html +60 -54
- data/doc/top-level-namespace.html +1 -1
- data/lib/action_command/result.rb +6 -0
- data/lib/action_command/version.rb +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: b605106ac4ef7cb666c6a7f0dc61c3c5da322c7a
|
4
|
+
data.tar.gz: 155ec4f83025e426935f424024e009af572d1081
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eda1183bbe4a57392f76f90ff681d0f3b82c2cf5516cb2c2b9ce7adc14e22ffee3c73a8df9bdc856e57df10566bd8928cffffdae673970427c008c4726faa708
|
7
|
+
data.tar.gz: c6302fd177aa94a8e74caa101dcf56bb4c1d19e93c4a087490a0a5b79f25286cb2f2479e66924dd9cb72da259144bc3fb2b34b4e40398eae416b2e9ceb79d006
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -210,17 +210,62 @@ command executions:
|
|
210
210
|
```
|
211
211
|
|
212
212
|
When logging is on, the logger will receive single-line JSON messages
|
213
|
-
at the
|
213
|
+
at the info level for all command inputs and outputs. All child
|
214
214
|
commands under a parent will automatically be tagged with a serial
|
215
215
|
number for correlation. The result looks like this:
|
216
216
|
|
217
|
-
|
217
|
+
```
|
218
|
+
I, [2016-03-07T14:31:53.292843 #47956] INFO -- : {"sequence":"ade3605e40a4d5bf724c5f3d8e43420b","cmd":"CreateUserAction","depth":0,"kind":"command_input","msg":{"name":"Chris","email":"test@test.com","age":41}}
|
219
|
+
I, [2016-03-07T14:31:53.293007 #47956] INFO -- : {"sequence":"ade3605e40a4d5bf724c5f3d8e43420b","cmd":"CreateUserAction","depth":0,"kind":"info","msg":"start_transaction"}
|
220
|
+
I, [2016-03-07T14:31:53.308212 #47956] INFO -- : {"sequence":"ade3605e40a4d5bf724c5f3d8e43420b","cmd":"CreateUserAction","depth":0,"kind":"info","msg":"Saved user"}
|
221
|
+
I, [2016-03-07T14:31:53.308336 #47956] INFO -- : {"sequence":"ade3605e40a4d5bf724c5f3d8e43420b","cmd":"CreateUserAction","depth":0,"kind":"command_input","msg":{}}
|
222
|
+
I, [2016-03-07T14:31:53.308442 #47956] INFO -- : {"sequence":"ade3605e40a4d5bf724c5f3d8e43420b","cmd":"CreateUserAction","depth":0,"kind":"info","msg":"in child transaction"}
|
223
|
+
I, [2016-03-07T14:31:53.308504 #47956] INFO -- : {"sequence":"ade3605e40a4d5bf724c5f3d8e43420b","cmd":"CreateUserAction","depth":0,"kind":"command_output","msg":{}}
|
224
|
+
I, [2016-03-07T14:31:53.308562 #47956] INFO -- : {"sequence":"ade3605e40a4d5bf724c5f3d8e43420b","cmd":"CreateUserAction","depth":0,"kind":"info","msg":"end_transaction"}
|
225
|
+
I, [2016-03-07T14:31:53.308837 #47956] INFO -- : {"sequence":"ade3605e40a4d5bf724c5f3d8e43420b","cmd":"CreateUserAction","depth":0,"kind":"command_output","msg":{"user":{"email":"test@test.com","name":"Chris","age":41}}}
|
226
|
+
```
|
218
227
|
|
219
228
|
You can also optionally add your own entries to the log by calling
|
220
|
-
`result.debug`, `result.info`, or `result.failed`.
|
221
|
-
|
222
|
-
|
229
|
+
`result.debug`, `result.info`, or `result.failed`. You can pass these calls
|
230
|
+
a string or a hash.
|
231
|
+
|
232
|
+
You can use the included LogParser to parse this log if you like, or you can
|
233
|
+
use the included PrettyPrintLogAction to print the log in a nested plain text
|
234
|
+
format, like:
|
235
|
+
|
236
|
+
```
|
237
|
+
HelloWorldCommand (8d315fe58dab39cb4f23a9f4ef366c8b)
|
238
|
+
input:
|
239
|
+
name: Chris
|
240
|
+
Hello Chris
|
241
|
+
output:
|
242
|
+
greeting: Hello Chris
|
243
|
+
```
|
244
|
+
|
245
|
+
### ActiveRecord Transactions
|
246
|
+
|
247
|
+
You can wrap your command contents in a transaction by subclassing
|
248
|
+
`ActionCommand::ExecutableTransaction`. You must explicitly require
|
249
|
+
`action_command/executable_transaction` to avoid a default dependency
|
250
|
+
on ActiveRecord.
|
251
|
+
|
252
|
+
If you call `result.failed` within a transaction, your transaction will
|
253
|
+
automatically be rolled back.
|
223
254
|
|
255
|
+
### Utilities
|
256
|
+
|
257
|
+
It is often useful to allow a single parameter to be either an integer object id,
|
258
|
+
an instance of the object itself, or a string used to lookup the object (used
|
259
|
+
in command-line rake tasks). You can do this using
|
260
|
+
|
261
|
+
```ruby
|
262
|
+
def execute_internal(result)
|
263
|
+
user = ActionCommand::Utils.find_object(User, @user_id) { |p| User.find_by_email(p) }
|
264
|
+
end
|
265
|
+
```
|
266
|
+
|
267
|
+
This will user User.find if passed an Integer, will return a user object, or will yield
|
268
|
+
to the lookup otherwise.
|
224
269
|
|
225
270
|
## Development
|
226
271
|
|
@@ -232,7 +277,6 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
232
277
|
|
233
278
|
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/action_command. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
234
279
|
|
235
|
-
|
236
280
|
## License
|
237
281
|
|
238
282
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
@@ -1124,7 +1124,7 @@ ActionCommand#execute_test.</p>
|
|
1124
1124
|
</div>
|
1125
1125
|
|
1126
1126
|
<div id="footer">
|
1127
|
-
Generated on Mon
|
1127
|
+
Generated on Mon May 16 08:49:39 2016 by
|
1128
1128
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1129
1129
|
0.8.7.6 (ruby-2.2.3).
|
1130
1130
|
</div>
|
@@ -1401,7 +1401,7 @@ description.</p>
|
|
1401
1401
|
</div>
|
1402
1402
|
|
1403
1403
|
<div id="footer">
|
1404
|
-
Generated on Mon
|
1404
|
+
Generated on Mon May 16 08:49:39 2016 by
|
1405
1405
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1406
1406
|
0.8.7.6 (ruby-2.2.3).
|
1407
1407
|
</div>
|
@@ -117,6 +117,35 @@
|
|
117
117
|
<h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
|
118
118
|
<ul class="summary">
|
119
119
|
|
120
|
+
<li class="public ">
|
121
|
+
<span class="summary_signature">
|
122
|
+
|
123
|
+
<a href="#last_error-instance_method" title="#last_error (instance method)">- (String) <strong>last_error</strong> </a>
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
</span>
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
<span class="note title readonly">readonly</span>
|
133
|
+
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
<span class="summary_desc"><div class='inline'>
|
143
|
+
<p>The last string error message.</p>
|
144
|
+
</div></span>
|
145
|
+
|
146
|
+
</li>
|
147
|
+
|
148
|
+
|
120
149
|
<li class="public ">
|
121
150
|
<span class="summary_signature">
|
122
151
|
|
@@ -653,13 +682,15 @@
|
|
653
682
|
9
|
654
683
|
10
|
655
684
|
11
|
656
|
-
12
|
685
|
+
12
|
686
|
+
13</pre>
|
657
687
|
</td>
|
658
688
|
<td>
|
659
689
|
<pre class="code"><span class="info file"># File 'lib/action_command/result.rb', line 8</span>
|
660
690
|
|
661
691
|
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
|
662
692
|
<span class='ivar'>@result_code</span> <span class='op'>=</span> <span class='const'>RESULT_CODE_OK</span>
|
693
|
+
<span class='ivar'>@last_error</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
663
694
|
<span class='ivar'>@values</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rbracket'>]</span>
|
664
695
|
<span class='ivar'>@logger</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
665
696
|
<span class='kw'>end</span></pre>
|
@@ -676,7 +707,68 @@
|
|
676
707
|
|
677
708
|
<span id=""></span>
|
678
709
|
<div class="method_details first">
|
679
|
-
<h3 class="signature first" id="
|
710
|
+
<h3 class="signature first" id="last_error-instance_method">
|
711
|
+
|
712
|
+
- (<tt>String</tt>) <strong>last_error</strong> <span class="extras">(readonly)</span>
|
713
|
+
|
714
|
+
|
715
|
+
|
716
|
+
|
717
|
+
|
718
|
+
</h3><div class="docstring">
|
719
|
+
<div class="discussion">
|
720
|
+
|
721
|
+
<p>Returns the last string error message</p>
|
722
|
+
|
723
|
+
|
724
|
+
</div>
|
725
|
+
</div>
|
726
|
+
<div class="tags">
|
727
|
+
|
728
|
+
<p class="tag_title">Returns:</p>
|
729
|
+
<ul class="return">
|
730
|
+
|
731
|
+
<li>
|
732
|
+
|
733
|
+
|
734
|
+
<span class='type'>(<tt>String</tt>)</span>
|
735
|
+
|
736
|
+
|
737
|
+
|
738
|
+
—
|
739
|
+
<div class='inline'>
|
740
|
+
<p>the last string error message</p>
|
741
|
+
</div>
|
742
|
+
|
743
|
+
</li>
|
744
|
+
|
745
|
+
</ul>
|
746
|
+
|
747
|
+
</div><table class="source_code">
|
748
|
+
<tr>
|
749
|
+
<td>
|
750
|
+
<pre class="lines">
|
751
|
+
|
752
|
+
|
753
|
+
79
|
754
|
+
80
|
755
|
+
81</pre>
|
756
|
+
</td>
|
757
|
+
<td>
|
758
|
+
<pre class="code"><span class="info file"># File 'lib/action_command/result.rb', line 79</span>
|
759
|
+
|
760
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_last_error'>last_error</span>
|
761
|
+
<span class='ivar'>@last_error</span>
|
762
|
+
<span class='kw'>end</span></pre>
|
763
|
+
</td>
|
764
|
+
</tr>
|
765
|
+
</table>
|
766
|
+
</div>
|
767
|
+
|
768
|
+
|
769
|
+
<span id=""></span>
|
770
|
+
<div class="method_details ">
|
771
|
+
<h3 class="signature " id="result_code-instance_method">
|
680
772
|
|
681
773
|
- (<tt>Integer</tt>) <strong>result_code</strong> <span class="extras">(readonly)</span>
|
682
774
|
|
@@ -719,12 +811,12 @@
|
|
719
811
|
<pre class="lines">
|
720
812
|
|
721
813
|
|
722
|
-
|
723
|
-
|
724
|
-
|
814
|
+
76
|
815
|
+
77
|
816
|
+
78</pre>
|
725
817
|
</td>
|
726
818
|
<td>
|
727
|
-
<pre class="code"><span class="info file"># File 'lib/action_command/result.rb', line
|
819
|
+
<pre class="code"><span class="info file"># File 'lib/action_command/result.rb', line 76</span>
|
728
820
|
|
729
821
|
<span class='kw'>def</span> <span class='id identifier rubyid_result_code'>result_code</span>
|
730
822
|
<span class='ivar'>@result_code</span>
|
@@ -767,12 +859,12 @@
|
|
767
859
|
<pre class="lines">
|
768
860
|
|
769
861
|
|
770
|
-
|
771
|
-
|
772
|
-
|
862
|
+
122
|
863
|
+
123
|
864
|
+
124</pre>
|
773
865
|
</td>
|
774
866
|
<td>
|
775
|
-
<pre class="code"><span class="info file"># File 'lib/action_command/result.rb', line
|
867
|
+
<pre class="code"><span class="info file"># File 'lib/action_command/result.rb', line 122</span>
|
776
868
|
|
777
869
|
<span class='kw'>def</span> <span class='op'>[]</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
|
778
870
|
<span class='kw'>return</span> <span class='id identifier rubyid_current'>current</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='rbracket'>]</span>
|
@@ -808,12 +900,12 @@
|
|
808
900
|
<pre class="lines">
|
809
901
|
|
810
902
|
|
811
|
-
|
812
|
-
|
813
|
-
|
903
|
+
107
|
904
|
+
108
|
905
|
+
109</pre>
|
814
906
|
</td>
|
815
907
|
<td>
|
816
|
-
<pre class="code"><span class="info file"># File 'lib/action_command/result.rb', line
|
908
|
+
<pre class="code"><span class="info file"># File 'lib/action_command/result.rb', line 107</span>
|
817
909
|
|
818
910
|
<span class='kw'>def</span> <span class='op'>[]=</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_val'>val</span><span class='rparen'>)</span>
|
819
911
|
<span class='id identifier rubyid_current'>current</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_val'>val</span>
|
@@ -849,12 +941,12 @@
|
|
849
941
|
<pre class="lines">
|
850
942
|
|
851
943
|
|
852
|
-
|
853
|
-
|
854
|
-
|
944
|
+
102
|
945
|
+
103
|
946
|
+
104</pre>
|
855
947
|
</td>
|
856
948
|
<td>
|
857
|
-
<pre class="code"><span class="info file"># File 'lib/action_command/result.rb', line
|
949
|
+
<pre class="code"><span class="info file"># File 'lib/action_command/result.rb', line 102</span>
|
858
950
|
|
859
951
|
<span class='kw'>def</span> <span class='id identifier rubyid_current'>current</span>
|
860
952
|
<span class='kw'>return</span> <span class='ivar'>@values</span><span class='period'>.</span><span class='id identifier rubyid_last'>last</span>
|
@@ -908,15 +1000,15 @@
|
|
908
1000
|
<pre class="lines">
|
909
1001
|
|
910
1002
|
|
911
|
-
29
|
912
1003
|
30
|
913
1004
|
31
|
914
1005
|
32
|
915
1006
|
33
|
916
|
-
34
|
1007
|
+
34
|
1008
|
+
35</pre>
|
917
1009
|
</td>
|
918
1010
|
<td>
|
919
|
-
<pre class="code"><span class="info file"># File 'lib/action_command/result.rb', line
|
1011
|
+
<pre class="code"><span class="info file"># File 'lib/action_command/result.rb', line 30</span>
|
920
1012
|
|
921
1013
|
<span class='kw'>def</span> <span class='id identifier rubyid_debug'>debug</span><span class='lparen'>(</span><span class='id identifier rubyid_msg'>msg</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
922
1014
|
<span class='kw'>if</span> <span class='ivar'>@logger</span>
|
@@ -955,12 +1047,12 @@
|
|
955
1047
|
<pre class="lines">
|
956
1048
|
|
957
1049
|
|
958
|
-
46
|
959
1050
|
47
|
960
|
-
48
|
1051
|
+
48
|
1052
|
+
49</pre>
|
961
1053
|
</td>
|
962
1054
|
<td>
|
963
|
-
<pre class="code"><span class="info file"># File 'lib/action_command/result.rb', line
|
1055
|
+
<pre class="code"><span class="info file"># File 'lib/action_command/result.rb', line 47</span>
|
964
1056
|
|
965
1057
|
<span class='kw'>def</span> <span class='id identifier rubyid_error'>error</span><span class='lparen'>(</span><span class='id identifier rubyid_msg'>msg</span><span class='rparen'>)</span>
|
966
1058
|
<span class='ivar'>@logger</span><span class='period'>.</span><span class='id identifier rubyid_error'>error</span><span class='lparen'>(</span><span class='id identifier rubyid_build_log'>build_log</span><span class='lparen'>(</span><span class='id identifier rubyid_msg'>msg</span><span class='comma'>,</span> <span class='const'>ActionCommand</span><span class='op'>::</span><span class='const'>LOG_KIND_ERROR</span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='ivar'>@logger</span>
|
@@ -1017,16 +1109,18 @@ result.</p>
|
|
1017
1109
|
<pre class="lines">
|
1018
1110
|
|
1019
1111
|
|
1020
|
-
53
|
1021
1112
|
54
|
1022
1113
|
55
|
1023
|
-
56
|
1114
|
+
56
|
1115
|
+
57
|
1116
|
+
58</pre>
|
1024
1117
|
</td>
|
1025
1118
|
<td>
|
1026
|
-
<pre class="code"><span class="info file"># File 'lib/action_command/result.rb', line
|
1119
|
+
<pre class="code"><span class="info file"># File 'lib/action_command/result.rb', line 54</span>
|
1027
1120
|
|
1028
1121
|
<span class='kw'>def</span> <span class='id identifier rubyid_failed'>failed</span><span class='lparen'>(</span><span class='id identifier rubyid_msg'>msg</span><span class='rparen'>)</span>
|
1029
1122
|
<span class='ivar'>@result_code</span> <span class='op'>=</span> <span class='const'>RESULT_CODE_FAILED</span>
|
1123
|
+
<span class='ivar'>@last_error</span> <span class='op'>=</span> <span class='id identifier rubyid_msg'>msg</span>
|
1030
1124
|
<span class='id identifier rubyid_error'>error</span><span class='lparen'>(</span><span class='id identifier rubyid_msg'>msg</span><span class='rparen'>)</span>
|
1031
1125
|
<span class='kw'>end</span></pre>
|
1032
1126
|
</td>
|
@@ -1092,16 +1186,18 @@ result.</p>
|
|
1092
1186
|
<pre class="lines">
|
1093
1187
|
|
1094
1188
|
|
1095
|
-
62
|
1096
|
-
63
|
1097
1189
|
64
|
1098
|
-
65
|
1190
|
+
65
|
1191
|
+
66
|
1192
|
+
67
|
1193
|
+
68</pre>
|
1099
1194
|
</td>
|
1100
1195
|
<td>
|
1101
|
-
<pre class="code"><span class="info file"># File 'lib/action_command/result.rb', line
|
1196
|
+
<pre class="code"><span class="info file"># File 'lib/action_command/result.rb', line 64</span>
|
1102
1197
|
|
1103
1198
|
<span class='kw'>def</span> <span class='id identifier rubyid_failed_with_code'>failed_with_code</span><span class='lparen'>(</span><span class='id identifier rubyid_msg'>msg</span><span class='comma'>,</span> <span class='id identifier rubyid_result_code'>result_code</span><span class='rparen'>)</span>
|
1104
1199
|
<span class='ivar'>@result_code</span> <span class='op'>=</span> <span class='id identifier rubyid_result_code'>result_code</span>
|
1200
|
+
<span class='ivar'>@last_error</span> <span class='op'>=</span> <span class='id identifier rubyid_msg'>msg</span>
|
1105
1201
|
<span class='id identifier rubyid_error'>error</span><span class='lparen'>(</span><span class='id identifier rubyid_msg'>msg</span><span class='rparen'>)</span>
|
1106
1202
|
<span class='kw'>end</span></pre>
|
1107
1203
|
</td>
|
@@ -1153,15 +1249,15 @@ result.</p>
|
|
1153
1249
|
<pre class="lines">
|
1154
1250
|
|
1155
1251
|
|
1156
|
-
38
|
1157
1252
|
39
|
1158
1253
|
40
|
1159
1254
|
41
|
1160
1255
|
42
|
1161
|
-
43
|
1256
|
+
43
|
1257
|
+
44</pre>
|
1162
1258
|
</td>
|
1163
1259
|
<td>
|
1164
|
-
<pre class="code"><span class="info file"># File 'lib/action_command/result.rb', line
|
1260
|
+
<pre class="code"><span class="info file"># File 'lib/action_command/result.rb', line 39</span>
|
1165
1261
|
|
1166
1262
|
<span class='kw'>def</span> <span class='id identifier rubyid_info'>info</span><span class='lparen'>(</span><span class='id identifier rubyid_msg'>msg</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
1167
1263
|
<span class='kw'>if</span> <span class='ivar'>@logger</span>
|
@@ -1213,12 +1309,12 @@ result.</p>
|
|
1213
1309
|
<pre class="lines">
|
1214
1310
|
|
1215
1311
|
|
1216
|
-
|
1217
|
-
|
1218
|
-
|
1312
|
+
117
|
1313
|
+
118
|
1314
|
+
119</pre>
|
1219
1315
|
</td>
|
1220
1316
|
<td>
|
1221
|
-
<pre class="code"><span class="info file"># File 'lib/action_command/result.rb', line
|
1317
|
+
<pre class="code"><span class="info file"># File 'lib/action_command/result.rb', line 117</span>
|
1222
1318
|
|
1223
1319
|
<span class='kw'>def</span> <span class='id identifier rubyid_key?'>key?</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
|
1224
1320
|
<span class='kw'>return</span> <span class='id identifier rubyid_current'>current</span><span class='period'>.</span><span class='id identifier rubyid_key?'>key?</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
|
@@ -1254,14 +1350,14 @@ result.</p>
|
|
1254
1350
|
<pre class="lines">
|
1255
1351
|
|
1256
1352
|
|
1257
|
-
|
1258
|
-
|
1259
|
-
|
1260
|
-
|
1261
|
-
|
1353
|
+
127
|
1354
|
+
128
|
1355
|
+
129
|
1356
|
+
130
|
1357
|
+
131</pre>
|
1262
1358
|
</td>
|
1263
1359
|
<td>
|
1264
|
-
<pre class="code"><span class="info file"># File 'lib/action_command/result.rb', line
|
1360
|
+
<pre class="code"><span class="info file"># File 'lib/action_command/result.rb', line 127</span>
|
1265
1361
|
|
1266
1362
|
<span class='kw'>def</span> <span class='id identifier rubyid_log_input'>log_input</span><span class='lparen'>(</span><span class='id identifier rubyid_params'>params</span><span class='rparen'>)</span>
|
1267
1363
|
<span class='kw'>return</span> <span class='kw'>unless</span> <span class='ivar'>@logger</span>
|
@@ -1299,16 +1395,16 @@ result.</p>
|
|
1299
1395
|
<pre class="lines">
|
1300
1396
|
|
1301
1397
|
|
1302
|
-
|
1303
|
-
|
1304
|
-
|
1305
|
-
|
1306
|
-
|
1307
|
-
|
1308
|
-
|
1398
|
+
134
|
1399
|
+
135
|
1400
|
+
136
|
1401
|
+
137
|
1402
|
+
138
|
1403
|
+
139
|
1404
|
+
140</pre>
|
1309
1405
|
</td>
|
1310
1406
|
<td>
|
1311
|
-
<pre class="code"><span class="info file"># File 'lib/action_command/result.rb', line
|
1407
|
+
<pre class="code"><span class="info file"># File 'lib/action_command/result.rb', line 134</span>
|
1312
1408
|
|
1313
1409
|
<span class='kw'>def</span> <span class='id identifier rubyid_log_output'>log_output</span>
|
1314
1410
|
<span class='kw'>return</span> <span class='kw'>unless</span> <span class='ivar'>@logger</span>
|
@@ -1348,15 +1444,15 @@ result.</p>
|
|
1348
1444
|
<pre class="lines">
|
1349
1445
|
|
1350
1446
|
|
1351
|
-
15
|
1352
1447
|
16
|
1353
1448
|
17
|
1354
1449
|
18
|
1355
1450
|
19
|
1356
|
-
20
|
1451
|
+
20
|
1452
|
+
21</pre>
|
1357
1453
|
</td>
|
1358
1454
|
<td>
|
1359
|
-
<pre class="code"><span class="info file"># File 'lib/action_command/result.rb', line
|
1455
|
+
<pre class="code"><span class="info file"># File 'lib/action_command/result.rb', line 16</span>
|
1360
1456
|
|
1361
1457
|
<span class='kw'>def</span> <span class='id identifier rubyid_logger='>logger=</span><span class='lparen'>(</span><span class='id identifier rubyid_logger'>logger</span><span class='rparen'>)</span>
|
1362
1458
|
<span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_logger'>logger</span>
|
@@ -1413,12 +1509,12 @@ result.</p>
|
|
1413
1509
|
<pre class="lines">
|
1414
1510
|
|
1415
1511
|
|
1416
|
-
23
|
1417
1512
|
24
|
1418
|
-
25
|
1513
|
+
25
|
1514
|
+
26</pre>
|
1419
1515
|
</td>
|
1420
1516
|
<td>
|
1421
|
-
<pre class="code"><span class="info file"># File 'lib/action_command/result.rb', line
|
1517
|
+
<pre class="code"><span class="info file"># File 'lib/action_command/result.rb', line 24</span>
|
1422
1518
|
|
1423
1519
|
<span class='kw'>def</span> <span class='id identifier rubyid_logging?'>logging?</span>
|
1424
1520
|
<span class='kw'>return</span> <span class='op'>!</span><span class='ivar'>@logger</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
@@ -1472,12 +1568,12 @@ result.</p>
|
|
1472
1568
|
<pre class="lines">
|
1473
1569
|
|
1474
1570
|
|
1475
|
-
|
1476
|
-
|
1477
|
-
|
1571
|
+
71
|
1572
|
+
72
|
1573
|
+
73</pre>
|
1478
1574
|
</td>
|
1479
1575
|
<td>
|
1480
|
-
<pre class="code"><span class="info file"># File 'lib/action_command/result.rb', line
|
1576
|
+
<pre class="code"><span class="info file"># File 'lib/action_command/result.rb', line 71</span>
|
1481
1577
|
|
1482
1578
|
<span class='kw'>def</span> <span class='id identifier rubyid_ok?'>ok?</span>
|
1483
1579
|
<span class='kw'>return</span> <span class='ivar'>@result_code</span> <span class='op'>==</span> <span class='const'>RESULT_CODE_OK</span>
|
@@ -1513,14 +1609,14 @@ result.</p>
|
|
1513
1609
|
<pre class="lines">
|
1514
1610
|
|
1515
1611
|
|
1516
|
-
|
1517
|
-
|
1518
|
-
|
1519
|
-
|
1520
|
-
|
1612
|
+
95
|
1613
|
+
96
|
1614
|
+
97
|
1615
|
+
98
|
1616
|
+
99</pre>
|
1521
1617
|
</td>
|
1522
1618
|
<td>
|
1523
|
-
<pre class="code"><span class="info file"># File 'lib/action_command/result.rb', line
|
1619
|
+
<pre class="code"><span class="info file"># File 'lib/action_command/result.rb', line 95</span>
|
1524
1620
|
|
1525
1621
|
<span class='kw'>def</span> <span class='id identifier rubyid_pop'>pop</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
|
1526
1622
|
<span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_key'>key</span>
|
@@ -1558,20 +1654,20 @@ result.</p>
|
|
1558
1654
|
<pre class="lines">
|
1559
1655
|
|
1560
1656
|
|
1561
|
-
76
|
1562
|
-
77
|
1563
|
-
78
|
1564
|
-
79
|
1565
|
-
80
|
1566
|
-
81
|
1567
1657
|
82
|
1568
1658
|
83
|
1569
1659
|
84
|
1570
1660
|
85
|
1571
|
-
86
|
1661
|
+
86
|
1662
|
+
87
|
1663
|
+
88
|
1664
|
+
89
|
1665
|
+
90
|
1666
|
+
91
|
1667
|
+
92</pre>
|
1572
1668
|
</td>
|
1573
1669
|
<td>
|
1574
|
-
<pre class="code"><span class="info file"># File 'lib/action_command/result.rb', line
|
1670
|
+
<pre class="code"><span class="info file"># File 'lib/action_command/result.rb', line 82</span>
|
1575
1671
|
|
1576
1672
|
<span class='kw'>def</span> <span class='id identifier rubyid_push'>push</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_cmd'>cmd</span><span class='rparen'>)</span>
|
1577
1673
|
<span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_key'>key</span>
|
@@ -1615,12 +1711,12 @@ result.</p>
|
|
1615
1711
|
<pre class="lines">
|
1616
1712
|
|
1617
1713
|
|
1618
|
-
|
1619
|
-
|
1620
|
-
|
1714
|
+
143
|
1715
|
+
144
|
1716
|
+
145</pre>
|
1621
1717
|
</td>
|
1622
1718
|
<td>
|
1623
|
-
<pre class="code"><span class="info file"># File 'lib/action_command/result.rb', line
|
1719
|
+
<pre class="code"><span class="info file"># File 'lib/action_command/result.rb', line 143</span>
|
1624
1720
|
|
1625
1721
|
<span class='kw'>def</span> <span class='id identifier rubyid_root_command'>root_command</span><span class='lparen'>(</span><span class='id identifier rubyid_cls'>cls</span><span class='rparen'>)</span>
|
1626
1722
|
<span class='ivar'>@stack</span> <span class='op'><<</span> <span class='lbrace'>{</span> <span class='label'>key:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>cmd:</span> <span class='id identifier rubyid_cls'>cls</span> <span class='rbrace'>}</span> <span class='kw'>if</span> <span class='ivar'>@logger</span>
|
@@ -1656,12 +1752,12 @@ result.</p>
|
|
1656
1752
|
<pre class="lines">
|
1657
1753
|
|
1658
1754
|
|
1659
|
-
|
1660
|
-
|
1661
|
-
|
1755
|
+
112
|
1756
|
+
113
|
1757
|
+
114</pre>
|
1662
1758
|
</td>
|
1663
1759
|
<td>
|
1664
|
-
<pre class="code"><span class="info file"># File 'lib/action_command/result.rb', line
|
1760
|
+
<pre class="code"><span class="info file"># File 'lib/action_command/result.rb', line 112</span>
|
1665
1761
|
|
1666
1762
|
<span class='kw'>def</span> <span class='id identifier rubyid_sequence'>sequence</span>
|
1667
1763
|
<span class='kw'>return</span> <span class='ivar'>@sequence</span>
|
@@ -1676,7 +1772,7 @@ result.</p>
|
|
1676
1772
|
</div>
|
1677
1773
|
|
1678
1774
|
<div id="footer">
|
1679
|
-
Generated on Mon
|
1775
|
+
Generated on Mon May 16 08:49:39 2016 by
|
1680
1776
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1681
1777
|
0.8.7.6 (ruby-2.2.3).
|
1682
1778
|
</div>
|
data/doc/ActionCommand.html
CHANGED
@@ -320,7 +320,7 @@ specific one through <span class='object_link'><a href="ActionCommand/Result.htm
|
|
320
320
|
|
321
321
|
</div>
|
322
322
|
</dt>
|
323
|
-
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>0.1.
|
323
|
+
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>0.1.5</span><span class='tstring_end'>'</span></span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span></pre></dd>
|
324
324
|
|
325
325
|
<dt id="logger-classvariable" class="">@@logger =
|
326
326
|
<div class="docstring">
|
@@ -1550,7 +1550,7 @@ validations. See <span class='object_link'><a href="ActionCommand/Executable.ht
|
|
1550
1550
|
</div>
|
1551
1551
|
|
1552
1552
|
<div id="footer">
|
1553
|
-
Generated on Mon
|
1553
|
+
Generated on Mon May 16 08:49:39 2016 by
|
1554
1554
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1555
1555
|
0.8.7.6 (ruby-2.2.3).
|
1556
1556
|
</div>
|
data/doc/_index.html
CHANGED
@@ -205,7 +205,7 @@
|
|
205
205
|
</div>
|
206
206
|
|
207
207
|
<div id="footer">
|
208
|
-
Generated on Mon
|
208
|
+
Generated on Mon May 16 08:49:38 2016 by
|
209
209
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
210
210
|
0.8.7.6 (ruby-2.2.3).
|
211
211
|
</div>
|
data/doc/file.README.html
CHANGED
@@ -270,17 +270,57 @@ executions:</p>
|
|
270
270
|
</code></pre>
|
271
271
|
|
272
272
|
<p>When logging is on, the logger will receive single-line JSON messages at
|
273
|
-
the
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
<
|
273
|
+
the info level for all command inputs and outputs. All child commands under
|
274
|
+
a parent will automatically be tagged with a serial number for correlation.
|
275
|
+
The result looks like this:</p>
|
276
|
+
|
277
|
+
<pre class="code ruby"><code class="ruby">I, [2016-03-07T14:31:53.292843 #47956] INFO -- : {"sequence":"ade3605e40a4d5bf724c5f3d8e43420b","cmd":"CreateUserAction","depth":0,"kind":"command_input","msg":{"name":"Chris","email":"test@test.com","age":41}}
|
278
|
+
I, [2016-03-07T14:31:53.293007 #47956] INFO -- : {"sequence":"ade3605e40a4d5bf724c5f3d8e43420b","cmd":"CreateUserAction","depth":0,"kind":"info","msg":"start_transaction"}
|
279
|
+
I, [2016-03-07T14:31:53.308212 #47956] INFO -- : {"sequence":"ade3605e40a4d5bf724c5f3d8e43420b","cmd":"CreateUserAction","depth":0,"kind":"info","msg":"Saved user"}
|
280
|
+
I, [2016-03-07T14:31:53.308336 #47956] INFO -- : {"sequence":"ade3605e40a4d5bf724c5f3d8e43420b","cmd":"CreateUserAction","depth":0,"kind":"command_input","msg":{}}
|
281
|
+
I, [2016-03-07T14:31:53.308442 #47956] INFO -- : {"sequence":"ade3605e40a4d5bf724c5f3d8e43420b","cmd":"CreateUserAction","depth":0,"kind":"info","msg":"in child transaction"}
|
282
|
+
I, [2016-03-07T14:31:53.308504 #47956] INFO -- : {"sequence":"ade3605e40a4d5bf724c5f3d8e43420b","cmd":"CreateUserAction","depth":0,"kind":"command_output","msg":{}}
|
283
|
+
I, [2016-03-07T14:31:53.308562 #47956] INFO -- : {"sequence":"ade3605e40a4d5bf724c5f3d8e43420b","cmd":"CreateUserAction","depth":0,"kind":"info","msg":"end_transaction"}
|
284
|
+
I, [2016-03-07T14:31:53.308837 #47956] INFO -- : {"sequence":"ade3605e40a4d5bf724c5f3d8e43420b","cmd":"CreateUserAction","depth":0,"kind":"command_output","msg":{"user":{"email":"test@test.com","name":"Chris","age":41}}}</code></pre>
|
278
285
|
|
279
286
|
<p>You can also optionally add your own entries to the log by calling
|
280
287
|
<code>result.debug</code>, <code>result.info</code>, or
|
281
|
-
<code>result.failed</code>.
|
282
|
-
|
283
|
-
|
288
|
+
<code>result.failed</code>. You can pass these calls a string or a hash.</p>
|
289
|
+
|
290
|
+
<p>You can use the included LogParser to parse this log if you like, or you
|
291
|
+
can use the included PrettyPrintLogAction to print the log in a nested
|
292
|
+
plain text format, like:</p>
|
293
|
+
|
294
|
+
<pre class="code ruby"><code class="ruby">HelloWorldCommand (8d315fe58dab39cb4f23a9f4ef366c8b)
|
295
|
+
input:
|
296
|
+
name: Chris
|
297
|
+
Hello Chris
|
298
|
+
output:
|
299
|
+
greeting: Hello Chris</code></pre>
|
300
|
+
|
301
|
+
<h3 id="label-ActiveRecord+Transactions">ActiveRecord Transactions</h3>
|
302
|
+
|
303
|
+
<p>You can wrap your command contents in a transaction by subclassing
|
304
|
+
<code>ActionCommand::ExecutableTransaction</code>. You must explicitly
|
305
|
+
require <code>action_command/executable_transaction</code> to avoid a
|
306
|
+
default dependency on ActiveRecord.</p>
|
307
|
+
|
308
|
+
<p>If you call <code>result.failed</code> within a transaction, your
|
309
|
+
transaction will automatically be rolled back.</p>
|
310
|
+
|
311
|
+
<h3 id="label-Utilities">Utilities</h3>
|
312
|
+
|
313
|
+
<p>It is often useful to allow a single parameter to be either an integer
|
314
|
+
object id, an instance of the object itself, or a string used to lookup the
|
315
|
+
object (used in command-line rake tasks). You can do this using</p>
|
316
|
+
|
317
|
+
<pre class="code ruby"><code class="ruby"><span class='kw'>def</span> <span class='id identifier rubyid_execute_internal'>execute_internal</span><span class='lparen'>(</span><span class='id identifier rubyid_result'>result</span><span class='rparen'>)</span>
|
318
|
+
<span class='id identifier rubyid_user'>user</span> <span class='op'>=</span> <span class='const'>ActionCommand</span><span class='op'>::</span><span class='const'>Utils</span><span class='period'>.</span><span class='id identifier rubyid_find_object'>find_object</span><span class='lparen'>(</span><span class='const'>User</span><span class='comma'>,</span> <span class='ivar'>@user_id</span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_p'>p</span><span class='op'>|</span> <span class='const'>User</span><span class='period'>.</span><span class='id identifier rubyid_find_by_email'>find_by_email</span><span class='lparen'>(</span><span class='id identifier rubyid_p'>p</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
319
|
+
<span class='kw'>end</span>
|
320
|
+
</code></pre>
|
321
|
+
|
322
|
+
<p>This will user User.find if passed an Integer, will return a user object,
|
323
|
+
or will yield to the lookup otherwise.</p>
|
284
324
|
|
285
325
|
<h2 id="label-Development">Development</h2>
|
286
326
|
|
@@ -312,7 +352,7 @@ href="http://opensource.org/licenses/MIT">MIT License</a>.</p>
|
|
312
352
|
</div></div>
|
313
353
|
|
314
354
|
<div id="footer">
|
315
|
-
Generated on Mon
|
355
|
+
Generated on Mon May 16 08:49:39 2016 by
|
316
356
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
317
357
|
0.8.7.6 (ruby-2.2.3).
|
318
358
|
</div>
|
data/doc/index.html
CHANGED
@@ -270,17 +270,57 @@ executions:</p>
|
|
270
270
|
</code></pre>
|
271
271
|
|
272
272
|
<p>When logging is on, the logger will receive single-line JSON messages at
|
273
|
-
the
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
<
|
273
|
+
the info level for all command inputs and outputs. All child commands under
|
274
|
+
a parent will automatically be tagged with a serial number for correlation.
|
275
|
+
The result looks like this:</p>
|
276
|
+
|
277
|
+
<pre class="code ruby"><code class="ruby">I, [2016-03-07T14:31:53.292843 #47956] INFO -- : {"sequence":"ade3605e40a4d5bf724c5f3d8e43420b","cmd":"CreateUserAction","depth":0,"kind":"command_input","msg":{"name":"Chris","email":"test@test.com","age":41}}
|
278
|
+
I, [2016-03-07T14:31:53.293007 #47956] INFO -- : {"sequence":"ade3605e40a4d5bf724c5f3d8e43420b","cmd":"CreateUserAction","depth":0,"kind":"info","msg":"start_transaction"}
|
279
|
+
I, [2016-03-07T14:31:53.308212 #47956] INFO -- : {"sequence":"ade3605e40a4d5bf724c5f3d8e43420b","cmd":"CreateUserAction","depth":0,"kind":"info","msg":"Saved user"}
|
280
|
+
I, [2016-03-07T14:31:53.308336 #47956] INFO -- : {"sequence":"ade3605e40a4d5bf724c5f3d8e43420b","cmd":"CreateUserAction","depth":0,"kind":"command_input","msg":{}}
|
281
|
+
I, [2016-03-07T14:31:53.308442 #47956] INFO -- : {"sequence":"ade3605e40a4d5bf724c5f3d8e43420b","cmd":"CreateUserAction","depth":0,"kind":"info","msg":"in child transaction"}
|
282
|
+
I, [2016-03-07T14:31:53.308504 #47956] INFO -- : {"sequence":"ade3605e40a4d5bf724c5f3d8e43420b","cmd":"CreateUserAction","depth":0,"kind":"command_output","msg":{}}
|
283
|
+
I, [2016-03-07T14:31:53.308562 #47956] INFO -- : {"sequence":"ade3605e40a4d5bf724c5f3d8e43420b","cmd":"CreateUserAction","depth":0,"kind":"info","msg":"end_transaction"}
|
284
|
+
I, [2016-03-07T14:31:53.308837 #47956] INFO -- : {"sequence":"ade3605e40a4d5bf724c5f3d8e43420b","cmd":"CreateUserAction","depth":0,"kind":"command_output","msg":{"user":{"email":"test@test.com","name":"Chris","age":41}}}</code></pre>
|
278
285
|
|
279
286
|
<p>You can also optionally add your own entries to the log by calling
|
280
287
|
<code>result.debug</code>, <code>result.info</code>, or
|
281
|
-
<code>result.failed</code>.
|
282
|
-
|
283
|
-
|
288
|
+
<code>result.failed</code>. You can pass these calls a string or a hash.</p>
|
289
|
+
|
290
|
+
<p>You can use the included LogParser to parse this log if you like, or you
|
291
|
+
can use the included PrettyPrintLogAction to print the log in a nested
|
292
|
+
plain text format, like:</p>
|
293
|
+
|
294
|
+
<pre class="code ruby"><code class="ruby">HelloWorldCommand (8d315fe58dab39cb4f23a9f4ef366c8b)
|
295
|
+
input:
|
296
|
+
name: Chris
|
297
|
+
Hello Chris
|
298
|
+
output:
|
299
|
+
greeting: Hello Chris</code></pre>
|
300
|
+
|
301
|
+
<h3 id="label-ActiveRecord+Transactions">ActiveRecord Transactions</h3>
|
302
|
+
|
303
|
+
<p>You can wrap your command contents in a transaction by subclassing
|
304
|
+
<code>ActionCommand::ExecutableTransaction</code>. You must explicitly
|
305
|
+
require <code>action_command/executable_transaction</code> to avoid a
|
306
|
+
default dependency on ActiveRecord.</p>
|
307
|
+
|
308
|
+
<p>If you call <code>result.failed</code> within a transaction, your
|
309
|
+
transaction will automatically be rolled back.</p>
|
310
|
+
|
311
|
+
<h3 id="label-Utilities">Utilities</h3>
|
312
|
+
|
313
|
+
<p>It is often useful to allow a single parameter to be either an integer
|
314
|
+
object id, an instance of the object itself, or a string used to lookup the
|
315
|
+
object (used in command-line rake tasks). You can do this using</p>
|
316
|
+
|
317
|
+
<pre class="code ruby"><code class="ruby"><span class='kw'>def</span> <span class='id identifier rubyid_execute_internal'>execute_internal</span><span class='lparen'>(</span><span class='id identifier rubyid_result'>result</span><span class='rparen'>)</span>
|
318
|
+
<span class='id identifier rubyid_user'>user</span> <span class='op'>=</span> <span class='const'>ActionCommand</span><span class='op'>::</span><span class='const'>Utils</span><span class='period'>.</span><span class='id identifier rubyid_find_object'>find_object</span><span class='lparen'>(</span><span class='const'>User</span><span class='comma'>,</span> <span class='ivar'>@user_id</span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_p'>p</span><span class='op'>|</span> <span class='const'>User</span><span class='period'>.</span><span class='id identifier rubyid_find_by_email'>find_by_email</span><span class='lparen'>(</span><span class='id identifier rubyid_p'>p</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
319
|
+
<span class='kw'>end</span>
|
320
|
+
</code></pre>
|
321
|
+
|
322
|
+
<p>This will user User.find if passed an Integer, will return a user object,
|
323
|
+
or will yield to the lookup otherwise.</p>
|
284
324
|
|
285
325
|
<h2 id="label-Development">Development</h2>
|
286
326
|
|
@@ -312,7 +352,7 @@ href="http://opensource.org/licenses/MIT">MIT License</a>.</p>
|
|
312
352
|
</div></div>
|
313
353
|
|
314
354
|
<div id="footer">
|
315
|
-
Generated on Mon
|
355
|
+
Generated on Mon May 16 08:49:38 2016 by
|
316
356
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
317
357
|
0.8.7.6 (ruby-2.2.3).
|
318
358
|
</div>
|
data/doc/method_list.html
CHANGED
@@ -160,14 +160,14 @@
|
|
160
160
|
|
161
161
|
|
162
162
|
<li class="r1 ">
|
163
|
-
<span class='object_link'><a href="ActionCommand/
|
164
|
-
<small>ActionCommand::
|
163
|
+
<span class='object_link'><a href="ActionCommand/Executable.html#execute-instance_method" title="ActionCommand::Executable#execute (method)">#execute</a></span>
|
164
|
+
<small>ActionCommand::Executable</small>
|
165
165
|
</li>
|
166
166
|
|
167
167
|
|
168
168
|
<li class="r2 ">
|
169
|
-
<span class='object_link'><a href="ActionCommand/
|
170
|
-
<small>ActionCommand::
|
169
|
+
<span class='object_link'><a href="ActionCommand/ExecutableTransaction.html#execute-instance_method" title="ActionCommand::ExecutableTransaction#execute (method)">#execute</a></span>
|
170
|
+
<small>ActionCommand::ExecutableTransaction</small>
|
171
171
|
</li>
|
172
172
|
|
173
173
|
|
@@ -238,26 +238,26 @@
|
|
238
238
|
|
239
239
|
|
240
240
|
<li class="r2 ">
|
241
|
-
<span class='object_link'><a href="ActionCommand/
|
242
|
-
<small>ActionCommand::
|
241
|
+
<span class='object_link'><a href="ActionCommand/Result.html#initialize-instance_method" title="ActionCommand::Result#initialize (method)">#initialize</a></span>
|
242
|
+
<small>ActionCommand::Result</small>
|
243
243
|
</li>
|
244
244
|
|
245
245
|
|
246
246
|
<li class="r1 ">
|
247
|
-
<span class='object_link'><a href="ActionCommand/
|
248
|
-
<small>ActionCommand::
|
247
|
+
<span class='object_link'><a href="ActionCommand/LogParser.html#initialize-instance_method" title="ActionCommand::LogParser#initialize (method)">#initialize</a></span>
|
248
|
+
<small>ActionCommand::LogParser</small>
|
249
249
|
</li>
|
250
250
|
|
251
251
|
|
252
252
|
<li class="r2 ">
|
253
|
-
<span class='object_link'><a href="ActionCommand/
|
254
|
-
<small>ActionCommand::
|
253
|
+
<span class='object_link'><a href="ActionCommand/InputOutput.html#initialize-instance_method" title="ActionCommand::InputOutput#initialize (method)">#initialize</a></span>
|
254
|
+
<small>ActionCommand::InputOutput</small>
|
255
255
|
</li>
|
256
256
|
|
257
257
|
|
258
258
|
<li class="r1 ">
|
259
|
-
<span class='object_link'><a href="ActionCommand/
|
260
|
-
<small>ActionCommand::
|
259
|
+
<span class='object_link'><a href="ActionCommand/Executable.html#initialize-instance_method" title="ActionCommand::Executable#initialize (method)">#initialize</a></span>
|
260
|
+
<small>ActionCommand::Executable</small>
|
261
261
|
</li>
|
262
262
|
|
263
263
|
|
@@ -286,14 +286,14 @@
|
|
286
286
|
|
287
287
|
|
288
288
|
<li class="r2 ">
|
289
|
-
<span class='object_link'><a href="ActionCommand/
|
290
|
-
<small>ActionCommand::
|
289
|
+
<span class='object_link'><a href="ActionCommand/Result.html#key%3F-instance_method" title="ActionCommand::Result#key? (method)">#key?</a></span>
|
290
|
+
<small>ActionCommand::Result</small>
|
291
291
|
</li>
|
292
292
|
|
293
293
|
|
294
294
|
<li class="r1 ">
|
295
|
-
<span class='object_link'><a href="ActionCommand/
|
296
|
-
<small>ActionCommand::
|
295
|
+
<span class='object_link'><a href="ActionCommand/LogMessage.html#key%3F-instance_method" title="ActionCommand::LogMessage#key? (method)">#key?</a></span>
|
296
|
+
<small>ActionCommand::LogMessage</small>
|
297
297
|
</li>
|
298
298
|
|
299
299
|
|
@@ -316,210 +316,216 @@
|
|
316
316
|
|
317
317
|
|
318
318
|
<li class="r1 ">
|
319
|
+
<span class='object_link'><a href="ActionCommand/Result.html#last_error-instance_method" title="ActionCommand::Result#last_error (method)">#last_error</a></span>
|
320
|
+
<small>ActionCommand::Result</small>
|
321
|
+
</li>
|
322
|
+
|
323
|
+
|
324
|
+
<li class="r2 ">
|
319
325
|
<span class='object_link'><a href="ActionCommand/LogMessage.html#line-instance_method" title="ActionCommand::LogMessage#line (method)">#line</a></span>
|
320
326
|
<small>ActionCommand::LogMessage</small>
|
321
327
|
</li>
|
322
328
|
|
323
329
|
|
324
|
-
<li class="
|
330
|
+
<li class="r1 ">
|
325
331
|
<span class='object_link'><a href="ActionCommand/Result.html#log_input-instance_method" title="ActionCommand::Result#log_input (method)">#log_input</a></span>
|
326
332
|
<small>ActionCommand::Result</small>
|
327
333
|
</li>
|
328
334
|
|
329
335
|
|
330
|
-
<li class="
|
336
|
+
<li class="r2 ">
|
331
337
|
<span class='object_link'><a href="ActionCommand/Result.html#log_output-instance_method" title="ActionCommand::Result#log_output (method)">#log_output</a></span>
|
332
338
|
<small>ActionCommand::Result</small>
|
333
339
|
</li>
|
334
340
|
|
335
341
|
|
336
|
-
<li class="
|
342
|
+
<li class="r1 ">
|
337
343
|
<span class='object_link'><a href="ActionCommand/Result.html#logger%3D-instance_method" title="ActionCommand::Result#logger= (method)">#logger=</a></span>
|
338
344
|
<small>ActionCommand::Result</small>
|
339
345
|
</li>
|
340
346
|
|
341
347
|
|
342
|
-
<li class="
|
348
|
+
<li class="r2 ">
|
343
349
|
<span class='object_link'><a href="ActionCommand.html#logger%3D-class_method" title="ActionCommand.logger= (method)">logger=</a></span>
|
344
350
|
<small>ActionCommand</small>
|
345
351
|
</li>
|
346
352
|
|
347
353
|
|
348
|
-
<li class="
|
354
|
+
<li class="r1 ">
|
349
355
|
<span class='object_link'><a href="ActionCommand/Result.html#logging%3F-instance_method" title="ActionCommand::Result#logging? (method)">#logging?</a></span>
|
350
356
|
<small>ActionCommand::Result</small>
|
351
357
|
</li>
|
352
358
|
|
353
359
|
|
354
|
-
<li class="
|
360
|
+
<li class="r2 ">
|
355
361
|
<span class='object_link'><a href="ActionCommand/LogMessage.html#match_message%3F-instance_method" title="ActionCommand::LogMessage#match_message? (method)">#match_message?</a></span>
|
356
362
|
<small>ActionCommand::LogMessage</small>
|
357
363
|
</li>
|
358
364
|
|
359
365
|
|
360
|
-
<li class="
|
366
|
+
<li class="r1 ">
|
361
367
|
<span class='object_link'><a href="ActionCommand/LogMessage.html#msg-instance_method" title="ActionCommand::LogMessage#msg (method)">#msg</a></span>
|
362
368
|
<small>ActionCommand::LogMessage</small>
|
363
369
|
</li>
|
364
370
|
|
365
371
|
|
366
|
-
<li class="
|
372
|
+
<li class="r2 ">
|
367
373
|
<span class='object_link'><a href="ActionCommand/LogParser.html#next-instance_method" title="ActionCommand::LogParser#next (method)">#next</a></span>
|
368
374
|
<small>ActionCommand::LogParser</small>
|
369
375
|
</li>
|
370
376
|
|
371
377
|
|
372
|
-
<li class="
|
378
|
+
<li class="r1 ">
|
373
379
|
<span class='object_link'><a href="ActionCommand/Result.html#ok%3F-instance_method" title="ActionCommand::Result#ok? (method)">#ok?</a></span>
|
374
380
|
<small>ActionCommand::Result</small>
|
375
381
|
</li>
|
376
382
|
|
377
383
|
|
378
|
-
<li class="
|
384
|
+
<li class="r2 ">
|
379
385
|
<span class='object_link'><a href="ActionCommand/InputOutput.html#output-instance_method" title="ActionCommand::InputOutput#output (method)">#output</a></span>
|
380
386
|
<small>ActionCommand::InputOutput</small>
|
381
387
|
</li>
|
382
388
|
|
383
389
|
|
384
|
-
<li class="
|
390
|
+
<li class="r1 ">
|
385
391
|
<span class='object_link'><a href="ActionCommand/Executable.html#parent-instance_method" title="ActionCommand::Executable#parent (method)">#parent</a></span>
|
386
392
|
<small>ActionCommand::Executable</small>
|
387
393
|
</li>
|
388
394
|
|
389
395
|
|
390
|
-
<li class="
|
396
|
+
<li class="r2 ">
|
391
397
|
<span class='object_link'><a href="ActionCommand/Result.html#pop-instance_method" title="ActionCommand::Result#pop (method)">#pop</a></span>
|
392
398
|
<small>ActionCommand::Result</small>
|
393
399
|
</li>
|
394
400
|
|
395
401
|
|
396
|
-
<li class="
|
402
|
+
<li class="r1 ">
|
397
403
|
<span class='object_link'><a href="ActionCommand/LogMessage.html#populate-instance_method" title="ActionCommand::LogMessage#populate (method)">#populate</a></span>
|
398
404
|
<small>ActionCommand::LogMessage</small>
|
399
405
|
</li>
|
400
406
|
|
401
407
|
|
402
|
-
<li class="
|
408
|
+
<li class="r2 ">
|
403
409
|
<span class='object_link'><a href="ActionCommand/InputOutput.html#print_output-instance_method" title="ActionCommand::InputOutput#print_output (method)">#print_output</a></span>
|
404
410
|
<small>ActionCommand::InputOutput</small>
|
405
411
|
</li>
|
406
412
|
|
407
413
|
|
408
|
-
<li class="
|
414
|
+
<li class="r1 ">
|
409
415
|
<span class='object_link'><a href="ActionCommand/InputOutput.html#process_input-instance_method" title="ActionCommand::InputOutput#process_input (method)">#process_input</a></span>
|
410
416
|
<small>ActionCommand::InputOutput</small>
|
411
417
|
</li>
|
412
418
|
|
413
419
|
|
414
|
-
<li class="
|
420
|
+
<li class="r2 ">
|
415
421
|
<span class='object_link'><a href="ActionCommand/InputOutput.html#process_output-instance_method" title="ActionCommand::InputOutput#process_output (method)">#process_output</a></span>
|
416
422
|
<small>ActionCommand::InputOutput</small>
|
417
423
|
</li>
|
418
424
|
|
419
425
|
|
420
|
-
<li class="
|
426
|
+
<li class="r1 ">
|
421
427
|
<span class='object_link'><a href="ActionCommand/Result.html#push-instance_method" title="ActionCommand::Result#push (method)">#push</a></span>
|
422
428
|
<small>ActionCommand::Result</small>
|
423
429
|
</li>
|
424
430
|
|
425
431
|
|
426
|
-
<li class="
|
432
|
+
<li class="r2 ">
|
427
433
|
<span class='object_link'><a href="ActionCommand/Executable.html#rails_context%3F-instance_method" title="ActionCommand::Executable#rails_context? (method)">#rails_context?</a></span>
|
428
434
|
<small>ActionCommand::Executable</small>
|
429
435
|
</li>
|
430
436
|
|
431
437
|
|
432
|
-
<li class="
|
438
|
+
<li class="r1 ">
|
433
439
|
<span class='object_link'><a href="ActionCommand/Executable.html#rake_context%3F-instance_method" title="ActionCommand::Executable#rake_context? (method)">#rake_context?</a></span>
|
434
440
|
<small>ActionCommand::Executable</small>
|
435
441
|
</li>
|
436
442
|
|
437
443
|
|
438
|
-
<li class="
|
444
|
+
<li class="r2 ">
|
439
445
|
<span class='object_link'><a href="ActionCommand/InputOutput.html#rake_input-instance_method" title="ActionCommand::InputOutput#rake_input (method)">#rake_input</a></span>
|
440
446
|
<small>ActionCommand::InputOutput</small>
|
441
447
|
</li>
|
442
448
|
|
443
449
|
|
444
|
-
<li class="
|
450
|
+
<li class="r1 ">
|
445
451
|
<span class='object_link'><a href="ActionCommand/Result.html#result_code-instance_method" title="ActionCommand::Result#result_code (method)">#result_code</a></span>
|
446
452
|
<small>ActionCommand::Result</small>
|
447
453
|
</li>
|
448
454
|
|
449
455
|
|
450
|
-
<li class="
|
456
|
+
<li class="r2 ">
|
451
457
|
<span class='object_link'><a href="ActionCommand/LogMessage.html#root%3F-instance_method" title="ActionCommand::LogMessage#root? (method)">#root?</a></span>
|
452
458
|
<small>ActionCommand::LogMessage</small>
|
453
459
|
</li>
|
454
460
|
|
455
461
|
|
456
|
-
<li class="
|
462
|
+
<li class="r1 ">
|
457
463
|
<span class='object_link'><a href="ActionCommand/Result.html#root_command-instance_method" title="ActionCommand::Result#root_command (method)">#root_command</a></span>
|
458
464
|
<small>ActionCommand::Result</small>
|
459
465
|
</li>
|
460
466
|
|
461
467
|
|
462
|
-
<li class="
|
468
|
+
<li class="r2 ">
|
463
469
|
<span class='object_link'><a href="ActionCommand/Executable.html#root_context-instance_method" title="ActionCommand::Executable#root_context (method)">#root_context</a></span>
|
464
470
|
<small>ActionCommand::Executable</small>
|
465
471
|
</li>
|
466
472
|
|
467
473
|
|
468
|
-
<li class="
|
469
|
-
<span class='object_link'><a href="ActionCommand/
|
470
|
-
<small>ActionCommand::
|
474
|
+
<li class="r1 ">
|
475
|
+
<span class='object_link'><a href="ActionCommand/LogMessage.html#sequence-instance_method" title="ActionCommand::LogMessage#sequence (method)">#sequence</a></span>
|
476
|
+
<small>ActionCommand::LogMessage</small>
|
471
477
|
</li>
|
472
478
|
|
473
479
|
|
474
|
-
<li class="
|
480
|
+
<li class="r2 ">
|
475
481
|
<span class='object_link'><a href="ActionCommand/PrettyPrintLogAction.html#sequence-instance_method" title="ActionCommand::PrettyPrintLogAction#sequence (method)">#sequence</a></span>
|
476
482
|
<small>ActionCommand::PrettyPrintLogAction</small>
|
477
483
|
</li>
|
478
484
|
|
479
485
|
|
480
|
-
<li class="
|
481
|
-
<span class='object_link'><a href="ActionCommand/
|
482
|
-
<small>ActionCommand::
|
486
|
+
<li class="r1 ">
|
487
|
+
<span class='object_link'><a href="ActionCommand/Result.html#sequence-instance_method" title="ActionCommand::Result#sequence (method)">#sequence</a></span>
|
488
|
+
<small>ActionCommand::Result</small>
|
483
489
|
</li>
|
484
490
|
|
485
491
|
|
486
|
-
<li class="
|
492
|
+
<li class="r2 ">
|
487
493
|
<span class='object_link'><a href="ActionCommand/InputOutput.html#should_validate-instance_method" title="ActionCommand::InputOutput#should_validate (method)">#should_validate</a></span>
|
488
494
|
<small>ActionCommand::InputOutput</small>
|
489
495
|
</li>
|
490
496
|
|
491
497
|
|
492
|
-
<li class="
|
498
|
+
<li class="r1 ">
|
493
499
|
<span class='object_link'><a href="ActionCommand/InputOutput.html#show_help-instance_method" title="ActionCommand::InputOutput#show_help (method)">#show_help</a></span>
|
494
500
|
<small>ActionCommand::InputOutput</small>
|
495
501
|
</li>
|
496
502
|
|
497
503
|
|
498
|
-
<li class="
|
504
|
+
<li class="r2 ">
|
499
505
|
<span class='object_link'><a href="ActionCommand/PrettyPrintLogAction.html#source-instance_method" title="ActionCommand::PrettyPrintLogAction#source (method)">#source</a></span>
|
500
506
|
<small>ActionCommand::PrettyPrintLogAction</small>
|
501
507
|
</li>
|
502
508
|
|
503
509
|
|
504
|
-
<li class="
|
510
|
+
<li class="r1 ">
|
505
511
|
<span class='object_link'><a href="ActionCommand/Executable.html#test-instance_method" title="ActionCommand::Executable#test (method)">#test</a></span>
|
506
512
|
<small>ActionCommand::Executable</small>
|
507
513
|
</li>
|
508
514
|
|
509
515
|
|
510
|
-
<li class="
|
516
|
+
<li class="r2 ">
|
511
517
|
<span class='object_link'><a href="ActionCommand/Executable.html#test_context%3F-instance_method" title="ActionCommand::Executable#test_context? (method)">#test_context?</a></span>
|
512
518
|
<small>ActionCommand::Executable</small>
|
513
519
|
</li>
|
514
520
|
|
515
521
|
|
516
|
-
<li class="
|
522
|
+
<li class="r1 ">
|
517
523
|
<span class='object_link'><a href="ActionCommand/Executable.html#testing-instance_method" title="ActionCommand::Executable#testing (method)">#testing</a></span>
|
518
524
|
<small>ActionCommand::Executable</small>
|
519
525
|
</li>
|
520
526
|
|
521
527
|
|
522
|
-
<li class="
|
528
|
+
<li class="r2 ">
|
523
529
|
<span class='object_link'><a href="ActionCommand/InputOutput.html#validate_input-instance_method" title="ActionCommand::InputOutput#validate_input (method)">#validate_input</a></span>
|
524
530
|
<small>ActionCommand::InputOutput</small>
|
525
531
|
</li>
|
@@ -103,7 +103,7 @@
|
|
103
103
|
</div>
|
104
104
|
|
105
105
|
<div id="footer">
|
106
|
-
Generated on Mon
|
106
|
+
Generated on Mon May 16 08:49:39 2016 by
|
107
107
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
108
108
|
0.8.7.6 (ruby-2.2.3).
|
109
109
|
</div>
|
@@ -7,6 +7,7 @@ module ActionCommand
|
|
7
7
|
# By default, a command is ok?
|
8
8
|
def initialize
|
9
9
|
@result_code = RESULT_CODE_OK
|
10
|
+
@last_error = nil
|
10
11
|
@values = [{}]
|
11
12
|
@logger = nil
|
12
13
|
end
|
@@ -52,6 +53,7 @@ module ActionCommand
|
|
52
53
|
# @param msg [String] message describing the failure.
|
53
54
|
def failed(msg)
|
54
55
|
@result_code = RESULT_CODE_FAILED
|
56
|
+
@last_error = msg
|
55
57
|
error(msg)
|
56
58
|
end
|
57
59
|
|
@@ -61,6 +63,7 @@ module ActionCommand
|
|
61
63
|
# @param result_code [Integer]
|
62
64
|
def failed_with_code(msg, result_code)
|
63
65
|
@result_code = result_code
|
66
|
+
@last_error = msg
|
64
67
|
error(msg)
|
65
68
|
end
|
66
69
|
|
@@ -72,6 +75,9 @@ module ActionCommand
|
|
72
75
|
# @return [Integer] the current result code
|
73
76
|
attr_reader :result_code
|
74
77
|
|
78
|
+
# @return [String] the last string error message
|
79
|
+
attr_reader :last_error
|
80
|
+
|
75
81
|
# adds results under the subkey until pop is called
|
76
82
|
def push(key, cmd)
|
77
83
|
return unless key
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: action_command
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Jones
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-05-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|