Class: Dockerploy::Configuration
- Inherits:
-
Object
- Object
- Dockerploy::Configuration
- Defined in:
- lib/dockerploy/configuration.rb
Constant Summary collapse
- NoEnvError =
Class.new(StandardError)
- FileNotFound =
Class.new(StandardError)
- DEFAULT_CONFIG_FILE =
'docker/config.yml'.freeze
Instance Attribute Summary collapse
-
#application_name ⇒ Object
readonly
Returns the value of attribute application_name.
-
#docker_host ⇒ Object
readonly
Returns the value of attribute docker_host.
-
#env ⇒ Object
readonly
Returns the value of attribute env.
-
#image_name ⇒ Object
readonly
Returns the value of attribute image_name.
Instance Method Summary collapse
- #branch ⇒ Object
- #env_file ⇒ Object
-
#initialize(options = {}) ⇒ Configuration
constructor
A new instance of Configuration.
- #servers ⇒ Object
- #tagging? ⇒ Boolean
- #volumes ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Configuration
Returns a new instance of Configuration.
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/dockerploy/configuration.rb', line 9 def initialize( = {}) @config_file = .fetch(:config_file, DEFAULT_CONFIG_FILE) @env = .fetch(:env) @env = @env.to_sym if @env raise FileNotFound unless File.exist?(@config_file) config = YAML.load_file(@config_file).symbolize_keys @application_name = config.fetch(:application_name) @docker_host = config.fetch(:docker_host) @image_name = config.fetch(:image_name) end |
Instance Attribute Details
#application_name ⇒ Object (readonly)
Returns the value of attribute application_name.
7 8 9 |
# File 'lib/dockerploy/configuration.rb', line 7 def application_name @application_name end |
#docker_host ⇒ Object (readonly)
Returns the value of attribute docker_host.
7 8 9 |
# File 'lib/dockerploy/configuration.rb', line 7 def docker_host @docker_host end |
#env ⇒ Object (readonly)
Returns the value of attribute env.
7 8 9 |
# File 'lib/dockerploy/configuration.rb', line 7 def env @env end |
#image_name ⇒ Object (readonly)
Returns the value of attribute image_name.
7 8 9 |
# File 'lib/dockerploy/configuration.rb', line 7 def image_name @image_name end |
Instance Method Details
#branch ⇒ Object
35 36 37 38 |
# File 'lib/dockerploy/configuration.rb', line 35 def branch raise NoEnvError if @env.nil? [@env][:branch] end |
#env_file ⇒ Object
30 31 32 33 |
# File 'lib/dockerploy/configuration.rb', line 30 def env_file raise NoEnvError if @env.nil? [@env][:env_file] end |
#servers ⇒ Object
20 21 22 23 |
# File 'lib/dockerploy/configuration.rb', line 20 def servers raise NoEnvError if @env.nil? [@env][:servers] end |
#tagging? ⇒ Boolean
40 41 42 43 |
# File 'lib/dockerploy/configuration.rb', line 40 def tagging? raise NoEnvError if @env.nil? [@env][:tagging] end |
#volumes ⇒ Object
25 26 27 28 |
# File 'lib/dockerploy/configuration.rb', line 25 def volumes raise NoEnvError if @env.nil? [@env][:volumes] end |