rbatch 1.6.3 → 1.6.4

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 (101) hide show
  1. data/Rakefile +2 -5
  2. data/doc/rdoc/CHANGELOG.html +182 -0
  3. data/doc/rdoc/LICENSE.html +98 -0
  4. data/doc/rdoc/RBatch/Cmd.html +333 -0
  5. data/doc/rdoc/RBatch/CmdException.html +158 -0
  6. data/doc/rdoc/RBatch/CmdResult.html +496 -0
  7. data/doc/rdoc/RBatch/Config/Exception.html +158 -0
  8. data/doc/rdoc/RBatch/Config.html +355 -0
  9. data/doc/rdoc/RBatch/Log.html +743 -0
  10. data/doc/rdoc/RBatch.html +457 -0
  11. data/doc/rdoc/created.rid +8 -0
  12. data/doc/rdoc/images/brick.png +0 -0
  13. data/doc/rdoc/images/brick_link.png +0 -0
  14. data/doc/rdoc/images/bug.png +0 -0
  15. data/doc/rdoc/images/bullet_black.png +0 -0
  16. data/doc/rdoc/images/bullet_toggle_minus.png +0 -0
  17. data/doc/rdoc/images/bullet_toggle_plus.png +0 -0
  18. data/doc/rdoc/images/date.png +0 -0
  19. data/doc/rdoc/images/find.png +0 -0
  20. data/doc/rdoc/images/loadingAnimation.gif +0 -0
  21. data/doc/rdoc/images/macFFBgHack.png +0 -0
  22. data/doc/rdoc/images/package.png +0 -0
  23. data/doc/rdoc/images/page_green.png +0 -0
  24. data/doc/rdoc/images/page_white_text.png +0 -0
  25. data/doc/rdoc/images/page_white_width.png +0 -0
  26. data/doc/rdoc/images/plugin.png +0 -0
  27. data/doc/rdoc/images/ruby.png +0 -0
  28. data/doc/rdoc/images/tag_green.png +0 -0
  29. data/doc/rdoc/images/wrench.png +0 -0
  30. data/doc/rdoc/images/wrench_orange.png +0 -0
  31. data/doc/rdoc/images/zoom.png +0 -0
  32. data/doc/rdoc/index.html +136 -0
  33. data/doc/rdoc/js/darkfish.js +116 -0
  34. data/doc/rdoc/js/jquery.js +32 -0
  35. data/doc/rdoc/js/quicksearch.js +114 -0
  36. data/doc/rdoc/js/thickbox-compressed.js +10 -0
  37. data/doc/rdoc/lib/rbatch/cmd_rb.html +56 -0
  38. data/doc/rdoc/lib/rbatch/config_rb.html +56 -0
  39. data/doc/rdoc/lib/rbatch/log_rb.html +58 -0
  40. data/doc/rdoc/lib/rbatch_rb.html +58 -0
  41. data/doc/rdoc/rdoc.css +706 -0
  42. data/sample/bin/apache_log_insert.rb +108 -0
  43. data/sample/bin/file_batch_copy.rb +13 -0
  44. data/sample/bin/mysql_data_backup.rb +42 -0
  45. data/sample/bin/openam_log_insert.rb +105 -0
  46. data/sample/bin/openldap_backup.rb +7 -0
  47. data/sample/bin/webagent_log_insert.rb +108 -0
  48. data/sample/conf/apache_log_insert.yaml +8 -0
  49. data/sample/conf/file_batch_copy.yaml +5 -0
  50. data/sample/conf/mysql_data_backup.yaml +5 -0
  51. data/sample/conf/openam_log_insert.yaml +35 -0
  52. data/sample/conf/openldap_backup.yaml +2 -0
  53. data/sample/conf/rbatch.yaml +68 -0
  54. data/sample/conf/test.yaml +5 -0
  55. data/sample/conf/webagent_log_insert.yaml +16 -0
  56. data/sample/data/access_log.1 +50 -0
  57. data/sample/data/access_log.2012-07-10 +50 -0
  58. data/sample/data/amAgent_localhost_80.log.1 +39 -0
  59. data/sample/data/amAgent_localhost_80.log.2012-07-10 +40 -0
  60. data/sample/data/amAuthentication.access.1 +30 -0
  61. data/sample/data/amAuthentication.access.2012-07-10 +30 -0
  62. data/sample/data/amAuthentication.error.1 +10 -0
  63. data/sample/data/amAuthentication.error.2012-07-10 +6 -0
  64. data/sample/log/20130120_apache_log_insert.log +171 -0
  65. data/sample/log/20130120_openam_log_insert.log +143 -0
  66. data/sample/log/20130121_apache_log_insert.log +103 -0
  67. data/sample/log/20130121_file_batch_copy.log +15 -0
  68. data/sample/log/20130121_openam_log_insert.log +39 -0
  69. data/sample/log/20130121_webagent_log_insert.log +432 -0
  70. data/sample/log/empty +0 -0
  71. data/sample/moto/README +16 -0
  72. data/sample/moto/auditlog.src.zip +0 -0
  73. data/sample/moto/build.gradle +106 -0
  74. data/sample/moto/gradle/wrapper/gradle-wrapper.jar +0 -0
  75. data/sample/moto/gradle/wrapper/gradle-wrapper.properties +7 -0
  76. data/sample/moto/gradle.properties +12 -0
  77. data/sample/moto/gradlew +164 -0
  78. data/sample/moto/gradlew.bat +90 -0
  79. data/sample/moto/settings.gradle +1 -0
  80. data/sample/moto/src/main/bin/delete_auditlog.sh +176 -0
  81. data/sample/moto/src/main/bin/delete_workflowinstances.sh +315 -0
  82. data/sample/moto/src/main/bin/import_auth_log.sh +23 -0
  83. data/sample/moto/src/main/etc/delete_auditlog.param +39 -0
  84. data/sample/moto/src/main/etc/delete_workflowinstances.param +30 -0
  85. data/sample/moto/src/main/etc/log4j.xml +28 -0
  86. data/sample/moto/src/main/etc/status.properties +27 -0
  87. data/sample/moto/src/main/etc/sysparam.properties +54 -0
  88. data/sample/moto/src/main/java/jp/ossc/imortAuditlog/DateUtil.java +48 -0
  89. data/sample/moto/src/main/java/jp/ossc/imortAuditlog/ImportAuthLogMain.java +36 -0
  90. data/sample/moto/src/main/java/jp/ossc/imortAuditlog/LogReader.java +521 -0
  91. data/sample/moto/src/main/java/jp/ossc/imortAuditlog/MysqlController.java +315 -0
  92. data/sample/moto/src/main/logrotate/delete_auditlog +6 -0
  93. data/sample/moto/src/main/logrotate/delete_workflowinstanceslog +6 -0
  94. data/sample/moto/src/main/sql/tables.sql +36 -0
  95. data/test/cases/test_cmd.rb +120 -0
  96. data/test/cases/test_config.rb +41 -0
  97. data/test/cases/test_log.rb +599 -0
  98. data/test/conf/rbatch.yaml +0 -0
  99. data/test/mocks/PrintArgs.exe +0 -0
  100. data/test/mocks/win_cmd.exe +0 -0
  101. metadata +100 -1
