rbatch 2.5.1 → 2.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 73a0f559fa403ce5fbe0ca86faae38b811cce54b
4
+ data.tar.gz: e153a887fc20abe1d51415699ea72d498c017806
5
+ SHA512:
6
+ metadata.gz: 5e98f13494c10a7ea409772803471134654e4f47ecb9b9c0f8b6555320d08a7a52a6d115584071c08cabe74bebc119645844ea68a8d787743a3759c2fba10b3f
7
+ data.tar.gz: 1f4e4b5f29f8d955694eef779010955119ff30154c26fc666977606bda5639d336df207e3f2c429a5e92b726048697b893e909e46810e690df3ee3348435a652
data/.gitignore CHANGED
@@ -2,3 +2,4 @@ pkg/
2
2
  sample/log/*.log
3
3
  coverage/
4
4
  .yardoc/
5
+ **/*flymake*
data/CHANGELOG CHANGED
@@ -9,6 +9,12 @@ If you want to know about bug fix, please see commit logs of https://github.com/
9
9
  version 2
10
10
  ===================
11
11
 
12
+ 2.6.0 (2015/09/06)
13
+ ----
14
+ * [change] ${RB_HOME}/lib is added to $LOAD_PATH by default.
15
+ * [change] Before auto-library-loading only load lib/*.rb, now it can load recursively.
16
+ * [change] auto-library-loading ignore files whose name begin with the "." .
17
+
12
18
  2.5.0 (2015/06/14)
13
19
  ----
14
20
  * [add] support erb format config.
@@ -22,6 +22,7 @@ module RBatch
22
22
  @journal.put 1, "RB_HOME : \"#{@vars[:home_dir]}\""
23
23
  @journal.put 1, "Load Run-Conf: \"#{@vars[:run_conf_path]}\""
24
24
  @journal.put 2, "RBatch Variables : #{@vars.inspect}"
25
+ # Load common_config
25
26
  if File.exist?(@vars[:common_config_path])
26
27
  @common_config = RBatch::Config.new(@vars[:common_config_path],false)
27
28
  elsif File.exist?(@vars[:common_config_erb_path])
@@ -32,6 +33,7 @@ module RBatch
32
33
  @common_config = RBatch::Config.new(@vars[:common_config_path],false)
33
34
  end
34
35
  @journal.put 1, "Load Config : \"#{@common_config.path}\"" if @common_config.exist?
36
+ # Load config
35
37
  if File.exist?(@vars[:config_path])
36
38
  @config = RBatch::Config.new(@vars[:config_path],false)
37
39
  elsif File.exist?(@vars[:config_erb_path])
@@ -42,18 +44,18 @@ module RBatch
42
44
  @config = RBatch::Config.new(@vars[:config_path],false)
43
45
  end
44
46
  @journal.put 1, "Load Config : \"#{@config.path}\"" if @config.exist?
45
-
46
47
  # double_run_check
47
48
  if ( @vars[:forbid_double_run])
48
49
  RBatch::DoubleRunChecker.check(@vars[:program_base]) #raise error if check is NG
49
50
  RBatch::DoubleRunChecker.make_lock_file(@vars[:program_base])
50
51
  end
51
52
  # load_lib
53
+ $LOAD_PATH.push(@vars[:lib_dir])
52
54
  if @vars[:auto_lib_load] && Dir.exist?(@vars[:lib_dir])
53
- Dir::foreach(@vars[:lib_dir]) do |file|
54
- if /.*rb/ =~ file
55
- require File.join(@vars[:lib_dir],File.basename(file,".rb"))
56
- @journal.put 1, "Load Library : \"#{File.join(@vars[:lib_dir],file)}\" "
55
+ Dir.glob(File.join(@vars[:lib_dir],"**","*")) do |path|
56
+ if File::basename(path) =~ /^[^\.].*\.rb$/
57
+ require File.expand_path(path)
58
+ @journal.put 1, "Load Library : \"#{File.expand_path(path)}\" "
57
59
  end
58
60
  end
59
61
  end
@@ -1,3 +1,3 @@
1
1
  module RBatch
2
- VERSION = "2.5.1"
2
+ VERSION = "2.6.0"
3
3
  end
@@ -6,11 +6,13 @@ describe "RBatch" do
6
6
  @home = File.join(Dir.tmpdir, @rand)
7
7
  @log_dir = File.join(@home,"log")
8
8
  @conf_dir = File.join(@home,"conf")
9
+ @lib_dir = File.join(@home,"lib")
9
10
  ENV["RB_HOME"]=@home
10
11
 
11
12
  Dir.mkdir(@home)
12
13
  Dir.mkdir(@log_dir)
13
14
  Dir.mkdir(@conf_dir)
15
+ Dir.mkdir(@lib_dir)
14
16
  open( File.join(@home,".rbatchrc") , "a" ){|f|
15
17
  f.write("log_name : hoge.log \nforbid_double_run : true")
16
18
  }
@@ -23,6 +25,23 @@ describe "RBatch" do
23
25
  f.write("key2 : value2")
24
26
  }
25
27
 
28
+ open( File.join(@lib_dir,"hoge.rb") , "a" ){|f|
29
+ f.write("require 'hoge'\nrequire 'tmp/bar'\nrequire 'tmp/tmp/huga'\n")
30
+ }
31
+
32
+ # this library shold not be loaded
33
+ open( File.join(@lib_dir,".hoge.rb.swp") , "a" ){|f|}
34
+
35
+ Dir.mkdir(File.join(@lib_dir,"tmp"))
36
+ open( File.join(@lib_dir,"tmp","bar.rb") , "a" ){|f|
37
+ f.write("require 'hoge'\nrequire 'tmp/bar'\nrequire 'tmp/tmp/huga'\n")
38
+ }
39
+
40
+ Dir.mkdir(File.join(@lib_dir,"tmp","tmp"))
41
+ open( File.join(@lib_dir,"tmp","tmp","huga.rb") , "a" ){|f|
42
+ f.write("require 'hoge'\nrequire 'tmp/bar'\nrequire 'tmp/tmp/huga'\n")
43
+ }
44
+
26
45
  # stop STODOUT output
27
46
  #$stdout = File.open(File.join(@home,"out.txt"),"w")
28
47
  #$stderr = File.open(File.join(@home,"err.txt"),"w")
@@ -74,10 +93,13 @@ describe "RBatch" do
74
93
  expect(RBatch.ctrl.journal.journals[2]).to match /batchrc/
75
94
  expect(RBatch.ctrl.journal.journals[3]).to match /common.yaml/
76
95
  expect(RBatch.ctrl.journal.journals[4]).to match /rspec.yaml/
77
- expect(RBatch.ctrl.journal.journals[5]).to match /Start Script/
78
- expect(RBatch.ctrl.journal.journals[6]).to match /Logging Start/
79
- expect(RBatch.ctrl.journal.journals[7]).to match /var1/
80
- expect(RBatch.ctrl.journal.journals[8]).to match /var0/
96
+ expect(RBatch.ctrl.journal.journals[5]).to match /Load Library.*.rb/
97
+ expect(RBatch.ctrl.journal.journals[6]).to match /Load Library.*.rb/
98
+ expect(RBatch.ctrl.journal.journals[7]).to match /Load Library.*.rb/
99
+ expect(RBatch.ctrl.journal.journals[8]).to match /Start Script/
100
+ expect(RBatch.ctrl.journal.journals[9]).to match /Logging Start/
101
+ expect(RBatch.ctrl.journal.journals[10]).to match /var1/
102
+ expect(RBatch.ctrl.journal.journals[11]).to match /var0/
81
103
 
82
104
  # check log
83
105
  f = open(File.join(@home,"log","hoge.log")).read
@@ -88,12 +110,15 @@ describe "RBatch" do
88
110
  expect(lines[2]).to match /batchrc/
89
111
  expect(lines[3]).to match /common.yaml/
90
112
  expect(lines[4]).to match /rspec.yaml/
91
- expect(lines[5]).to match /Start Script/
92
- expect(lines[6]).to match /Logging Start/
93
- expect(lines[7]).to match /test_string/
94
- expect(lines[8]).to match /var1/
95
- expect(lines[9]).to match /var0/
96
- expect(lines[10]).to match /FATAL/
113
+ expect(lines[5]).to match /Load Library.*.rb/
114
+ expect(lines[6]).to match /Load Library.*.rb/
115
+ expect(lines[7]).to match /Load Library.*.rb/
116
+ expect(lines[8]).to match /Start Script/
117
+ expect(lines[9]).to match /Logging Start/
118
+ expect(lines[10]).to match /test_string/
119
+ expect(lines[11]).to match /var1/
120
+ expect(lines[12]).to match /var0/
121
+ expect(lines[13]).to match /FATAL/
97
122
 
98
123
  end
99
124
  end
metadata CHANGED
@@ -1,28 +1,23 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: rbatch
3
- version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 2.5.1
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.6.0
6
5
  platform: ruby
7
- authors:
6
+ authors:
8
7
  - fetaro
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
-
13
- date: 2015-06-17 00:00:00 Z
11
+ date: 2015-09-06 00:00:00.000000000 Z
14
12
  dependencies: []
15
-
16
13
  description: Batch Script Framework
17
- email:
14
+ email:
18
15
  - fetaro@gmail.com
19
- executables:
16
+ executables:
20
17
  - rbatch-init
21
18
  extensions: []
22
-
23
19
  extra_rdoc_files: []
24
-
25
- files:
20
+ files:
26
21
  - .gitignore
27
22
  - .travis.yml
28
23
  - CHANGELOG
@@ -69,33 +64,30 @@ files:
69
64
  - spec/rbatch/variables_spec.rb
70
65
  - spec/spec_helper.rb
71
66
  homepage: https://github.com/fetaro/rbatch
72
- licenses:
67
+ licenses:
73
68
  - MIT
69
+ metadata: {}
74
70
  post_install_message:
75
71
  rdoc_options: []
76
-
77
- require_paths:
72
+ require_paths:
78
73
  - lib
79
- required_ruby_version: !ruby/object:Gem::Requirement
80
- none: false
81
- requirements:
82
- - - ">="
83
- - !ruby/object:Gem::Version
74
+ required_ruby_version: !ruby/object:Gem::Requirement
75
+ requirements:
76
+ - - '>='
77
+ - !ruby/object:Gem::Version
84
78
  version: 1.9.0
85
- required_rubygems_version: !ruby/object:Gem::Requirement
86
- none: false
87
- requirements:
88
- - - ">="
89
- - !ruby/object:Gem::Version
90
- version: "0"
79
+ required_rubygems_version: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - '>='
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
91
84
  requirements: []
92
-
93
85
  rubyforge_project:
94
- rubygems_version: 1.7.1
86
+ rubygems_version: 2.0.14
95
87
  signing_key:
96
- specification_version: 3
88
+ specification_version: 4
97
89
  summary: Batch Script Framework
98
- test_files:
90
+ test_files:
99
91
  - spec/01_rbach_spec.rb
100
92
  - spec/rbatch/cmd_spec.rb
101
93
  - spec/rbatch/config_spec.rb
@@ -106,4 +98,3 @@ test_files:
106
98
  - spec/rbatch/run_conf_spec.rb
107
99
  - spec/rbatch/variables_spec.rb
108
100
  - spec/spec_helper.rb
109
- has_rdoc: