rbatch 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. data/CHANGELOG +25 -0
  2. data/LICENSE +0 -0
  3. data/README.ja.md +280 -0
  4. data/README.md +280 -0
  5. data/Rakefile +66 -0
  6. data/VERSION +1 -0
  7. data/doc/rdoc/CHANGELOG.html +160 -0
  8. data/doc/rdoc/LICENSE.html +94 -0
  9. data/doc/rdoc/RBatch.html +476 -0
  10. data/doc/rdoc/RBatch/Cmd.html +329 -0
  11. data/doc/rdoc/RBatch/CmdException.html +154 -0
  12. data/doc/rdoc/RBatch/CmdResult.html +492 -0
  13. data/doc/rdoc/RBatch/Log.html +739 -0
  14. data/doc/rdoc/created.rid +8 -0
  15. data/doc/rdoc/images/brick.png +0 -0
  16. data/doc/rdoc/images/brick_link.png +0 -0
  17. data/doc/rdoc/images/bug.png +0 -0
  18. data/doc/rdoc/images/bullet_black.png +0 -0
  19. data/doc/rdoc/images/bullet_toggle_minus.png +0 -0
  20. data/doc/rdoc/images/bullet_toggle_plus.png +0 -0
  21. data/doc/rdoc/images/date.png +0 -0
  22. data/doc/rdoc/images/find.png +0 -0
  23. data/doc/rdoc/images/loadingAnimation.gif +0 -0
  24. data/doc/rdoc/images/macFFBgHack.png +0 -0
  25. data/doc/rdoc/images/package.png +0 -0
  26. data/doc/rdoc/images/page_green.png +0 -0
  27. data/doc/rdoc/images/page_white_text.png +0 -0
  28. data/doc/rdoc/images/page_white_width.png +0 -0
  29. data/doc/rdoc/images/plugin.png +0 -0
  30. data/doc/rdoc/images/ruby.png +0 -0
  31. data/doc/rdoc/images/tag_green.png +0 -0
  32. data/doc/rdoc/images/wrench.png +0 -0
  33. data/doc/rdoc/images/wrench_orange.png +0 -0
  34. data/doc/rdoc/images/zoom.png +0 -0
  35. data/doc/rdoc/index.html +124 -0
  36. data/doc/rdoc/js/darkfish.js +116 -0
  37. data/doc/rdoc/js/jquery.js +32 -0
  38. data/doc/rdoc/js/quicksearch.js +114 -0
  39. data/doc/rdoc/js/thickbox-compressed.js +10 -0
  40. data/doc/rdoc/lib/rbatch/cmd_rb.html +56 -0
  41. data/doc/rdoc/lib/rbatch/config_rb.html +56 -0
  42. data/doc/rdoc/lib/rbatch/log_rb.html +58 -0
  43. data/doc/rdoc/lib/rbatch_rb.html +58 -0
  44. data/doc/rdoc/rdoc.css +706 -0
  45. data/lib/rbatch.rb +51 -0
  46. data/lib/rbatch/cmd.rb +118 -0
  47. data/lib/rbatch/config.rb +29 -0
  48. data/lib/rbatch/log.rb +205 -0
  49. data/sample/bin/file_batch_copy.rb +9 -0
  50. data/sample/bin/openldap_backup.rb +7 -0
  51. data/sample/bin/test.rb +12 -0
  52. data/sample/config/file_batch_copy.yaml +5 -0
  53. data/sample/config/openldap_backup.yaml +2 -0
  54. data/sample/config/rbatch.yaml +68 -0
  55. data/sample/log/empty +0 -0
  56. data/test/cases/test_cmd.rb +120 -0
  57. data/test/cases/test_config.rb +34 -0
  58. data/test/cases/test_log.rb +594 -0
  59. data/test/config/rbatch.yaml +0 -0
  60. data/test/mocks/PrintArgs.exe +0 -0
  61. data/test/mocks/win_cmd.exe +0 -0
  62. metadata +173 -0
