rbatch 1.4.0 → 1.4.3

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.
Files changed (58) hide show
  1. data/LICENSE +0 -0
  2. data/README.ja.md +1 -13
  3. data/README.md +2 -13
  4. data/Rakefile +1 -24
  5. metadata +12 -123
  6. data/CHANGELOG +0 -25
  7. data/VERSION +0 -1
  8. data/doc/rdoc/CHANGELOG.html +0 -160
  9. data/doc/rdoc/LICENSE.html +0 -94
  10. data/doc/rdoc/RBatch/Cmd.html +0 -329
  11. data/doc/rdoc/RBatch/CmdException.html +0 -154
  12. data/doc/rdoc/RBatch/CmdResult.html +0 -492
  13. data/doc/rdoc/RBatch/Log.html +0 -739
  14. data/doc/rdoc/RBatch.html +0 -476
  15. data/doc/rdoc/created.rid +0 -8
  16. data/doc/rdoc/images/brick.png +0 -0
  17. data/doc/rdoc/images/brick_link.png +0 -0
  18. data/doc/rdoc/images/bug.png +0 -0
  19. data/doc/rdoc/images/bullet_black.png +0 -0
  20. data/doc/rdoc/images/bullet_toggle_minus.png +0 -0
  21. data/doc/rdoc/images/bullet_toggle_plus.png +0 -0
  22. data/doc/rdoc/images/date.png +0 -0
  23. data/doc/rdoc/images/find.png +0 -0
  24. data/doc/rdoc/images/loadingAnimation.gif +0 -0
  25. data/doc/rdoc/images/macFFBgHack.png +0 -0
  26. data/doc/rdoc/images/package.png +0 -0
  27. data/doc/rdoc/images/page_green.png +0 -0
  28. data/doc/rdoc/images/page_white_text.png +0 -0
  29. data/doc/rdoc/images/page_white_width.png +0 -0
  30. data/doc/rdoc/images/plugin.png +0 -0
  31. data/doc/rdoc/images/ruby.png +0 -0
  32. data/doc/rdoc/images/tag_green.png +0 -0
  33. data/doc/rdoc/images/wrench.png +0 -0
  34. data/doc/rdoc/images/wrench_orange.png +0 -0
  35. data/doc/rdoc/images/zoom.png +0 -0
  36. data/doc/rdoc/index.html +0 -124
  37. data/doc/rdoc/js/darkfish.js +0 -116
  38. data/doc/rdoc/js/jquery.js +0 -32
  39. data/doc/rdoc/js/quicksearch.js +0 -114
  40. data/doc/rdoc/js/thickbox-compressed.js +0 -10
  41. data/doc/rdoc/lib/rbatch/cmd_rb.html +0 -56
  42. data/doc/rdoc/lib/rbatch/config_rb.html +0 -56
  43. data/doc/rdoc/lib/rbatch/log_rb.html +0 -58
  44. data/doc/rdoc/lib/rbatch_rb.html +0 -58
  45. data/doc/rdoc/rdoc.css +0 -706
  46. data/sample/bin/file_batch_copy.rb +0 -9
  47. data/sample/bin/openldap_backup.rb +0 -7
  48. data/sample/bin/test.rb +0 -12
  49. data/sample/config/file_batch_copy.yaml +0 -5
  50. data/sample/config/openldap_backup.yaml +0 -2
  51. data/sample/config/rbatch.yaml +0 -68
  52. data/sample/log/empty +0 -0
  53. data/test/cases/test_cmd.rb +0 -120
  54. data/test/cases/test_config.rb +0 -34
  55. data/test/cases/test_log.rb +0 -594
  56. data/test/config/rbatch.yaml +0 -0
  57. data/test/mocks/PrintArgs.exe +0 -0
  58. data/test/mocks/win_cmd.exe +0 -0
