Module: Milc::Base
- Defined in:
- lib/milc/base.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
-
#project ⇒ Object
readonly
Returns the value of attribute project.
Instance Method Summary collapse
- #dry_run ⇒ Object
- #execute(cmd, options = {}) ⇒ Object
-
#help_message ⇒ Object
overriden.
-
#load_config ⇒ Object
overriden.
-
#load_options(options) ⇒ Object
overriden.
- #logger ⇒ Object
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
30 31 32 |
# File 'lib/milc/base.rb', line 30 def config @config end |
#project ⇒ Object (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_run ⇒ Object
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, = {}) [:dry_run] = Milc.dry_run res = LoggerPipe.run(logger, cmd, ) block_given? ? yield(res) : res end |
#help_message ⇒ Object
overriden
43 44 45 46 47 48 |
# File 'lib/milc/base.rb', line 43 def ## スクリプト名 cmdname = File.basename($0) # $PROGRAM_NAME を推奨 ## シェルスクリプトのUsage "Usage: #{cmdname} -c CONF_FILE" end |
#load_config ⇒ Object
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 () end |
#logger ⇒ Object
20 21 22 |
# File 'lib/milc/base.rb', line 20 def logger Milc.logger end |