Class: AppRb::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/app-rb/config.rb

Defined Under Namespace

Classes: Node

Instance Method Summary collapse

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

#appObject



7
# File 'lib/app-rb/config.rb', line 7

def app; @body["app"]; end

#consulObject



8
# File 'lib/app-rb/config.rb', line 8

def consul; @body["consul"]; end

#deployObject



14
# File 'lib/app-rb/config.rb', line 14

def deploy; @body["deploy"] || {}; end

#envObject



12
# File 'lib/app-rb/config.rb', line 12

def env; @body["env"] || {}; end

#imageObject



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_deployObject



13
# File 'lib/app-rb/config.rb', line 13

def pre_deploy; @body["pre_deploy"] || []; end

#registryObject



9
# File 'lib/app-rb/config.rb', line 9

def registry; @body["registry"]; end

#tool_versionObject



6
# File 'lib/app-rb/config.rb', line 6

def tool_version; @body["tool_version"]; end

#userObject



10
# File 'lib/app-rb/config.rb', line 10

def user; @body["user"]; end