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
- #cron ⇒ 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
- #run ⇒ Object
- #slack? ⇒ Boolean
- #slack_channel ⇒ Object
- #slack_url ⇒ 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 |
#cron ⇒ Object
15 |
# File 'lib/app-rb/config.rb', line 15 def cron; @body["cron"] || {}; 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
21 22 23 24 25 26 27 28 |
# File 'lib/app-rb/config.rb', line 21 def nodes(constraint = nil) constraint ||= {} out = __nodes if constraint["name"] out = out.select { |n| Array(constraint["name"]).index(n.name) } end out.shuffle 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 |
#run ⇒ Object
16 |
# File 'lib/app-rb/config.rb', line 16 def run; @body["run"] || {}; end |
#slack? ⇒ Boolean
19 |
# File 'lib/app-rb/config.rb', line 19 def slack?; slack_url && slack_channel; end |
#slack_channel ⇒ Object
18 |
# File 'lib/app-rb/config.rb', line 18 def slack_channel; @body["slack_channel"]; end |
#slack_url ⇒ Object
17 |
# File 'lib/app-rb/config.rb', line 17 def slack_url; @body["slack_url"]; 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 |