rbatch 2.1.1 → 2.1.2

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 (62) hide show
  1. data/README.ja.md +14 -5
  2. data/README.md +164 -154
  3. data/bin/rbatch-init +21 -13
  4. data/doc/RBatch/Cmd.html +300 -316
  5. data/doc/RBatch/CmdException.html +146 -141
  6. data/doc/RBatch/CmdResult.html +467 -470
  7. data/doc/RBatch/Config.html +392 -433
  8. data/doc/RBatch/Controller.html +374 -0
  9. data/doc/RBatch/DoubleRunCheckException.html +146 -141
  10. data/doc/RBatch/DoubleRunChecker.html +258 -256
  11. data/doc/RBatch/Journal.html +332 -0
  12. data/doc/RBatch/Log.html +636 -805
  13. data/doc/RBatch/LogException.html +164 -0
  14. data/doc/RBatch/RBatch/RBatch/ConfigException.html +164 -0
  15. data/doc/RBatch/RBatch/RBatch.html +163 -0
  16. data/doc/RBatch/RBatch/VariablesException.html +164 -0
  17. data/doc/RBatch/RBatch.html +165 -0
  18. data/doc/RBatch/RunConf/Exception.html +146 -141
  19. data/doc/RBatch/RunConf.html +478 -532
  20. data/doc/RBatch/Variables.html +437 -0
  21. data/doc/RBatch.html +388 -862
  22. data/doc/created.rid +11 -9
  23. data/doc/index.html +178 -184
  24. data/doc/js/darkfish.js +9 -7
  25. data/doc/lib/rbatch/cmd_rb.html +46 -44
  26. data/doc/lib/rbatch/config_rb.html +42 -42
  27. data/doc/lib/rbatch/controller_rb.html +66 -0
  28. data/doc/lib/rbatch/double_run_checker_rb.html +42 -42
  29. data/doc/lib/rbatch/journal_rb.html +52 -0
  30. data/doc/lib/rbatch/log_rb.html +46 -46
  31. data/doc/lib/rbatch/run_conf_rb.html +42 -42
  32. data/doc/lib/rbatch/variables_rb.html +54 -0
  33. data/doc/lib/rbatch/version_rb.html +38 -38
  34. data/doc/lib/rbatch_rb.html +40 -52
  35. data/doc/rdoc.css +365 -308
  36. data/lib/rbatch/cmd.rb +15 -58
  37. data/lib/rbatch/config.rb +7 -7
  38. data/lib/rbatch/controller.rb +37 -61
  39. data/lib/rbatch/double_run_checker.rb +0 -0
  40. data/lib/rbatch/journal.rb +40 -0
  41. data/lib/rbatch/log.rb +71 -129
  42. data/lib/rbatch/run_conf.rb +13 -24
  43. data/lib/rbatch/variables.rb +82 -0
  44. data/lib/rbatch/version.rb +1 -1
  45. data/lib/rbatch.rb +7 -36
  46. data/sample/.rbatchrc +41 -7
  47. data/spec/01_rbach_spec.rb +99 -0
  48. data/spec/{cmd_spec.rb → rbatch/cmd_spec.rb} +40 -43
  49. data/spec/rbatch/config_spec.rb +67 -0
  50. data/spec/rbatch/controller_spec.rb +18 -0
  51. data/spec/{double_run_checker_spec.rb → rbatch/double_run_checker_spec.rb} +3 -0
  52. data/spec/rbatch/journal_spec.rb +29 -0
  53. data/spec/rbatch/log_spec.rb +350 -0
  54. data/spec/{run_conf_spec.rb → rbatch/run_conf_spec.rb} +13 -5
  55. data/spec/rbatch/variables_spec.rb +68 -0
  56. data/spec/spec_helper.rb +4 -5
  57. metadata +33 -17
  58. data/lib/rbatch/common_config.rb +0 -0
  59. data/spec/common_config_spec.rb +0 -85
  60. data/spec/config_spec.rb +0 -79
  61. data/spec/log_spec.rb +0 -430
  62. data/spec/rbatch_spec.rb +0 -22
data/README.ja.md CHANGED
@@ -321,15 +321,24 @@ Run-Conf(`${RB_HOME}/.rbatchrc`)のサンプルは以下の通り
321
321
  #log_mail_server_host : "localhost"
322
322
  #log_mail_server_port : 25
323
323
 
324
- # RBatchメッセージをログに出力
324
+ # RBatchの実行ログ(Journal)のLevel
325
325
  #
326
- # デフォルトは true。
327
- # trueを指定すると、RBatchメッセージをその時開かれているログに書き込む。
326
+ # デフォルトは1
327
+ # 大きい数を指定すると多くの実行ログが出力される。
328
+ # 0を指定すると何も表示されない。
328
329
  # RBatchメッセージの例
