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

#cronObject



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

def cron; @body["cron"] || {}; 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



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_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

#runObject



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

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

#slack?Boolean

Returns:

  • (Boolean)


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

def slack?; slack_url && slack_channel; end

#slack_channelObject



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

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

#slack_urlObject



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

def slack_url; @body["slack_url"]; 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