Module: Milc::Base

Defined in:
lib/milc/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#configObject

Returns the value of attribute config.



30
31
32
# File 'lib/milc/base.rb', line 30

def config
  @config
end

#projectObject (readonly)

Returns the value of attribute project.



31
32
33
# File 'lib/milc/base.rb', line 31

def project
  @project
end

Instance Method Details

#dry_runObject



33
34
35
# File 'lib/milc/base.rb', line 33

def dry_run
  Milc.dry_run
end

#execute(cmd, options = {}) ⇒ Object



24
25
26
27
28
# File 'lib/milc/base.rb', line 24

def execute(cmd, options = {})
  options[:dry_run] = Milc.dry_run
  res = LoggerPipe.run(logger, cmd, options)
  block_given? ? yield(res) : res
end

#help_messageObject

overriden



43
44
45
46
47
48
# File 'lib/milc/base.rb', line 43

def help_message
  ## スクリプト名
  cmdname = File.basename($0) # $PROGRAM_NAME を推奨
  ## シェルスクリプトのUsage
  "Usage: #{cmdname} -c CONF_FILE"
end

#load_configObject

overriden



38
39
40
# File 'lib/milc/base.rb', line 38

def load_config
  @project = config['PROJECT'] || ENV['PROJECT']
end

#load_options(options) ⇒ Object

overriden



51
52
# File 'lib/milc/base.rb', line 51

def load_options(options)
end

#loggerObject



20
21
22
# File 'lib/milc/base.rb', line 20

def logger
  Milc.logger
end