Class: RBatch::Controller
- Inherits:
-
Object
- Object
- RBatch::Controller
- Defined in:
- lib/rbatch/controller.rb
Instance Attribute Summary (collapse)
-
- (Object) common_config
readonly
Returns the value of attribute common_config.
-
- (Object) config
readonly
end def.
-
- (Object) journal
readonly
Returns the value of attribute journal.
-
- (Object) user_logs
readonly
Returns the value of attribute user_logs.
-
- (Object) vars
readonly
Returns the value of attribute vars.
Instance Method Summary (collapse)
- - (Object) cmd(cmd_str, opt)
-
- (Controller) initialize
constructor
A new instance of Controller.
Constructor Details
- (Controller) initialize
Returns a new instance of Controller
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/rbatch/controller.rb', line 13 def initialize @vars = RBatch::Variables.new() RBatch::Journal.def_vars = @vars RBatch::Log.def_vars = @vars RBatch::Cmd.def_vars = @vars @journal = RBatch::Journal.new() RBatch::Log.journal = @journal @user_logs = [] @journal.put 1,"=== START RBatch === (PID=#{$$.to_s})" @journal.put 1, "RB_HOME : \"#{@vars[:home_dir]}\"" @journal.put 1, "Load Run-Conf: \"#{@vars[:run_conf_path]}\"" @journal.put 2, "RBatch Variables : #{@vars.inspect}" @common_config = RBatch::Config.new(@vars[:common_config_path]) @journal.put 1, "Load Config : \"#{@vars[:common_config_path]}\"" if @common_config.exist? @config = RBatch::Config.new(@vars[:config_path]) @journal.put 1, "Load Config : \"#{@vars[:config_path]}\"" if @config.exist? # double_run_check if ( @vars[:forbid_double_run]) RBatch::DoubleRunChecker.check(@vars[:program_base]) #raise error if check is NG RBatch::DoubleRunChecker.make_lock_file(@vars[:program_base]) end # load_lib if @vars[:auto_lib_load] && Dir.exist?(@vars[:lib_dir]) Dir::foreach(@vars[:lib_dir]) do |file| if /.*rb/ =~ file require File.join(@vars[:lib_dir],File.basename(file,".rb")) @journal.put 1, "Load Library : \"#{File.join(@vars[:lib_dir],file)}\" " end end end @journal.put 1, "Start Script : \"#{@vars[:program_path]}\"" end |
Instance Attribute Details
- (Object) common_config (readonly)
Returns the value of attribute common_config
12 13 14 |
# File 'lib/rbatch/controller.rb', line 12 def common_config @common_config end |
- (Object) config (readonly)
end def
46 47 48 |
# File 'lib/rbatch/controller.rb', line 46 def config @config end |
- (Object) journal (readonly)
Returns the value of attribute journal
12 13 14 |
# File 'lib/rbatch/controller.rb', line 12 def journal @journal end |
- (Object) user_logs (readonly)
Returns the value of attribute user_logs
12 13 14 |
# File 'lib/rbatch/controller.rb', line 12 def user_logs @user_logs end |
- (Object) vars (readonly)
Returns the value of attribute vars
12 13 14 |
# File 'lib/rbatch/controller.rb', line 12 def vars @vars end |
Instance Method Details
- (Object) cmd(cmd_str, opt)
48 49 50 |
# File 'lib/rbatch/controller.rb', line 48 def cmd(cmd_str,opt) RBatch::Cmd.new(cmd_str,opt).run end |