Class: Drydocker::Config
- Inherits:
-
Object
- Object
- Drydocker::Config
- Defined in:
- lib/drydocker.rb
Overview
Configuration file reader
Instance Attribute Summary collapse
-
#command ⇒ Object
readonly
Returns the value of attribute command.
-
#entrypoint ⇒ Object
readonly
Returns the value of attribute entrypoint.
-
#image ⇒ Object
readonly
Returns the value of attribute image.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#verbose ⇒ Object
readonly
Returns the value of attribute verbose.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize(params = {}) ⇒ Config
Returns a new instance of Config.
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/drydocker.rb', line 22 def initialize(params = {}) config = Config.default_config.merge(params) @image = config[:image] @name = config[:name] || name_from_image @entrypoint = config[:entrypoint] @command = config[:command].shellescape @path = config[:path] @logger = Logger.new(STDERR) @logger.level = Logger::DEBUG if config[:verbose] end |
Instance Attribute Details
#command ⇒ Object (readonly)
Returns the value of attribute command.
9 10 11 |
# File 'lib/drydocker.rb', line 9 def command @command end |
#entrypoint ⇒ Object (readonly)
Returns the value of attribute entrypoint.
9 10 11 |
# File 'lib/drydocker.rb', line 9 def entrypoint @entrypoint end |
#image ⇒ Object (readonly)
Returns the value of attribute image.
9 10 11 |
# File 'lib/drydocker.rb', line 9 def image @image end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
9 10 11 |
# File 'lib/drydocker.rb', line 9 def logger @logger end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
9 10 11 |
# File 'lib/drydocker.rb', line 9 def name @name end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
9 10 11 |
# File 'lib/drydocker.rb', line 9 def path @path end |
#verbose ⇒ Object (readonly)
Returns the value of attribute verbose.
9 10 11 |
# File 'lib/drydocker.rb', line 9 def verbose @verbose end |
Class Method Details
.default_config ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/drydocker.rb', line 11 def self.default_config { name: nil, image: "silarsis/drydocker", command: "rspec spec", entrypoint: nil, path: `pwd`.strip, verbose: false } end |