@@ -1,329 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
- <head>
6
- <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
7
-
8
- <title>Class: RBatch::Cmd</title>
9
-
10
- <link rel="stylesheet" href="../rdoc.css" type="text/css" media="screen" />
11
-
12
- <script src="../js/jquery.js" type="text/javascript"
13
- charset="utf-8"></script>
14
- <script src="../js/thickbox-compressed.js" type="text/javascript"
15
- charset="utf-8"></script>
16
- <script src="../js/quicksearch.js" type="text/javascript"
17
- charset="utf-8"></script>
18
- <script src="../js/darkfish.js" type="text/javascript"
19
- charset="utf-8"></script>
20
-
21
- </head>
22
- <body class="class">
23
-
24
- <div id="metadata">
25
- <div id="home-metadata">
26
- <div id="home-section" class="section">
27
- <h3 class="section-header">
28
- <a href="../index.html">Home</a>
29
- <a href="../index.html#classes">Classes</a>
30
- <a href="../index.html#methods">Methods</a>
31
- </h3>
32
- </div>
33
- </div>
34
-
35
- <div id="file-metadata">
36
- <div id="file-list-section" class="section">
37
- <h3 class="section-header">In Files</h3>
38
- <div class="section-body">
39
- <ul>
40
-
41
- <li><a href="../lib/rbatch/cmd_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
42
- class="thickbox" title="lib/rbatch/cmd.rb">lib/rbatch/cmd.rb</a></li>
43
-
44
- </ul>
45
- </div>
46
- </div>
47
-
48
-
49
- </div>
50
-
51
- <div id="class-metadata">
52
-
53
- <!-- Parent Class -->
54
-
55
- <div id="parent-class-section" class="section">
56
- <h3 class="section-header">Parent</h3>
57
-
58
- <p class="link">Object</p>
59
-
60
- </div>
61
-
62
-
63
- <!-- Namespace Contents -->
64
-
65
-
66
- <!-- Method Quickref -->
67
-
68
- <div id="method-list-section" class="section">
69
- <h3 class="section-header">Methods</h3>
70
- <ul class="link-list">
71
-
72
- <li><a href="#method-c-new">::new</a></li>
73
-
74
- <li><a href="#method-i-run">#run</a></li>
75
-
76
- </ul>
77
- </div>
78
-
79
-
80
- <!-- Included Modules -->
81
-
82
- </div>
83
-
84
- <div id="project-metadata">
85
-
86
-
87
- <div id="fileindex-section" class="section project-section">
88
- <h3 class="section-header">Files</h3>
89
- <ul>
90
-
91
- <li class="file"><a href="../CHANGELOG.html">CHANGELOG</a></li>
92
-
93
- <li class="file"><a href="../LICENSE.html">LICENSE</a></li>
94
-
95
- </ul>
96
- </div>
97
-
98
-
99
- <div id="classindex-section" class="section project-section">
100
- <h3 class="section-header">Class Index
101
- <span class="search-toggle"><img src="../images/find.png"
102
- height="16" width="16" alt="[+]"
103
- title="show/hide quicksearch" /></span></h3>
104
- <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
105
- <fieldset>
106
- <legend>Quicksearch</legend>
107
- <input type="text" name="quicksearch" value=""
108
- class="quicksearch-field" />
109
- </fieldset>
110
- </form>
111
-
112
- <ul class="link-list">
113
-
114
- <li><a href="../RBatch.html">RBatch</a></li>
115
-
116
- <li><a href="../RBatch/Cmd.html">RBatch::Cmd</a></li>
117
-
118
- <li><a href="../RBatch/CmdException.html">RBatch::CmdException</a></li>
119
-
120
- <li><a href="../RBatch/CmdResult.html">RBatch::CmdResult</a></li>
121
-
122
- <li><a href="../RBatch/Log.html">RBatch::Log</a></li>
123
-
124
- </ul>
125
- <div id="no-class-search-results" style="display: none;">No matching classes.</div>
126
- </div>
127
-
128
-
129
- </div>
130
- </div>
131
-
132
- <div id="documentation">
133
- <h1 class="class">RBatch::Cmd</h1>
134
-
135
- <div id="description">
136
- <p>
137
- External command runcher.
138
- </p>
139
- <ul>
140
- <li><p>
141
- Input cmd_params into Kernel#spawn.
142
- </p>
143
- </li>
144
- <li><p>
145
- Write command&#8217;s stdout and stderr to tmp file.
146
- </p>
147
- </li>
148
- </ul>
149
- <pre>
150
- * If Platform is &quot;mswin&quot; or &quot;mingw&quot; , then temp directory is ENV[&quot;TEMP&quot;]
151
- * If Platform is &quot;linux&quot; or &quot;cygwin&quot; , then temp directory is &quot;/tmp/&quot;
152
- </pre>
153
- <ul>
154
- <li><p>
155
- Return hash object including stdout, stderr, and exit status.
156
- </p>
157
- </li>
158
- </ul>
159
- <h4>Sample 1</h4>
160
- <pre>
161
- require 'rbatch'
162
- cmd = RBatch::Cmd(&quot;ls&quot;)
163
- r = cmd.run
164
- p r.stdout
165
- =&gt; &quot;fileA\nfileB\n&quot;
166
- </pre>
167
- <h4>Sample 2 ( Use option)</h4>
168
- <pre>
169
- cmd = RBatch::Cmd(&quot;ls&quot;, {:verbose =&gt; true})
170
- r = cmd.run
171
- </pre>
172
- <h4>Sample 3 ( Use alias)</h4>
173
- <pre>
174
- require 'rbatch'
175
- r = RBatch::cmd(&quot;ls&quot;)
176
- p r.stdout
177
- =&gt; &quot;fileA\nfileB\n&quot;</pre>
178
-
179
- </div>
180
-
181
- <!-- Constants -->
182
-
183
-
184
- <!-- Attributes -->
185
-
186
-
187
- <!-- Methods -->
188
-
189
- <div id="public-class-method-details" class="method-section section">
190
- <h3 class="section-header">Public Class Methods</h3>
191
-
192
-
193
- <div id="new-method" class="method-detail ">
194
- <a name="method-c-new"></a>
195
-
196
- <div class="method-heading">
197
-
198
- <span class="method-name">new</span><span
199
- class="method-args">(cmd_str,opt = nil)</span>
200
- <span class="method-click-advice">click to toggle source</span>
201
-
202
- </div>
203
-
204
- <div class="method-description">
205
-
206
- <p>
207
- <a href="Cmd.html">Cmd</a> instance
208
- </p>
209
- <h4>Params</h4>
210
- <p>
211
- <tt>cmd_str</tt> = Command string. Such ad &#8220;ls -l&#8221; <tt>opt</tt>
212
- = Option hash object. Hash keys is follows.
213
- </p>
214
- <ul>
215
- <li><p>
216
- <tt>:raise</tt> (Boolean) = If command exit status is not 0, raise
217
- exception. Default is false.
218
- </p>
219
- </li>
220
- </ul>
221
-
222
-
223
-
224
- <div class="method-source-code"
225
- id="new-source">
226
- <pre>
227
- <span class="ruby-comment cmt"># File lib/rbatch/cmd.rb, line 44</span>
228
- 44: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">cmd_str</span>,<span class="ruby-identifier">opt</span> = <span class="ruby-keyword kw">nil</span>)
229
- 45: <span class="ruby-identifier">raise</span>(<span class="ruby-constant">CmdException</span>,<span class="ruby-value str">&quot;Command string is nil&quot;</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">cmd_str</span>.<span class="ruby-identifier">nil?</span>
230
- 46: <span class="ruby-ivar">@cmd_str</span> = <span class="ruby-identifier">cmd_str</span>
231
- 47: <span class="ruby-comment cmt"># parse option</span>
232
- 48: <span class="ruby-ivar">@opt</span> = <span class="ruby-identifier">@@def_opt</span>.<span class="ruby-identifier">clone</span>
233
- 49: <span class="ruby-identifier">@@def_opt</span>.<span class="ruby-identifier">each_key</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span><span class="ruby-operator">|</span>
234
- 50: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">opt</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">opt</span>[<span class="ruby-identifier">key</span>] <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
235
- 51: <span class="ruby-comment cmt"># use argument</span>
236
- 52: <span class="ruby-ivar">@opt</span>[<span class="ruby-identifier">key</span>] = <span class="ruby-identifier">opt</span>[<span class="ruby-identifier">key</span>]
237
- 53: <span class="ruby-keyword kw">elsif</span> <span class="ruby-constant">RBatch</span>.<span class="ruby-identifier">common_config</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-constant">RBatch</span>.<span class="ruby-identifier">common_config</span>[<span class="ruby-value str">&quot;cmd_&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">key</span>.<span class="ruby-identifier">to_s</span>] <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
238
- 54: <span class="ruby-comment cmt"># use config</span>
239
- 55: <span class="ruby-ivar">@opt</span>[<span class="ruby-identifier">key</span>] = <span class="ruby-constant">RBatch</span>.<span class="ruby-identifier">common_config</span>[<span class="ruby-value str">&quot;cmd_&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">key</span>.<span class="ruby-identifier">to_s</span>]
240
- 56: <span class="ruby-keyword kw">else</span>
241
- 57: <span class="ruby-comment cmt"># use default</span>
242
- 58: <span class="ruby-keyword kw">end</span>
243
- 59: <span class="ruby-keyword kw">end</span>
244
- 60: <span class="ruby-keyword kw">end</span></pre>
245
- </div>
246
-
247
- </div>
248
-
249
-
250
-
251
-
252
- </div>
253
-
254
-
255
- </div>
256
-
257
- <div id="public-instance-method-details" class="method-section section">
258
- <h3 class="section-header">Public Instance Methods</h3>
259
-
260
-
261
- <div id="run-method" class="method-detail ">
262
- <a name="method-i-run"></a>
263
-
264
- <div class="method-heading">
265
-
266
- <span class="method-name">run</span><span
267
- class="method-args">()</span>
268
- <span class="method-click-advice">click to toggle source</span>
269
-
270
- </div>
271
-
272
- <div class="method-description">
273
-
274
- <p>
275
- Run command
276
- </p>
277
- <h4>Return</h4>
278
- <p>
279
- instance of <a href="CmdResult.html">RBatch::CmdResult</a>
280
- </p>
281
-
282
-
283
-
284
- <div class="method-source-code"
285
- id="run-source">
286
- <pre>
287
- <span class="ruby-comment cmt"># File lib/rbatch/cmd.rb, line 67</span>
288
- 67: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">run</span>()
289
- 68: <span class="ruby-identifier">stdout_file</span> = <span class="ruby-constant">Tempfile</span><span class="ruby-operator">::</span><span class="ruby-identifier">new</span>(<span class="ruby-value str">&quot;rbatch_tmpout&quot;</span>,<span class="ruby-constant">RBatch</span><span class="ruby-operator">::</span><span class="ruby-identifier">tmp_dir</span>)
290
- 69: <span class="ruby-identifier">stderr_file</span> = <span class="ruby-constant">Tempfile</span><span class="ruby-operator">::</span><span class="ruby-identifier">new</span>(<span class="ruby-value str">&quot;rbatch_tmperr&quot;</span>,<span class="ruby-constant">RBatch</span><span class="ruby-operator">::</span><span class="ruby-identifier">tmp_dir</span>)
291
- 70: <span class="ruby-identifier">pid</span> = <span class="ruby-identifier">spawn</span>(<span class="ruby-ivar">@cmd_str</span>,<span class="ruby-value">:out</span> =<span class="ruby-operator">&gt;</span> [<span class="ruby-identifier">stdout_file</span>,<span class="ruby-value str">&quot;w&quot;</span>],<span class="ruby-value">:err</span> =<span class="ruby-operator">&gt;</span> [<span class="ruby-identifier">stderr_file</span>,<span class="ruby-value str">&quot;w&quot;</span>])
292
- 71: <span class="ruby-identifier">status</span> = <span class="ruby-constant">Process</span>.<span class="ruby-identifier">waitpid2</span>(<span class="ruby-identifier">pid</span>)[<span class="ruby-value">1</span>] <span class="ruby-operator">&gt;&gt;</span> <span class="ruby-value">8</span>
293
- 72: <span class="ruby-identifier">result</span> = <span class="ruby-constant">RBatch</span><span class="ruby-operator">::</span><span class="ruby-constant">CmdResult</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">stdout_file</span>,<span class="ruby-identifier">stderr_file</span>,<span class="ruby-identifier">status</span>,<span class="ruby-ivar">@cmd_str</span>)
294
- 73: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@opt</span>[<span class="ruby-value">:raise</span>] <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">status</span> <span class="ruby-operator">!=</span> <span class="ruby-value">0</span>
295
- 74: <span class="ruby-identifier">raise</span>(<span class="ruby-constant">CmdException</span>,<span class="ruby-value str">&quot;Command exit status is not 0. result: &quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">result</span>.<span class="ruby-identifier">to_s</span>)
296
- 75: <span class="ruby-keyword kw">end</span>
297
- 76: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">result</span>
298
- 77: <span class="ruby-keyword kw">end</span></pre>
299
- </div>
300
-
301
- </div>
302
-
303
-
304
-
305
-
306
- </div>
307
-
308
-
309
- </div>
310
-
311
-
312
- </div>
313
-
314
-
315
- <div id="rdoc-debugging-section-dump" class="debugging-section">
316
-
317
- <p>Disabled; run with --debug to generate this.</p>
318
-
319
- </div>
320
-
321
- <div id="validator-badges">
322
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
323
- <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
324
- Rdoc Generator</a> 1.1.6</small>.</p>
325
- </div>
326
-
327
- </body>
328
- </html>
329
-
@@ -1,154 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
- <head>
6
- <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
7
-
8
- <title>Class: RBatch::CmdException</title>
9
-
10
- <link rel="stylesheet" href="../rdoc.css" type="text/css" media="screen" />
11
-
12
- <script src="../js/jquery.js" type="text/javascript"
13
- charset="utf-8"></script>
14
- <script src="../js/thickbox-compressed.js" type="text/javascript"
15
- charset="utf-8"></script>
16
- <script src="../js/quicksearch.js" type="text/javascript"
17
- charset="utf-8"></script>
18
- <script src="../js/darkfish.js" type="text/javascript"
19
- charset="utf-8"></script>
20
-
21
- </head>
22
- <body class="class">
23
-
24
- <div id="metadata">
25
- <div id="home-metadata">
26
- <div id="home-section" class="section">
27
- <h3 class="section-header">
28
- <a href="../index.html">Home</a>
29
- <a href="../index.html#classes">Classes</a>
30
- <a href="../index.html#methods">Methods</a>
31
- </h3>
32
- </div>
33
- </div>
34
-
35
- <div id="file-metadata">
36
- <div id="file-list-section" class="section">
37
- <h3 class="section-header">In Files</h3>
38
- <div class="section-body">
39
- <ul>
40
-
41
- <li><a href="../lib/rbatch/cmd_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
42
- class="thickbox" title="lib/rbatch/cmd.rb">lib/rbatch/cmd.rb</a></li>
43
-
44
- </ul>
45
- </div>
46
- </div>
47
-
48
-
49
- </div>
50
-
51
- <div id="class-metadata">
52
-
53
- <!-- Parent Class -->
54
-
55
- <div id="parent-class-section" class="section">
56
- <h3 class="section-header">Parent</h3>
57
-
58
- <p class="link">Exception</p>
59
-
60
- </div>
61
-
62
-
63
- <!-- Namespace Contents -->
64
-
65
-
66
- <!-- Method Quickref -->
67
-
68
-
69
- <!-- Included Modules -->
70
-
71
- </div>
72
-
73
- <div id="project-metadata">
74
-
75
-
76
- <div id="fileindex-section" class="section project-section">
77
- <h3 class="section-header">Files</h3>
78
- <ul>
79
-
80
- <li class="file"><a href="../CHANGELOG.html">CHANGELOG</a></li>
81
-
82
- <li class="file"><a href="../LICENSE.html">LICENSE</a></li>
83
-
84
- </ul>
85
- </div>
86
-
87
-
88
- <div id="classindex-section" class="section project-section">
89
- <h3 class="section-header">Class Index
90
- <span class="search-toggle"><img src="../images/find.png"
91
- height="16" width="16" alt="[+]"
92
- title="show/hide quicksearch" /></span></h3>
93
- <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
94
- <fieldset>
95
- <legend>Quicksearch</legend>
96
- <input type="text" name="quicksearch" value=""
97
- class="quicksearch-field" />
98
- </fieldset>
99
- </form>
100
-
101
- <ul class="link-list">
102
-
103
- <li><a href="../RBatch.html">RBatch</a></li>
104
-
105
- <li><a href="../RBatch/Cmd.html">RBatch::Cmd</a></li>
106
-
107
- <li><a href="../RBatch/CmdException.html">RBatch::CmdException</a></li>
108
-
109
- <li><a href="../RBatch/CmdResult.html">RBatch::CmdResult</a></li>
110
-
111
- <li><a href="../RBatch/Log.html">RBatch::Log</a></li>
112
-
113
- </ul>
114
- <div id="no-class-search-results" style="display: none;">No matching classes.</div>
115
- </div>
116
-
117
-
118
- </div>
119
- </div>
120
-
121
- <div id="documentation">
122
- <h1 class="class">RBatch::CmdException</h1>
123
-
124
- <div id="description">
125
-
126
- </div>
127
-
128
- <!-- Constants -->
129
-
130
-
131
- <!-- Attributes -->
132
-
133
-
134
- <!-- Methods -->
135
-
136
-
137
- </div>
138
-
139
-
140
- <div id="rdoc-debugging-section-dump" class="debugging-section">
141
-
142
- <p>Disabled; run with --debug to generate this.</p>
143
-
144
- </div>
145
-
146
- <div id="validator-badges">
147
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
148
- <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
149
- Rdoc Generator</a> 1.1.6</small>.</p>
150
- </div>
151
-
152
- </body>
153
- </html>
154
-