Class: AppRb::Config
- Inherits:
-
Object
- Object
- AppRb::Config
- Defined in:
- lib/app-rb/config.rb
Defined Under Namespace
Classes: Node
Instance Method Summary collapse
- #app ⇒ Object
- #consul ⇒ Object
- #deploy ⇒ Object
- #env ⇒ Object
- #image ⇒ Object
-
#initialize(yml) ⇒ Config
constructor
A new instance of Config.
- #nodes(constraint = nil) ⇒ Object
- #pre_deploy ⇒ Object
- #registry ⇒ Object
- #tool_version ⇒ Object
- #user ⇒ Object
Constructor Details
#initialize(yml) ⇒ Config
Returns a new instance of Config.
2 3 4 |
# File 'lib/app-rb/config.rb', line 2 def initialize(yml) @body = yml end |
Instance Method Details
#app ⇒ Object
7 |
# File 'lib/app-rb/config.rb', line 7 def app; @body["app"]; end |
#consul ⇒ Object
8 |
# File 'lib/app-rb/config.rb', line 8 def consul; @body["consul"]; end |
#deploy ⇒ Object
14 |
# File 'lib/app-rb/config.rb', line 14 def deploy; @body["deploy"] || {}; end |
#env ⇒ Object
12 |
# File 'lib/app-rb/config.rb', line 12 def env; @body["env"] || {}; end |
#image ⇒ Object
11 |
# File 'lib/app-rb/config.rb', line 11 def image; @body["image"]; end |
#nodes(constraint = nil) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/app-rb/config.rb', line 16 def nodes(constraint = nil) constraint ||= {} out = __nodes if constraint["role"] out = out.select { |n| n.roles.index(constraint["role"]) } end if constraint["name"] out = out.select { |n| n.name == constraint["name"] } end out end |
#pre_deploy ⇒ Object
13 |
# File 'lib/app-rb/config.rb', line 13 def pre_deploy; @body["pre_deploy"] || []; end |
#registry ⇒ Object
9 |
# File 'lib/app-rb/config.rb', line 9 def registry; @body["registry"]; end |
#tool_version ⇒ Object
6 |
# File 'lib/app-rb/config.rb', line 6 def tool_version; @body["tool_version"]; end |
#user ⇒ Object
10 |
# File 'lib/app-rb/config.rb', line 10 def user; @body["user"]; end |