Class: FigNewton::Config
- Inherits:
-
Object
- Object
- FigNewton::Config
- Defined in:
- lib/fig-newton/config.rb
Class Method Summary collapse
Instance Method Summary collapse
- #apps ⇒ Object
-
#initialize(data, filename) ⇒ Config
constructor
A new instance of Config.
- #name ⇒ Object
Constructor Details
#initialize(data, filename) ⇒ Config
Returns a new instance of Config.
17 18 19 20 |
# File 'lib/fig-newton/config.rb', line 17 def initialize(data, filename) @data = data @filename = filename end |
Class Method Details
.filepath_from_stack(config_dir, stack_name) ⇒ Object
6 7 8 |
# File 'lib/fig-newton/config.rb', line 6 def self.filepath_from_stack(config_dir, stack_name) File.join(config_dir, "#{stack_name}.yml") end |
.from_file(config_dir, stack_name) ⇒ Object
10 11 12 13 14 15 |
# File 'lib/fig-newton/config.rb', line 10 def self.from_file(config_dir, stack_name) filename = absolute_path(config_dir, stack_name) data = YAML::load_file(filename) new(data, filename) end |
Instance Method Details
#apps ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/fig-newton/config.rb', line 26 def apps @apps ||= data["apps"].each_with_object({}) do |app, apps| name, config = app.flatten apps[name] = FigNewton::App.new(name, config) apps end end |
#name ⇒ Object
22 23 24 |
# File 'lib/fig-newton/config.rb', line 22 def name data["name"] end |