Class: Discharger::SetupRunner::Configuration
- Inherits:
-
Object
- Object
- Discharger::SetupRunner::Configuration
- Defined in:
- lib/discharger/setup_runner/configuration.rb
Instance Attribute Summary collapse
-
#app_name ⇒ Object
Returns the value of attribute app_name.
-
#custom_steps ⇒ Object
Returns the value of attribute custom_steps.
-
#database ⇒ Object
Returns the value of attribute database.
-
#pre_steps ⇒ Object
Returns the value of attribute pre_steps.
-
#redis ⇒ Object
Returns the value of attribute redis.
-
#services ⇒ Object
Returns the value of attribute services.
-
#steps ⇒ Object
Returns the value of attribute steps.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
10 11 12 13 14 15 16 17 18 |
# File 'lib/discharger/setup_runner/configuration.rb', line 10 def initialize @app_name = "Application" @database = DatabaseConfig.new @redis = nil @services = [] @steps = [] @custom_steps = [] @pre_steps = [] end |
Instance Attribute Details
#app_name ⇒ Object
Returns the value of attribute app_name.
8 9 10 |
# File 'lib/discharger/setup_runner/configuration.rb', line 8 def app_name @app_name end |
#custom_steps ⇒ Object
Returns the value of attribute custom_steps.
8 9 10 |
# File 'lib/discharger/setup_runner/configuration.rb', line 8 def custom_steps @custom_steps end |
#database ⇒ Object
Returns the value of attribute database.
8 9 10 |
# File 'lib/discharger/setup_runner/configuration.rb', line 8 def database @database end |
#pre_steps ⇒ Object
Returns the value of attribute pre_steps.
8 9 10 |
# File 'lib/discharger/setup_runner/configuration.rb', line 8 def pre_steps @pre_steps end |
#redis ⇒ Object
Returns the value of attribute redis.
8 9 10 |
# File 'lib/discharger/setup_runner/configuration.rb', line 8 def redis @redis end |
#services ⇒ Object
Returns the value of attribute services.
8 9 10 |
# File 'lib/discharger/setup_runner/configuration.rb', line 8 def services @services end |
#steps ⇒ Object
Returns the value of attribute steps.
8 9 10 |
# File 'lib/discharger/setup_runner/configuration.rb', line 8 def steps @steps end |
Class Method Details
.from_file(path) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/discharger/setup_runner/configuration.rb', line 20 def self.from_file(path) config = new yaml = YAML.load_file(path) # Handle empty YAML files return config if yaml.nil? || yaml == false config.app_name = yaml["app_name"] if yaml["app_name"] config.database.from_hash(yaml["database"]) if yaml["database"] config.redis = RedisConfig.new.tap { |r| r.from_hash(yaml["redis"]) } if yaml["redis"] config.services = yaml["services"] || [] config.steps = yaml["steps"] || [] config.custom_steps = yaml["custom_steps"] || [] config.pre_steps = yaml["pre_steps"] || [] config end |