Module: RBatch

Defined in:
lib/rbatch.rb,
lib/rbatch/log.rb,
lib/rbatch/cmd.rb,
lib/rbatch/config.rb,
lib/rbatch/version.rb,
lib/rbatch/journal.rb,
lib/rbatch/run_conf.rb,
lib/rbatch/variables.rb,
lib/rbatch/controller.rb,
lib/rbatch/double_run_checker.rb

Defined Under Namespace

Modules: DoubleRunChecker Classes: Cmd, CmdException, CmdResult, Config, ConfigElement, ConfigException, Controller, DoubleRunCheckException, Journal, Log, LogException, RunConf, RunConfException, Variables, VariablesException

Constant Summary

VERSION =
"2.4.0"
@@ctrl =
nil

Class Method Summary (collapse)

Class Method Details

+ (Object) cmd(cmd_str, opt = nil)

Shortcut of RBatch::Cmd.new(cmd_str,opt).run

Examples:

r = RBatch.cmd("ls")
p r.stdout # => "fileA\nfileB\n"
p r.stderr # => ""
p r.status # => 0
r = RBatch.cmd("rsync /foo /bar",{:timeout => 10})

See Also:



61
# File 'lib/rbatch.rb', line 61

def cmd(cmd_str,opt=nil) ; @@ctrl.cmd(cmd_str,opt) ; end

+ (RBatch::Config) common_config

Return Common-Config Object

Examples:

RB_HOME/conf/common.yaml

key: value
array:
 - item1
 - item2
 - item3

$RB_HOME/bin/hoge.rb

p RBatch.common_config["key"]   # => "value"
p RBatch.common_config["array"] # => ["item1", "item2", "item3"]
p RBatch.common_config["not_exist"] # => Raise RBatch::ConfigException

Returns:

Raises:



50
# File 'lib/rbatch.rb', line 50

def common_config        ; @@ctrl.common_config ; end

+ (RBatch::Config) config

Return Config Object

Examples:

RB_HOME/conf/hoge.yaml

key: value
array:
 - item1
 - item2
 - item3

$RB_HOME/bin/hoge.rb

p RBatch.config["key"]   # => "value"
p RBatch.config["array"] # => ["item1", "item2", "item3"]
p RBatch.config["not_exist"] # => Raise RBatch::ConfigException

Returns:

Raises:



35
# File 'lib/rbatch.rb', line 35

def config               ; @@ctrl.config ; end

+ (Object) ctrl



17
# File 'lib/rbatch.rb', line 17

def ctrl ; @@ctrl ; end

+ (Object) init



12
13
14
# File 'lib/rbatch.rb', line 12

def init
  @@ctrl = RBatch::Controller.new
end

+ (Object) vars



20
# File 'lib/rbatch.rb', line 20

def vars ; @@ctrl.vars ; end