data/Rakefile CHANGED
@@ -7,14 +7,14 @@ require 'rake/testtask'
7
7
 
8
8
  spec = Gem::Specification.new do |s|
9
9
  s.name = 'rbatch'
10
- s.version = '1.6.3'
10
+ s.version = '1.6.4'
11
11
  s.extra_rdoc_files = ['README.md', 'LICENSE']
12
12
  s.summary = 'batch framework'
13
13
  s.description = ''
14
14
  s.author = 'fetaro'
15
15
  s.email = 'fetaro@gmail.com'
16
16
  s.homepage = 'https://github.com/fetaro/rbatch'
17
- s.files = %w(LICENSE README.md README.ja.md Rakefile) + Dir.glob("{bin,lib,spec}/**/*")
17
+ s.files = %w(LICENSE README.md README.ja.md Rakefile) + Dir.glob("{lib,test,sample,doc}/**/*")
18
18
  s.require_path = "lib"
19
19
 
20
20
  end
@@ -22,9 +22,6 @@ end
22
22
  Rake::GemPackageTask.new(spec) do |p|
23
23
  p.gem_spec = spec
24
24
  p.package_files.include("lib/**/*")
25
- p.package_files.include("sample/**/*")
26
- p.package_files.include("test/**/*")
27
- p.package_files.include("doc/**/*")
28
25
  p.need_tar = false
