Class: Drydock::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/drydocker.rb

Overview

Configuration file reader

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ Config

Returns a new instance of Config.



19
20
21
22
23
24
25
26
27
# File 'lib/drydocker.rb', line 19

def initialize(params = {})
  config = Config.default_config.merge(params)
  @name = config[:name] || "#{config[:image]}-test"
  @entrypoint = config[:entrypoint]
  @image = config[:image]
  @command = config[:command]
  @path = config[:path]
  @testing = config[:testing]
end

Instance Attribute Details

#commandObject (readonly)

Returns the value of attribute command.



7
8
9
# File 'lib/drydocker.rb', line 7

def command
  @command
end

#entrypointObject (readonly)

Returns the value of attribute entrypoint.



7
8
9
# File 'lib/drydocker.rb', line 7

def entrypoint
  @entrypoint
end

#imageObject (readonly)

Returns the value of attribute image.



7
8
9
# File 'lib/drydocker.rb', line 7

def image
  @image
end

#nameObject (readonly)

Returns the value of attribute name.



7
8
9
# File 'lib/drydocker.rb', line 7

def name
  @name
end

#pathObject (readonly)

Returns the value of attribute path.



7
8
9
# File 'lib/drydocker.rb', line 7

def path
  @path
end

Class Method Details

.default_configObject



9
10
11
12
13
14
15
16
17
# File 'lib/drydocker.rb', line 9

def self.default_config
  {
    name: nil,
    image: 'silarsis/drydocker',
    command: 'rspec spec',
    entrypoint: nil,
    path: `pwd`.strip
  }
end