Class: EY::Config::EnvironmentConfig
- Inherits:
-
Object
- Object
- EY::Config::EnvironmentConfig
- Defined in:
- lib/engineyard/config.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #branch ⇒ Object
- #ensure_exists ⇒ Object
- #fetch(key, default = nil, &block) ⇒ Object
-
#initialize(config, name, parent) ⇒ EnvironmentConfig
constructor
A new instance of EnvironmentConfig.
- #migrate ⇒ Object
- #migration_command ⇒ Object (also: #migrate_command)
- #path ⇒ Object
- #verbose ⇒ Object
Constructor Details
#initialize(config, name, parent) ⇒ EnvironmentConfig
Returns a new instance of EnvironmentConfig.
103 104 105 106 107 |
# File 'lib/engineyard/config.rb', line 103 def initialize(config, name, parent) @config = config || {} @name = name @parent = parent end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
101 102 103 |
# File 'lib/engineyard/config.rb', line 101 def name @name end |
Instance Method Details
#branch ⇒ Object
125 126 127 |
# File 'lib/engineyard/config.rb', line 125 def branch fetch('branch', nil) end |
#ensure_exists ⇒ Object
113 114 115 116 117 |
# File 'lib/engineyard/config.rb', line 113 def ensure_exists unless path && path.exist? raise EY::Error, "Please initialize this application with the following command:\n\tey init" end end |
#fetch(key, default = nil, &block) ⇒ Object
119 120 121 122 123 |
# File 'lib/engineyard/config.rb', line 119 def fetch(key, default = nil, &block) @config.fetch(key.to_s) do @parent.fetch_from_defaults(key.to_s, default, &block) end end |
#migrate ⇒ Object
129 130 131 132 133 134 |
# File 'lib/engineyard/config.rb', line 129 def migrate ensure_exists fetch('migrate') do raise EY::Error, "'migrate' not found in #{path}. Reinitialize with:\n\tey init" end end |
#migration_command ⇒ Object Also known as: migrate_command
136 137 138 139 140 141 |
# File 'lib/engineyard/config.rb', line 136 def migration_command ensure_exists fetch('migration_command') do raise EY::Error, "'migration_command' not found in #{path}. Reinitialize with:\n\tey init" end end |
#path ⇒ Object
109 110 111 |
# File 'lib/engineyard/config.rb', line 109 def path @parent.path end |
#verbose ⇒ Object
145 146 147 |
# File 'lib/engineyard/config.rb', line 145 def verbose fetch('verbose', false) end |