29
26
  p.need_zip = false
30
27
  end
@@ -0,0 +1,182 @@
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
+
5
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
6
+ <head>
7
+ <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
8
+
9
+ <title>File: CHANGELOG [RBatch Docs]</title>
10
+
11
+ <link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet" />
12
+
13
+ <script src="./js/jquery.js" type="text/javascript"
14
+ charset="utf-8"></script>
15
+ <script src="./js/thickbox-compressed.js" type="text/javascript"
16
+ charset="utf-8"></script>
17
+ <script src="./js/quicksearch.js" type="text/javascript"
18
+ charset="utf-8"></script>
19
+ <script src="./js/darkfish.js" type="text/javascript"
20
+ charset="utf-8"></script>
21
+ </head>
22
+
23
+ <body class="file">
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="project-metadata">
36
+
37
+
38
+ <div id="fileindex-section" class="section project-section">
39
+ <h3 class="section-header">Files</h3>
40
+ <ul>
41
+
42
+ <li class="file"><a href="./CHANGELOG.html">CHANGELOG</a></li>
43
+
44
+ <li class="file"><a href="./LICENSE.html">LICENSE</a></li>
45
+
46
+ </ul>
47
+ </div>
48
+
49
+
50
+ <div id="classindex-section" class="section project-section">
51
+ <h3 class="section-header">Class Index
52
+ <span class="search-toggle"><img src="./images/find.png"
53
+ height="16" width="16" alt="[+]"
54
+ title="show/hide quicksearch" /></span></h3>
55
+ <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
56
+ <fieldset>
57
+ <legend>Quicksearch</legend>
58
+ <input type="text" name="quicksearch" value=""
59
+ class="quicksearch-field" />
60
+ </fieldset>
61
+ </form>
62
+
63
+ <ul class="link-list">
64
+
65
+ <li><a href="./RBatch.html">RBatch</a></li>
66
+
67
+ <li><a href="./RBatch/Cmd.html">RBatch::Cmd</a></li>
68
+
69
+ <li><a href="./RBatch/CmdException.html">RBatch::CmdException</a></li>
70
+
71
+ <li><a href="./RBatch/CmdResult.html">RBatch::CmdResult</a></li>
72
+
73
+ <li><a href="./RBatch/Config.html">RBatch::Config</a></li>
74
+
75
+ <li><a href="./RBatch/Config/Exception.html">RBatch::Config::Exception</a></li>
76
+
77
+ <li><a href="./RBatch/Log.html">RBatch::Log</a></li>
78
+
79
+ </ul>
80
+ <div id="no-class-search-results" style="display: none;">No matching classes.</div>
81
+ </div>
82
+
83
+
84
+ </div>
85
+ </div>
86
+
87
+ <div id="documentation">
88
+ <p>
89
+ B0;136;0c1.0.0
90
+ </p>
91
+ <hr style="height: 3px"></hr><p>
92
+ initial
93
+ </p>
94
+ <p>
95
+ 1.1.0(2012/11/9)
96
+ </p>
97
+ <hr style="height: 3px"></hr><ul>
98
+ <li><p>
99
+ make common config file
100
+ </p>
101
+ </li>
102
+ <li><p>
103
+ change log option
104
+ </p>
105
+ </li>
106
+ </ul>
107
+ <p>
108
+ 1.2.0(2012/11/13)
109
+ </p>
110
+ <hr style="height: 3px"></hr><ul>
111
+ <li><p>
112
+ change log level option format
113
+ </p>
114
+ </li>
115
+ <li><p>
116
+ make log append option
117
+ </p>
118
+ </li>
119
+ </ul>
120
+ <p>
121
+ 1.3.0(2012/12/30)
122
+ </p>
123
+ <hr style="height: 3px"></hr><ul>
124
+ <li><p>
125
+ add <a href="RBatch/Log.html">RBatch::Log</a> to instance interface
126
+ </p>
127
+ </li>
128
+ <li><p>
129
+ add double run check option
130
+ </p>
131
+ </li>
132
+ </ul>
133
+ <p>
134
+ 1.4.0(2013/1/5)
135
+ </p>
136
+ <hr style="height: 2px"></hr><ul>
137
+ <li><p>
138
+ add log_stdout option
139
+ </p>
140
+ </li>
141
+ <li><p>
142
+ add sample code
143
+ </p>
144
+ </li>
145
+ <li><p>
146
+ add cmd_raise option
147
+ </p>
148
+ </li>
149
+ <li><p>
150
+ add log_delete_old_log option
151
+ </p>
152
+ </li>
153
+ </ul>
154
+ <p>
155
+ 1.5.0(2013/1/11)
156
+ </p>
157
+ <hr style="height: 2px"></hr><ul>
158
+ <li><p>
159
+ change default config dir &#8220;../config&#8221; -> &#8220;../conf&#8220;
160
+ </p>
161
+ </li>
162
+ </ul>
163
+ <p>
164
+ 1.6.0(2013/1/14)
165
+ </p>
166
+ <hr style="height: 2px"></hr><ul>
167
+ <li><p>
168
+ add config key check
169
+ </p>
170
+ </li>
171
+ </ul>
172
+
173
+ </div>
174
+
175
+ <div id="validator-badges">
176
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
177
+ <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
178
+ Rdoc Generator</a> 1.1.6</small>.</p>
179
+ </div>
180
+ </body>
181
+ </html>
182
+
@@ -0,0 +1,98 @@
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
+
5
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
6
+ <head>
7
+ <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
8
+
9
+ <title>File: LICENSE [RBatch Docs]</title>
10
+
11
+ <link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet" />
12
+
13
+ <script src="./js/jquery.js" type="text/javascript"
14
+ charset="utf-8"></script>
15
+ <script src="./js/thickbox-compressed.js" type="text/javascript"
16
+ charset="utf-8"></script>
17
+ <script src="./js/quicksearch.js" type="text/javascript"
18
+ charset="utf-8"></script>
19
+ <script src="./js/darkfish.js" type="text/javascript"
20
+ charset="utf-8"></script>
21
+ </head>
22
+
23
+ <body class="file">
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="project-metadata">
36
+
37
+
38
+ <div id="fileindex-section" class="section project-section">
39
+ <h3 class="section-header">Files</h3>
40
+ <ul>
41
+
42
+ <li class="file"><a href="./CHANGELOG.html">CHANGELOG</a></li>
43
+
44
+ <li class="file"><a href="./LICENSE.html">LICENSE</a></li>
45
+
46
+ </ul>
47
+ </div>
48
+
49
+
50
+ <div id="classindex-section" class="section project-section">
51
+ <h3 class="section-header">Class Index
52
+ <span class="search-toggle"><img src="./images/find.png"
53
+ height="16" width="16" alt="[+]"
54
+ title="show/hide quicksearch" /></span></h3>
55
+ <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
56
+ <fieldset>
57
+ <legend>Quicksearch</legend>
58
+ <input type="text" name="quicksearch" value=""
59
+ class="quicksearch-field" />
60
+ </fieldset>
61
+ </form>
62
+
63
+ <ul class="link-list">
64
+
65
+ <li><a href="./RBatch.html">RBatch</a></li>
66
+
67
+ <li><a href="./RBatch/Cmd.html">RBatch::Cmd</a></li>
68
+
69
+ <li><a href="./RBatch/CmdException.html">RBatch::CmdException</a></li>
70
+
71
+ <li><a href="./RBatch/CmdResult.html">RBatch::CmdResult</a></li>
72
+
73
+ <li><a href="./RBatch/Config.html">RBatch::Config</a></li>
74
+
75
+ <li><a href="./RBatch/Config/Exception.html">RBatch::Config::Exception</a></li>
76
+
77
+ <li><a href="./RBatch/Log.html">RBatch::Log</a></li>
78
+
79
+ </ul>
80
+ <div id="no-class-search-results" style="display: none;">No matching classes.</div>
81
+ </div>
82
+
83
+
84
+ </div>
85
+ </div>
86
+
87
+ <div id="documentation">
88
+
89
+ </div>
90
+
91
+ <div id="validator-badges">
92
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
93
+ <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
94
+ Rdoc Generator</a> 1.1.6</small>.</p>
95
+ </div>
96
+ </body>
97
+ </html>
98
+
@@ -0,0 +1,333 @@
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/Config.html">RBatch::Config</a></li>
123
+
124
+ <li><a href="../RBatch/Config/Exception.html">RBatch::Config::Exception</a></li>
125
+
126
+ <li><a href="../RBatch/Log.html">RBatch::Log</a></li>
127
+
128
+ </ul>
129
+ <div id="no-class-search-results" style="display: none;">No matching classes.</div>
130
+ </div>
131
+
132
+
133
+ </div>
134
+ </div>
135
+
136
+ <div id="documentation">
137
+ <h1 class="class">RBatch::Cmd</h1>
138
+
139
+ <div id="description">
140
+ <p>
141
+ External command runcher.
142
+ </p>
143
+ <ul>
144
+ <li><p>
145
+ Input cmd_params into Kernel#spawn.
146
+ </p>
147
+ </li>
148
+ <li><p>
149
+ Write command&#8217;s stdout and stderr to tmp file.
150
+ </p>
151
+ </li>
152
+ </ul>
153
+ <pre>
154
+ * If Platform is &quot;mswin&quot; or &quot;mingw&quot; , then temp directory is ENV[&quot;TEMP&quot;]
155
+ * If Platform is &quot;linux&quot; or &quot;cygwin&quot; , then temp directory is &quot;/tmp/&quot;
156
+ </pre>
157
+ <ul>
158
+ <li><p>
159
+ Return hash object including stdout, stderr, and exit status.
160
+ </p>
161
+ </li>
162
+ </ul>
163
+ <h4>Sample 1</h4>
164
+ <pre>
165
+ require 'rbatch'
166
+ cmd = RBatch::Cmd(&quot;ls&quot;)
167
+ r = cmd.run
168
+ p r.stdout
169
+ =&gt; &quot;fileA\nfileB\n&quot;
170
+ </pre>
171
+ <h4>Sample 2 ( Use option)</h4>
172
+ <pre>
173
+ cmd = RBatch::Cmd(&quot;ls&quot;, {:verbose =&gt; true})
174
+ r = cmd.run
175
+ </pre>
176
+ <h4>Sample 3 ( Use alias)</h4>
177
+ <pre>
178
+ require 'rbatch'
179
+ r = RBatch::cmd(&quot;ls&quot;)
180
+ p r.stdout
181
+ =&gt; &quot;fileA\nfileB\n&quot;</pre>
182
+
183
+ </div>
184
+
185
+ <!-- Constants -->
186
+
187
+
188
+ <!-- Attributes -->
189
+
190
+
191
+ <!-- Methods -->
192
+
193
+ <div id="public-class-method-details" class="method-section section">
194
+ <h3 class="section-header">Public Class Methods</h3>
195
+
196
+
197
+ <div id="new-method" class="method-detail ">
198
+ <a name="method-c-new"></a>
199
+
200
+ <div class="method-heading">
201
+
202
+ <span class="method-name">new</span><span
203
+ class="method-args">(cmd_str,opt = nil)</span>
204
+ <span class="method-click-advice">click to toggle source</span>
205
+
206
+ </div>
207
+
208
+ <div class="method-description">
209
+
210
+ <p>
211
+ <a href="Cmd.html">Cmd</a> instance
212
+ </p>
213
+ <h4>Params</h4>
214
+ <p>
215
+ <tt>cmd_str</tt> = Command string. Such ad &#8220;ls -l&#8221; <tt>opt</tt>
216
+ = Option hash object. Hash keys is follows.
217
+ </p>
218
+ <ul>
219
+ <li><p>
220
+ <tt>:raise</tt> (Boolean) = If command exit status is not 0, raise
221
+ exception. Default is false.
222
+ </p>
223
+ </li>
224
+ </ul>
225
+
226
+
227
+
228
+ <div class="method-source-code"
229
+ id="new-source">
230
+ <pre>
231
+ <span class="ruby-comment cmt"># File lib/rbatch/cmd.rb, line 44</span>
232
+ 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>)
233
+ 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>
234
+ 46: <span class="ruby-ivar">@cmd_str</span> = <span class="ruby-identifier">cmd_str</span>
235
+ 47: <span class="ruby-comment cmt"># parse option</span>
236
+ 48: <span class="ruby-ivar">@opt</span> = <span class="ruby-identifier">@@def_opt</span>.<span class="ruby-identifier">clone</span>
237
+ 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>
238
+ 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>
239
+ 51: <span class="ruby-comment cmt"># use argument</span>
240
+ 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>]
241
+ 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>
242
+ 54: <span class="ruby-comment cmt"># use config</span>
243
+ 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>]
244
+ 56: <span class="ruby-keyword kw">else</span>
245
+ 57: <span class="ruby-comment cmt"># use default</span>
246
+ 58: <span class="ruby-keyword kw">end</span>
247
+ 59: <span class="ruby-keyword kw">end</span>
248
+ 60: <span class="ruby-keyword kw">end</span></pre>
249
+ </div>
250
+
251
+ </div>
252
+
253
+
254
+
255
+
256
+ </div>
257
+
258
+
259
+ </div>
260
+
261
+ <div id="public-instance-method-details" class="method-section section">
262
+ <h3 class="section-header">Public Instance Methods</h3>
263
+
264
+
265
+ <div id="run-method" class="method-detail ">
266
+ <a name="method-i-run"></a>
267
+
268
+ <div class="method-heading">
269
+
270
+ <span class="method-name">run</span><span
271
+ class="method-args">()</span>
272
+ <span class="method-click-advice">click to toggle source</span>
273
+
274
+ </div>
275
+
276
+ <div class="method-description">
277
+
278
+ <p>
279
+ Run command
280
+ </p>
281
+ <h4>Return</h4>
282
+ <p>
283
+ instance of <a href="CmdResult.html">RBatch::CmdResult</a>
284
+ </p>
285
+
286
+
287
+
288
+ <div class="method-source-code"
289
+ id="run-source">
290
+ <pre>
291
+ <span class="ruby-comment cmt"># File lib/rbatch/cmd.rb, line 67</span>
292
+ 67: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">run</span>()
293
+ 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>)
294
+ 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>)
295
+ 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>])
296
+ 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>
297
+ 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>)
298
+ 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>
299
+ 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>)
300
+ 75: <span class="ruby-keyword kw">end</span>
301
+ 76: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">result</span>
302
+ 77: <span class="ruby-keyword kw">end</span></pre>
303
+ </div>
304
+
305
+ </div>
306
+
307
+
308
+
309
+
310
+ </div>
311
+
312
+
313
+ </div>
314
+
315
+
316
+ </div>
317
+
318
+
319
+ <div id="rdoc-debugging-section-dump" class="debugging-section">
320
+
321
+ <p>Disabled; run with --debug to generate this.</p>
322
+
323
+ </div>
324
+
325
+ <div id="validator-badges">
326
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
327
+ <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
328
+ Rdoc Generator</a> 1.1.6</small>.</p>
329
+ </div>
330
+
331
+ </body>
332
+ </html>
333
+