@@ -0,0 +1,66 @@
1
+ #
2
+ # To change this template, choose Tools | Templates
3
+ # and open the template in the editor.
4
+
5
+
6
+ require 'rubygems'
7
+ require 'rake'
8
+ require 'rake/clean'
9
+ require 'rake/gempackagetask'
10
+ require 'rake/rdoctask'
11
+ require 'rake/testtask'
12
+
13
+ spec = Gem::Specification.new do |s|
14
+ s.name = 'rbatch'
15
+ s.version = '1.4.0'
16
+ s.extra_rdoc_files = ['README.md', 'LICENSE']
17
+ s.summary = 'batch framework'
18
+ s.description = ''
19
+ s.author = 'fetaro'
20
+ s.email = 'fetaro@gmail.com'
21
+ s.homepage = 'https://github.com/fetaro/rbatch'
22
+ s.files = %w(LICENSE README.md README.ja.md Rakefile) + Dir.glob("{bin,lib,spec}/**/*")
23
+ s.require_path = "lib"
24
+
25
+ end
26
+
27
+ Rake::GemPackageTask.new(spec) do |p|
28
+ p.gem_spec = spec
29
+ p.package_files.include("lib/**/*")
30
+ p.need_tar = false
31
+ p.need_zip = false
32
+ end
33
+
34
+ Rake::RDocTask.new do |rdoc|
35
+ files =['README.md', 'LICENSE', 'CHANGELOG', 'lib/**/*.rb']
36
+ rdoc.rdoc_files.add(files)
37
+ # rdoc.main = "README.md" # page to start on
38
+ rdoc.title = "RBatch Docs"
39
+ rdoc.rdoc_dir = 'doc/rdoc' # rdoc output folder
40
+ rdoc.options << '--line-numbers'
41
+ end
42
+
43
+
44
+ Rake::TestTask.new do |t|
45
+ t.libs << "./lib"
46
+ t.test_files = FileList['test/test*.rb']
47
+ t.verbose = true
48
+ end
49
+
50
+ desc "Special Test for RBatch::log"
51
+ task :test_log do |t|
52
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__),"lib"))
53
+ require "rbatch"
54
+ path = File.join("test","special","bin","test_log.rb")
55
+ RBatch.program_name = path
56
+ load path
57
+ end
58
+
59
+ desc "Special Test for RBatch.config"
60
+ task :test_config do |t|
61
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__),"lib"))
62
+ require "rbatch"
63
+ path = File.join("test","special","bin","test_config.rb")
64
+ RBatch.program_name = path
65
+ load path
66
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 1.4.0
@@ -0,0 +1,160 @@
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/Log.html">RBatch::Log</a></li>
74
+
75
+ </ul>
76
+ <div id="no-class-search-results" style="display: none;">No matching classes.</div>
77
+ </div>
78
+
79
+
80
+ </div>
81
+ </div>
82
+
83
+ <div id="documentation">
84
+ <p>
85
+ 1.0.0
86
+ </p>
87
+ <hr style="height: 3px"></hr><p>
88
+ initial
89
+ </p>
90
+ <p>
91
+ 1.1.0(2012/11/9)
92
+ </p>
93
+ <hr style="height: 3px"></hr><ul>
94
+ <li><p>
95
+ make common config file
96
+ </p>
97
+ </li>
98
+ <li><p>
99
+ change log option
100
+ </p>
101
+ </li>
102
+ </ul>
103
+ <p>
104
+ 1.2.0(2012/11/13)
105
+ </p>
106
+ <hr style="height: 3px"></hr><ul>
107
+ <li><p>
108
+ change log level option format
109
+ </p>
110
+ </li>
111
+ <li><p>
112
+ make log append option
113
+ </p>
114
+ </li>
115
+ </ul>
116
+ <p>
117
+ 1.3.0(2012/12/30)
118
+ </p>
119
+ <hr style="height: 3px"></hr><ul>
120
+ <li><p>
121
+ add <a href="RBatch/Log.html">RBatch::Log</a> to instance interface
122
+ </p>
123
+ </li>
124
+ <li><p>
125
+ add double run check option
126
+ </p>
127
+ </li>
128
+ </ul>
129
+ <p>
130
+ 1.4.0(2013/1/5)
131
+ </p>
132
+ <hr style="height: 2px"></hr><ul>
133
+ <li><p>
134
+ add log_stdout option
135
+ </p>
136
+ </li>
137
+ <li><p>
138
+ add sample code
139
+ </p>
140
+ </li>
141
+ <li><p>
142
+ add cmd_raise option
143
+ </p>
144
+ </li>
145
+ <li><p>
146
+ add log_delete_old_log option
147
+ </p>
148
+ </li>
149
+ </ul>
150
+
151
+ </div>
152
+
153
+ <div id="validator-badges">
154
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
155
+ <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
156
+ Rdoc Generator</a> 1.1.6</small>.</p>
157
+ </div>
158
+ </body>
159
+ </html>
160
+
@@ -0,0 +1,94 @@
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/Log.html">RBatch::Log</a></li>
74
+
75
+ </ul>
76
+ <div id="no-class-search-results" style="display: none;">No matching classes.</div>
77
+ </div>
78
+
79
+
80
+ </div>
81
+ </div>
82
+
83
+ <div id="documentation">
84
+
85
+ </div>
86
+
87
+ <div id="validator-badges">
88
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
89
+ <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
90
+ Rdoc Generator</a> 1.1.6</small>.</p>
91
+ </div>
92
+ </body>
93
+ </html>
94
+
@@ -0,0 +1,476 @@
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>Module: RBatch</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="module">
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/log_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
42
+ class="thickbox" title="lib/rbatch/log.rb">lib/rbatch/log.rb</a></li>
43
+
44
+ <li><a href="./lib/rbatch/config_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
45
+ class="thickbox" title="lib/rbatch/config.rb">lib/rbatch/config.rb</a></li>
46
+
47
+ <li><a href="./lib/rbatch/cmd_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
48
+ class="thickbox" title="lib/rbatch/cmd.rb">lib/rbatch/cmd.rb</a></li>
49
+
50
+ <li><a href="./lib/rbatch_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
51
+ class="thickbox" title="lib/rbatch.rb">lib/rbatch.rb</a></li>
52
+
53
+ </ul>
54
+ </div>
55
+ </div>
56
+
57
+
58
+ </div>
59
+
60
+ <div id="class-metadata">
61
+
62
+ <!-- Parent Class -->
63
+
64
+
65
+ <!-- Namespace Contents -->
66
+
67
+ <div id="namespace-list-section" class="section">
68
+ <h3 class="section-header">Namespace</h3>
69
+ <ul class="link-list">
70
+
71
+ <li><span class="type">CLASS</span> <a href="RBatch/Cmd.html">RBatch::Cmd</a></li>
72
+
73
+ <li><span class="type">CLASS</span> <a href="RBatch/CmdException.html">RBatch::CmdException</a></li>
74
+
75
+ <li><span class="type">CLASS</span> <a href="RBatch/CmdResult.html">RBatch::CmdResult</a></li>
76
+
77
+ <li><span class="type">CLASS</span> <a href="RBatch/Log.html">RBatch::Log</a></li>
78
+
79
+ </ul>
80
+ </div>
81
+
82
+
83
+ <!-- Method Quickref -->
84
+
85
+ <div id="method-list-section" class="section">
86
+ <h3 class="section-header">Methods</h3>
87
+ <ul class="link-list">
88
+
89
+ <li><a href="#method-i-cmd">#cmd</a></li>
90
+
91
+ <li><a href="#method-i-common_config">#common_config</a></li>
92
+
93
+ <li><a href="#method-i-common_config_path">#common_config_path</a></li>
94
+
95
+ <li><a href="#method-i-config">#config</a></li>
96
+
97
+ <li><a href="#method-i-program_name">#program_name</a></li>
98
+
99
+ <li><a href="#method-i-program_name%3D">#program_name=</a></li>
100
+
101
+ <li><a href="#method-i-tmp_dir">#tmp_dir</a></li>
102
+
103
+ </ul>
104
+ </div>
105
+
106
+
107
+ <!-- Included Modules -->
108
+
109
+ </div>
110
+
111
+ <div id="project-metadata">
112
+
113
+
114
+ <div id="fileindex-section" class="section project-section">
115
+ <h3 class="section-header">Files</h3>
116
+ <ul>
117
+
118
+ <li class="file"><a href="./CHANGELOG.html">CHANGELOG</a></li>
119
+
120
+ <li class="file"><a href="./LICENSE.html">LICENSE</a></li>
121
+
122
+ </ul>
123
+ </div>
124
+
125
+
126
+ <div id="classindex-section" class="section project-section">
127
+ <h3 class="section-header">Class Index
128
+ <span class="search-toggle"><img src="./images/find.png"
129
+ height="16" width="16" alt="[+]"
130
+ title="show/hide quicksearch" /></span></h3>
131
+ <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
132
+ <fieldset>
133
+ <legend>Quicksearch</legend>
134
+ <input type="text" name="quicksearch" value=""
135
+ class="quicksearch-field" />
136
+ </fieldset>
137
+ </form>
138
+
139
+ <ul class="link-list">
140
+
141
+ <li><a href="./RBatch.html">RBatch</a></li>
142
+
143
+ <li><a href="./RBatch/Cmd.html">RBatch::Cmd</a></li>
144
+
145
+ <li><a href="./RBatch/CmdException.html">RBatch::CmdException</a></li>
146
+
147
+ <li><a href="./RBatch/CmdResult.html">RBatch::CmdResult</a></li>
148
+
149
+ <li><a href="./RBatch/Log.html">RBatch::Log</a></li>
150
+
151
+ </ul>
152
+ <div id="no-class-search-results" style="display: none;">No matching classes.</div>
153
+ </div>
154
+
155
+
156
+ </div>
157
+ </div>
158
+
159
+ <div id="documentation">
160
+ <h1 class="module">RBatch</h1>
161
+
162
+ <div id="description">
163
+
164
+ </div>
165
+
166
+ <!-- Constants -->
167
+
168
+
169
+ <!-- Attributes -->
170
+
171
+
172
+ <!-- Methods -->
173
+
174
+ <div id="public-instance-method-details" class="method-section section">
175
+ <h3 class="section-header">Public Instance Methods</h3>
176
+
177
+
178
+ <div id="cmd-method" class="method-detail ">
179
+ <a name="method-i-cmd"></a>
180
+
181
+ <div class="method-heading">
182
+
183
+ <span class="method-name">cmd</span><span
184
+ class="method-args">(cmd_str,opt = nil)</span>
185
+ <span class="method-click-advice">click to toggle source</span>
186
+
187
+ </div>
188
+
189
+ <div class="method-description">
190
+
191
+ <p>
192
+ shortcut of <a href="RBatch/Cmd.html">RBatch::Cmd</a>
193
+ </p>
194
+
195
+
196
+
197
+ <div class="method-source-code"
198
+ id="cmd-source">
199
+ <pre>
200
+ <span class="ruby-comment cmt"># File lib/rbatch/cmd.rb, line 114</span>
201
+ 114: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cmd</span>(<span class="ruby-identifier">cmd_str</span>,<span class="ruby-identifier">opt</span> = <span class="ruby-keyword kw">nil</span>)
202
+ 115: <span class="ruby-constant">Cmd</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">cmd_str</span>,<span class="ruby-identifier">opt</span>).<span class="ruby-identifier">run</span>
203
+ 116: <span class="ruby-keyword kw">end</span></pre>
204
+ </div>
205
+
206
+ </div>
207
+
208
+
209
+
210
+
211
+ </div>
212
+
213
+
214
+ <div id="common-config-method" class="method-detail ">
215
+ <a name="method-i-common_config"></a>
216
+
217
+ <div class="method-heading">
218
+
219
+ <span class="method-name">common_config</span><span
220
+ class="method-args">()</span>
221
+ <span class="method-click-advice">click to toggle source</span>
222
+
223
+ </div>
224
+
225
+ <div class="method-description">
226
+
227
+
228
+
229
+
230
+
231
+ <div class="method-source-code"
232
+ id="common-config-source">
233
+ <pre>
234
+ <span class="ruby-comment cmt"># File lib/rbatch.rb, line 21</span>
235
+ 21: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">common_config</span>
236
+ 22: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-constant">RBatch</span>.<span class="ruby-identifier">common_config_path</span>)
237
+ 23: <span class="ruby-identifier">yaml</span> = <span class="ruby-constant">YAML</span><span class="ruby-operator">::</span><span class="ruby-identifier">load_file</span>(<span class="ruby-constant">RBatch</span>.<span class="ruby-identifier">common_config_path</span>)
238
+ 24: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">yaml</span>
239
+ 25: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">yaml</span>
240
+ 26: <span class="ruby-keyword kw">else</span>
241
+ 27: <span class="ruby-comment cmt"># If file is emply , YAML::load_file is false</span>
242
+ 28: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span>
243
+ 29: <span class="ruby-keyword kw">end</span>
244
+ 30: <span class="ruby-keyword kw">else</span>
245
+ 31: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span>
246
+ 32: <span class="ruby-keyword kw">end</span>
247
+ 33: <span class="ruby-keyword kw">end</span></pre>
248
+ </div>
249
+
250
+ </div>
251
+
252
+
253
+
254
+
255
+ </div>
256
+
257
+
258
+ <div id="common-config-path-method" class="method-detail ">
259
+ <a name="method-i-common_config_path"></a>
260
+
261
+ <div class="method-heading">
262
+
263
+ <span class="method-name">common_config_path</span><span
264
+ class="method-args">()</span>
265
+ <span class="method-click-advice">click to toggle source</span>
266
+
267
+ </div>
268
+
269
+ <div class="method-description">
270
+
271
+
272
+
273
+
274
+
275
+ <div class="method-source-code"
276
+ id="common-config-path-source">
277
+ <pre>
278
+ <span class="ruby-comment cmt"># File lib/rbatch.rb, line 18</span>
279
+ 18: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">common_config_path</span>
280
+ 19: <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-constant">RBatch</span>.<span class="ruby-identifier">program_name</span>),<span class="ruby-value str">&quot;..&quot;</span>,<span class="ruby-value str">&quot;config&quot;</span>,<span class="ruby-value str">&quot;rbatch.yaml&quot;</span>)
281
+ 20: <span class="ruby-keyword kw">end</span></pre>
282
+ </div>
283
+
284
+ </div>
285
+
286
+
287
+
288
+
289
+ </div>
290
+
291
+
292
+ <div id="config-method" class="method-detail ">
293
+ <a name="method-i-config"></a>
294
+
295
+ <div class="method-heading">
296
+
297
+ <span class="method-name">config</span><span
298
+ class="method-args">()</span>
299
+ <span class="method-click-advice">click to toggle source</span>
300
+
301
+ </div>
302
+
303
+ <div class="method-description">
304
+
305
+ <p>
306
+ Read config file and return hash opject.
307
+ </p>
308
+ <p>
309
+ Default config file path is &#8220;../config/(Program name).yaml&#8220;
310
+ </p>
311
+ <h4>Sample</h4>
312
+ <p>
313
+ config : ./config/sample2.yaml
314
+ </p>
315
+ <pre>
316
+ key: value
317
+ array:
318
+ * item1
319
+ * item2
320
+ * item3
321
+ </pre>
322
+ <p>
323
+ script : ./bin/sample2.rb
324
+ </p>
325
+ <pre>
326
+ require 'rbatch'
327
+ p RBatch::config
328
+ =&gt; {&quot;key&quot; =&gt; &quot;value&quot;, &quot;array&quot; =&gt; [&quot;item1&quot;, &quot;item2&quot;, &quot;item3&quot;]}</pre>
329
+
330
+
331
+
332
+ <div class="method-source-code"
333
+ id="config-source">
334
+ <pre>
335
+ <span class="ruby-comment cmt"># File lib/rbatch/config.rb, line 22</span>
336
+ 22: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">config</span>
337
+ 23: <span class="ruby-identifier">file</span> = <span class="ruby-constant">Pathname</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">basename</span>(<span class="ruby-constant">RBatch</span>.<span class="ruby-identifier">program_name</span>)).<span class="ruby-identifier">sub_ext</span>(<span class="ruby-value str">&quot;.yaml&quot;</span>).<span class="ruby-identifier">to_s</span>
338
+ 24: <span class="ruby-identifier">dir</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-constant">RBatch</span>.<span class="ruby-identifier">program_name</span>),<span class="ruby-value str">&quot;..&quot;</span>),<span class="ruby-value str">&quot;config&quot;</span>)
339
+ 25: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">YAML</span><span class="ruby-operator">::</span><span class="ruby-identifier">load_file</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">dir</span>,<span class="ruby-identifier">file</span>))
340
+ 26: <span class="ruby-keyword kw">end</span></pre>
341
+ </div>
342
+
343
+ </div>
344
+
345
+
346
+
347
+
348
+ </div>
349
+
350
+
351
+ <div id="program-name-method" class="method-detail ">
352
+ <a name="method-i-program_name"></a>
353
+
354
+ <div class="method-heading">
355
+
356
+ <span class="method-name">program_name</span><span
357
+ class="method-args">()</span>
358
+ <span class="method-click-advice">click to toggle source</span>
359
+
360
+ </div>
361
+
362
+ <div class="method-description">
363
+
364
+
365
+
366
+
367
+
368
+ <div class="method-source-code"
369
+ id="program-name-source">
370
+ <pre>
371
+ <span class="ruby-comment cmt"># File lib/rbatch.rb, line 7</span>
372
+ 7: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">program_name</span> ; <span class="ruby-identifier">@@program_name</span> ; <span class="ruby-keyword kw">end</span></pre>
373
+ </div>
374
+
375
+ </div>
376
+
377
+
378
+
379
+
380
+ </div>
381
+
382
+
383
+ <div id="program-name--method" class="method-detail ">
384
+ <a name="method-i-program_name%3D"></a>
385
+
386
+ <div class="method-heading">
387
+
388
+ <span class="method-name">program_name=</span><span
389
+ class="method-args">(f)</span>
390
+ <span class="method-click-advice">click to toggle source</span>
391
+
392
+ </div>
393
+
394
+ <div class="method-description">
395
+
396
+
397
+
398
+
399
+
400
+ <div class="method-source-code"
401
+ id="program-name--source">
402
+ <pre>
403
+ <span class="ruby-comment cmt"># File lib/rbatch.rb, line 6</span>
404
+ 6: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">program_name=</span>(<span class="ruby-identifier">f</span>) ; <span class="ruby-identifier">@@program_name</span> = <span class="ruby-identifier">f</span> ; <span class="ruby-keyword kw">end</span></pre>
405
+ </div>
406
+
407
+ </div>
408
+
409
+
410
+
411
+
412
+ </div>
413
+
414
+
415
+ <div id="tmp-dir-method" class="method-detail ">
416
+ <a name="method-i-tmp_dir"></a>
417
+
418
+ <div class="method-heading">
419
+
420
+ <span class="method-name">tmp_dir</span><span
421
+ class="method-args">()</span>
422
+ <span class="method-click-advice">click to toggle source</span>
423
+
424
+ </div>
425
+
426
+ <div class="method-description">
427
+
428
+
429
+
430
+
431
+
432
+ <div class="method-source-code"
433
+ id="tmp-dir-source">
434
+ <pre>
435
+ <span class="ruby-comment cmt"># File lib/rbatch.rb, line 8</span>
436
+ 8: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">tmp_dir</span>
437
+ 9: <span class="ruby-keyword kw">case</span> <span class="ruby-constant">RUBY_PLATFORM</span>
438
+ 10: <span class="ruby-keyword kw">when</span> <span class="ruby-regexp re">/mswin|mingw/</span>
439
+ 11: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">ENV</span>[<span class="ruby-value str">&quot;TEMP&quot;</span>]
440
+ 12: <span class="ruby-keyword kw">when</span> <span class="ruby-regexp re">/cygwin|linux/</span>
441
+ 13: <span class="ruby-keyword kw">return</span> <span class="ruby-value str">&quot;/tmp/&quot;</span>
442
+ 14: <span class="ruby-keyword kw">else</span>
443
+ 15: <span class="ruby-identifier">raise</span> <span class="ruby-value str">&quot;Unknown RUBY_PRATFORM : &quot;</span> <span class="ruby-operator">+</span> <span class="ruby-constant">RUBY_PLATFORM</span>
444
+ 16: <span class="ruby-keyword kw">end</span>
445
+ 17: <span class="ruby-keyword kw">end</span></pre>
446
+ </div>
447
+
448
+ </div>
449
+
450
+
451
+
452
+
453
+ </div>
454
+
455
+
456
+ </div>
457
+
458
+
459
+ </div>
460
+
461
+
462
+ <div id="rdoc-debugging-section-dump" class="debugging-section">
463
+
464
+ <p>Disabled; run with --debug to generate this.</p>
465
+
466
+ </div>
467
+
468
+ <div id="validator-badges">
469
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
470
+ <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
471
+ Rdoc Generator</a> 1.1.6</small>.</p>
472
+ </div>
473
+
474
+ </body>
475
+ </html>
476
+