329
330
  # [RBatch] Load Config : "../conf/hoge.yaml"
330
331
  #
331
- #mix_rbatch_msg_to_log : true
332
- #mix_rbatch_msg_to_log : false
332
+ #rbatch_journal_level = 2
333
+ #rbatch_journal_level = 0
334
+
335
+ # RBatchの実行ログをログに混ぜ込む
336
+ #
337
+ # デフォルトは true。
338
+ # trueを指定すると、RBatchメッセージをその時開かれているログに混ぜこむ。
339
+ #
340
+ #mix_rbatch_journal_to_logs : true
341
+ #mix_rbatch_journal_to_logs : false
333
342
 
334
343
  ```
335
344
 
data/README.md CHANGED
@@ -171,160 +171,170 @@ When an option is set in both (1) and (2), (2) is prior to (1).
171
171
  #### Customize by writing Run-Conf (.rbatchrc)
172
172
 
173
173
  Sample of RBatch Run-Conf `${RB_HOME}/.rbatchrc`.
174
-
175
- # RBatch Run-Conf (.rbatchrc)
176
- #
177
- # This format is YAML.
178
- #
179
-
180
- # -------------------
181
- # Global setting
182
- # -------------------
183
-
184
- # Conf Directory
185
- #
186
- # Default is "<home>/conf"
187
- # <home> is replaced to ${RB_HOME}
188
- #
189
- #conf_dir: <home>/config/
190
- #conf_dir: /etc/rbatch/
191
-
192
- # Common config file name
193
- #
194
- # Default is "common.yaml"
195
- #
196
- #common_conf_name: share.yaml
197
-
198
- # Library Directory
199
- #
200
- # Default is "<home>/lib"
201
- # <home> is replaced to ${RB_HOME}
202
- #
203
- #lib_dir: /usr/local/lib/rbatch/
204
-
205
- # Auto Library Load
206
- #
207
- # Default is true
208
- # If true, require "(library directory)/*.rb" before script run.
209
- #
210
- #auto_lib_load: true
211
- #auto_lib_load: false
212
-
213
- # Forbit Script Double Run
214
- #
215
- # Default is false.
216
- # If true, two same name scripts cannot run at the same time.
217
- #
218
- #forbid_double_run: true
219
- #forbid_double_run: false
220
-
221
- # -------------------
222
- # Cmd setting
223
- # -------------------
224
-
225
- # Raise Exception
226
- #
227
- # Default is false.
228
- # If true, when command exit status is not 0, raise exception.
229
- #
230
- #cmd_raise : true
231
- #cmd_raise : false
232
-
233
- # Command Timeout
234
- #
235
- # Default is 0 [sec].
236
- #
237
- #cmd_timeout: 5
238
-
239
- # -------------------
240
- # Log setting
241
- # -------------------
242
-
243
- # Log Directory
244
- #
245
- # Default is "<home>/log"
246
- # <home> is replaced to ${RB_HOME}
247
- #
248
- #log_dir: <home>/rb_log
249
- #log_dir: /var/log/rbatch/
250
-
251
- # Log File Name
252
- #
253
- # Default is "<date>_<time>_<prog>.log".
254
- # <data> is replaced to YYYYMMDD date string
255
- # <time> is replaced to HHMMSS time string
256
- # <prog> is replaced to Program file base name (except extention).
257
- # <host> is replaced to Hostname.
258
- #
259
- #log_name : "<date>_<time>_<prog>.log"
260
- #log_name : "<date>_<prog>.log"
261
-
262
- # Append log or not
263
- #
264
- # Default is ture.
265
- #
266
- #log_append : true
267
- #log_append : false
268
-
269
- # Log Level
270
- #
271
- # Default is "info".
272
- # Effective values are "debug","info","wran","error",and "fatal".
273
- #
274
- #log_level : "debug"
275
- #log_level : "info"
276
- #log_level : "warn"
277
- #log_level : "error"
278
- #log_level : "fatal"
279
-
280
- # Print log string both file and STDOUT
281
- #
282
- # Default is false.
283
- #
284
- #log_stdout : true
285
- #log_stdout : false
286
-
287
- # Delete old log files
288
- #
289
- # Default is false.
290
- # If this is true, delete old log file when RBatch::Log.new is called.
291
- # A log file to delete is a log file which was made by the
292
- # RBatch::Log instance, and log filename format include "<date>".
293
- #
294
- #log_delete_old_log: true
295
- #log_delete_old_log: false
296
-
297
- # The day of leaving log files
298
- #
299
- # Default is 7.
300
- #
301
- #log_delete_old_log_date: 14
302
-
303
- # Send mail or not
304
- #
305
- # Default is false.
306
- # When log.error(msg) or log.fatal(msg) called , send e-mail
307
- # including "msg".
308
- #
309
- #log_send_mail : true
310
-
311
- # Mail parameters
312
- #
313
- #log_mail_to : "xxx@sample.com"
314
- #log_mail_from : "xxx@sample.com"
315
- #log_mail_server_host : "localhost"
316
- #log_mail_server_port : 25
317
-
318
- # Mix RBatch Message to Log
319
- #
320
- # Default is true.
321
- # If true, put RBatch message to log file(s) which is opened at time.
322
- # Example of RBatch Message
323
- # [RBatch] Load Config : "../conf/hoge.yaml"
324
- #
325
- #mix_rbatch_msg_to_log : true
326
- #mix_rbatch_msg_to_log : false
327
-
174
+ ```
175
+ # RBatch Run-Conf (.rbatchrc)
176
+ #
177
+ # This format is YAML.
178
+ #
179
+
180
+ # -------------------
181
+ # Global setting
182
+ # -------------------
183
+
184
+ # Conf Directory
185
+ #
186
+ # Default is "<home>/conf"
187
+ # <home> is replaced to ${RB_HOME}
188
+ #
189
+ #conf_dir: <home>/config/
190
+ #conf_dir: /etc/rbatch/
191
+
192
+ # Common config file name
193
+ #
194
+ # Default is "common.yaml"
195
+ #
196
+ #common_conf_name: share.yaml
197
+
198
+ # Library Directory
199
+ #
200
+ # Default is "<home>/lib"
201
+ # <home> is replaced to ${RB_HOME}
202
+ #
203
+ #lib_dir: /usr/local/lib/rbatch/
204
+
205
+ # Auto Library Load
206
+ #
207
+ # Default is true
208
+ # If true, require "(library directory)/*.rb" before script run.
209
+ #
210
+ #auto_lib_load: true
211
+ #auto_lib_load: false
212
+
213
+ # Forbit Script Double Run
214
+ #
215
+ # Default is false.
216
+ # If true, two same name scripts cannot run at the same time.
217
+ #
218
+ #forbid_double_run: true
219
+ #forbid_double_run: false
220
+
221
+ # -------------------
222
+ # Cmd setting
223
+ # -------------------
224
+
225
+ # Raise Exception
226
+ #
227
+ # Default is false.
228
+ # If true, when command exit status is not 0, raise exception.
229
+ #
230
+ #cmd_raise : true
231
+ #cmd_raise : false
232
+
233
+ # Command Timeout
234
+ #
235
+ # Default is 0 [sec].
236
+ #
237
+ #cmd_timeout: 5
238
+
239
+ # -------------------
240
+ # Log setting
241
+ # -------------------
242
+
243
+ # Log Directory
244
+ #
245
+ # Default is "<home>/log"
246
+ # <home> is replaced to ${RB_HOME}
247
+ #
248
+ #log_dir: <home>/rb_log
249
+ #log_dir: /var/log/rbatch/
250
+
251
+ # Log File Name
252
+ #
253
+ # Default is "<date>_<time>_<prog>.log".
254
+ # <data> is replaced to YYYYMMDD date string
255
+ # <time> is replaced to HHMMSS time string
256
+ # <prog> is replaced to Program file base name (except extention).
257
+ # <host> is replaced to Hostname.
258
+ #
259
+ #log_name : "<date>_<time>_<prog>.log"
260
+ #log_name : "<date>_<prog>.log"
261
+
262
+ # Append Log
263
+ #
264
+ # Default is ture.
265
+ #
266
+ #log_append : true
267
+ #log_append : false
268
+
269
+ # Log Level
270
+ #
271
+ # Default is "info".
272
+ # Effective values are "debug","info","wran","error",and "fatal".
273
+ #
274
+ #log_level : "debug"
275
+ #log_level : "info"
276
+ #log_level : "warn"
277
+ #log_level : "error"
278
+ #log_level : "fatal"
279
+
280
+ # Print log string both file and STDOUT
281
+ #
282
+ # Default is false.
283
+ #
284
+ #log_stdout : true
285
+ #log_stdout : false
286
+
287
+ # Delete old log files
288
+ #
289
+ # Default is false.
290
+ # If this is true, delete old log file when RBatch::Log.new is called.
291
+ # A log file to delete is a log file which was made by the
292
+ # RBatch::Log instance, and log filename format include "<date>".
293
+ #
294
+ #log_delete_old_log: true
295
+ #log_delete_old_log: false
296
+
297
+ # The day of leaving log files
298
+ #
299
+ # Default is 7.
300
+ #
301
+ #log_delete_old_log_date: 14
302
+
303
+ # Send mail or not
304
+ #
305
+ # Default is false.
306
+ # When log.error(msg) or log.fatal(msg) called , send e-mail
307
+ # including "msg".
308
+ #
309
+ #log_send_mail : true
310
+
311
+ # Mail parameters
312
+ #
313
+ #log_mail_to : "xxx@sample.com"
314
+ #log_mail_from : "xxx@sample.com"
315
+ #log_mail_server_host : "localhost"
316
+ #log_mail_server_port : 25
317
+
318
+ # RBatch Journal Message Level
319
+ #
320
+ # Default is 1
321
+ # If 2, put more journal messages to STDOUT.
322
+ # If 0, put nothing.
323
+ # Example of journal essages are follows.
324
+ # [RBatch] Load Config : "../conf/hoge.yaml"
325
+ #
326
+ #rbatch_journal_level = 2
327
+ #rbatch_journal_level = 0
328
+
329
+ # Mix RBatch Journal to Logs
330
+ #
331
+ # Default is true.
332
+ # If true, mix RBatch journal messages to log file(s) which is(are) opened at time.
333
+ #
334
+ #mix_rbatch_journal_to_logs : true
335
+ #mix_rbatch_journal_to_logs : false
336
+
337
+ ```
328
338
 
329
339
  ### Customize by passing option object to constructor
330
340
 
data/bin/rbatch-init CHANGED
@@ -13,10 +13,9 @@ contents[".rbatchrc"] = <<EOF
13
13
  # Conf Directory
14
14
  #
15
15
  # Default is "<home>/conf"
16
- #
17
16
  # <home> is replaced to ${RB_HOME}
18
17
  #
19
- #conf_dir: <home>/config
18
+ #conf_dir: <home>/config/
20
19
  #conf_dir: /etc/rbatch/
21
20
 
22
21
  # Common config file name
@@ -89,7 +88,7 @@ contents[".rbatchrc"] = <<EOF
89
88
  #log_name : "<date>_<time>_<prog>.log"
90
89
  #log_name : "<date>_<prog>.log"
91
90
 
92
- # Append log or not
91
+ # Append Log
93
92
  #
94
93
  # Default is ture.
95
94
  #
@@ -118,8 +117,8 @@ contents[".rbatchrc"] = <<EOF
118
117
  #
119
118
  # Default is false.
120
119
  # If this is true, delete old log file when RBatch::Log.new is called.
121
- # A log file to delete is a log file which was made by the RBatch::Log instance,
122
- # and log filename format include "<date>".
120
+ # A log file to delete is a log file which was made by the
121
+ # RBatch::Log instance, and log filename format include "<date>".
123
122
  #
124
123
  #log_delete_old_log: true
125
124
  #log_delete_old_log: false
@@ -131,9 +130,10 @@ contents[".rbatchrc"] = <<EOF
131
130
  #log_delete_old_log_date: 14
132
131
 
133
132
  # Send mail or not
134
- #
133
+ #
135
134
  # Default is false.
136
- # When log.error(msg) or log.fatal(msg) called , send e-mail including "msg".
135
+ # When log.error(msg) or log.fatal(msg) called , send e-mail
136
+ # including "msg".
137
137
  #
138
138
  #log_send_mail : true
139
139
 
@@ -144,16 +144,24 @@ contents[".rbatchrc"] = <<EOF
144
144
  #log_mail_server_host : "localhost"
145
145
  #log_mail_server_port : 25
146
146
 
147
- # Mix RBatch Message to Log
147
+ # RBatch Journal Message Level
148
148
  #
149
- # Default is true.
150
- # If true, put RBatch message to log file(s) which is opened at time.
151
- # Example of RBatch Message
149
+ # Default is 1
150
+ # If 2, put more journal messages to STDOUT.
151
+ # If 0, put nothing.
152
+ # Example of journal essages are follows.
152
153
  # [RBatch] Load Config : "../conf/hoge.yaml"
153
154
  #
154
- #mix_rbatch_msg_to_log : true
155
- #mix_rbatch_msg_to_log : false
155
+ #rbatch_journal_level = 2
156
+ #rbatch_journal_level = 0
156
157
 
158
+ # Mix RBatch Journal to Logs
159
+ #
160
+ # Default is true.
161
+ # If true, mix RBatch journal messages to log file(s) which is(are) opened at time.
162
+ #
163
+ #mix_rbatch_journal_to_logs : true
164
+ #mix_rbatch_journal_to_logs : false
157
165
  EOF
158
166
 
159
167
  contents["bin/hello_world.rb"] = <<EOF