rbatch 2.2.0 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +6 -0
- data/README.ja.md +8 -0
- data/README.md +8 -0
- data/bin/rbatch-init +8 -0
- data/lib/rbatch/config.rb +7 -5
- data/lib/rbatch/log.rb +7 -2
- data/lib/rbatch/run_conf.rb +1 -0
- data/lib/rbatch/version.rb +1 -1
- data/spec/rbatch/log_spec.rb +15 -0
- metadata +2 -2
data/CHANGELOG
CHANGED
@@ -92,3 +92,9 @@ version 2
|
|
92
92
|
2.2.0 (2014/4/15)
|
93
93
|
----
|
94
94
|
* [add] now "log_mail_to" option accepts multiple recipients, before it accepts only one recipient.
|
95
|
+
|
96
|
+
2.3.0 (2014/10/28)
|
97
|
+
----
|
98
|
+
* [add] new option : "log_bufferd"
|
99
|
+
* [change] before log output is bufferd, now not.
|
100
|
+
* [bugfix] fix that it raises error if .rbatchrc is empty.
|
data/README.ja.md
CHANGED
@@ -404,6 +404,14 @@ Run-Conf(`${RB_HOME}/.rbatchrc`)のサンプルは以下の通り
|
|
404
404
|
#
|
405
405
|
#log_delete_old_log_date : 14
|
406
406
|
|
407
|
+
# ログのバッファリング
|
408
|
+
#
|
409
|
+
# デフォルト値はfalse。
|
410
|
+
# trueにするとログへの出力をバッファリングする。
|
411
|
+
#
|
412
|
+
#log_bufferd : true
|
413
|
+
#log_bufferd : false
|
414
|
+
|
407
415
|
# メール送信するかどうか
|
408
416
|
#
|
409
417
|
# デフォルト値は false。
|
data/README.md
CHANGED
@@ -399,6 +399,14 @@ Sample of RBatch Run-Conf `${RB_HOME}/.rbatchrc`.
|
|
399
399
|
#
|
400
400
|
#log_delete_old_log_date : 14
|
401
401
|
|
402
|
+
# Log buffering
|
403
|
+
#
|
404
|
+
# Default is false.
|
405
|
+
# If true, log output is bufferd.
|
406
|
+
#
|
407
|
+
#log_bufferd : true
|
408
|
+
#log_bufferd : false
|
409
|
+
|
402
410
|
# Send Mail
|
403
411
|
#
|
404
412
|
# Default is false.
|
data/bin/rbatch-init
CHANGED
@@ -134,6 +134,14 @@ contents[".rbatchrc"] = <<EOF
|
|
134
134
|
#
|
135
135
|
#log_delete_old_log_date : 14
|
136
136
|
|
137
|
+
# Log buffering
|
138
|
+
#
|
139
|
+
# Default is false.
|
140
|
+
# If true, log output is bufferd.
|
141
|
+
#
|
142
|
+
#log_bufferd : true
|
143
|
+
#log_bufferd : false
|
144
|
+
|
137
145
|
# Send Mail
|
138
146
|
#
|
139
147
|
# Default is false.
|
data/lib/rbatch/config.rb
CHANGED
@@ -60,11 +60,13 @@ module RBatch
|
|
60
60
|
|
61
61
|
class ConfigElement < Hash
|
62
62
|
def initialize(hash)
|
63
|
-
hash
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
63
|
+
if hash
|
64
|
+
hash.each_key do |key|
|
65
|
+
if hash[key].class == Hash
|
66
|
+
self[key] = ConfigElement.new(hash[key])
|
67
|
+
else
|
68
|
+
self[key] = hash[key]
|
69
|
+
end
|
68
70
|
end
|
69
71
|
end
|
70
72
|
end
|
data/lib/rbatch/log.rb
CHANGED
@@ -90,6 +90,9 @@ module RBatch
|
|
90
90
|
# When log.error(str) is called,
|
91
91
|
# log.fatal(str) is called , or rescue an Exception,
|
92
92
|
# send e-mail.
|
93
|
+
# @option opt [Boolean] :bufferd
|
94
|
+
# If true, log output is bufferd.
|
95
|
+
# Default is false.
|
93
96
|
# @option opt [String] :mail_to
|
94
97
|
# @option opt [String] :mail_from
|
95
98
|
# @option opt [String] :mail_server_host
|
@@ -128,10 +131,12 @@ module RBatch
|
|
128
131
|
# create Logger instance
|
129
132
|
begin
|
130
133
|
if @vars[:log_append] && File.exist?(@path)
|
131
|
-
|
134
|
+
_io = open(@path,"a")
|
132
135
|
else
|
133
|
-
|
136
|
+
_io = open(@path,"w")
|
134
137
|
end
|
138
|
+
_io.sync = ! @vars[:log_bufferd]
|
139
|
+
@log = Logger.new(_io)
|
135
140
|
rescue Errno::ENOENT => e
|
136
141
|
raise LogException,"Can not open log file - #{@path}"
|
137
142
|
end
|
data/lib/rbatch/run_conf.rb
CHANGED
data/lib/rbatch/version.rb
CHANGED
data/spec/rbatch/log_spec.rb
CHANGED
@@ -324,6 +324,21 @@ describe RBatch::Log do
|
|
324
324
|
expect(File.exists?(File.join(@log_dir,"test_delete.log"))).to be true
|
325
325
|
end
|
326
326
|
|
327
|
+
it "works bufferd is true" do
|
328
|
+
opt = { :name => "test_buffer.log",:bufferd => true}
|
329
|
+
RBatch::Log.new(opt) { | log | log.info("hoge") }
|
330
|
+
File::open(File.join(@log_dir , "test_buffer.log")) {|f|
|
331
|
+
expect(f.read).to match /hoge/
|
332
|
+
}
|
333
|
+
end
|
334
|
+
it "works bufferd is false" do
|
335
|
+
opt = { :name => "test_buffer2.log",:bufferd => false}
|
336
|
+
RBatch::Log.new(opt) { | log | log.info("hoge") }
|
337
|
+
File::open(File.join(@log_dir , "test_buffer2.log")) {|f|
|
338
|
+
expect(f.read).to match /hoge/
|
339
|
+
}
|
340
|
+
end
|
341
|
+
|
327
342
|
|
328
343
|
end
|
329
344
|
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: rbatch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 2.
|
5
|
+
version: 2.3.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- fetaro
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2014-
|
13
|
+
date: 2014-10-28 00:00:00 Z
|
14
14
|
dependencies: []
|
15
15
|
|
16
16
|
description: Batch Script Framework
|