Class: Kibo::Config
- Inherits:
-
Mash
- Object
- Mash
- Kibo::Config
- Defined in:
- lib/kibo/config.rb,
lib/kibo/config.rb
Constant Summary collapse
- DEFAULTS =
{ "heroku" => { "mode" => "freemium" }, "deployment" => {}, "collaborations" => {}, "source" => {}, "sharing" => [], "addons" => {} }
Instance Attribute Summary collapse
-
#environment ⇒ Object
readonly
Returns the value of attribute environment.
Instance Method Summary collapse
- #freemium? ⇒ Boolean
-
#initialize(kibofile, environment) ⇒ Config
constructor
A new instance of Config.
-
#instances ⇒ Object
return an array of instances.
- #namespace ⇒ Object
- #processes ⇒ Object
Constructor Details
#initialize(kibofile, environment) ⇒ Config
Returns a new instance of Config.
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/kibo/config.rb', line 18 def initialize(kibofile, environment) @kibofile, @environment = kibofile, environment @kibofile = File. @kibofile kibo = begin YAML.load File.read(kibofile) rescue Errno::ENOENT E "No such file", File.(@kibofile) end build_config(kibo) verify_config end |
Instance Attribute Details
#environment ⇒ Object (readonly)
Returns the value of attribute environment.
16 17 18 |
# File 'lib/kibo/config.rb', line 16 def environment @environment end |
Instance Method Details
#freemium? ⇒ Boolean
37 38 39 |
# File 'lib/kibo/config.rb', line 37 def freemium? heroku.mode == "freemium" end |
#instances ⇒ Object
return an array of instances.
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/kibo/config.rb', line 103 def instances instances = if freemium? processes.map do |process, count| 1.upto(count).map { |idx| Kibo::Instance::Freemium.new self, process, idx } end.flatten else processes.map do |process, count| Kibo::Instance.new self, process, count end end instances.sort_by(&:to_s) end |
#namespace ⇒ Object
41 42 43 |
# File 'lib/kibo/config.rb', line 41 def namespace heroku.namespace end |
#processes ⇒ Object
32 33 34 35 |
# File 'lib/kibo/config.rb', line 32 def processes return unless processes = super processes.reject { |k,v| v.to_s.to_i <= 0 } end |