viaduct-archfile 1.1.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/viaduct/archfile.rb +21 -4
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8d164f78021907716248fcc7aed40481d4fb0ab5
4
- data.tar.gz: d6ba5c7379ad322451e900e2b74d171e503edee0
3
+ metadata.gz: e15dbd6cd5536390c19fa9071c10306b7d8ef69a
4
+ data.tar.gz: 3927c31b07fda66de86b8cf02a370737700cfb90
5
5
  SHA512:
6
- metadata.gz: c0436d77b895bdbc2f3c0199b2cd0b0414cc4f8079296d9091b06a0ac9a01451ca87355b7c64bd24083733532325921c50b38083119cb19270019d5904271270
7
- data.tar.gz: 058fd4f9d5ac3db252a77e9e5cff26591a7139cb2a4096b3d5d0daabe63eebeab2a919e5105863a01da70d007b34191c1962ec7961f8afd9491ab12f842d7596
6
+ metadata.gz: 6927fa58d1b7acc461f7f810ebae3006ec27524d7570aa05e9529b90a9c5de07aed41b8299f0b624a3deb445efe558f6387fffbb3f6a45985158415dc5d8bc9d
7
+ data.tar.gz: dc824b742729d7562011935a641370af0dcc6c31ddb42abf1ec3cdb672df8f4ed5e4698ed859c6b935112a1c0b52841738e6a0d5165f2ec67ded90d367a4bf59
@@ -43,11 +43,25 @@ module Viaduct
43
43
  @current_namespace = ns
44
44
  end
45
45
 
46
+ #
47
+ # Return the current namespace
48
+ #
49
+ def current_namespace
50
+ @current_namespace ||= []
51
+ end
52
+
53
+ #
54
+ # Return the current hash
55
+ #
56
+ def current_hash
57
+ @current_hash ||= spec
58
+ end
59
+
46
60
  #
47
61
  # Add an error
48
62
  #
49
63
  def add_error(key, message)
50
- errors << [key.nil? ? nil : "#{@current_namespace.join('.')}.#{key}", message]
64
+ errors << [key.nil? ? nil : "#{current_namespace.join('.')}.#{key}".gsub(/\A\./, ''), message]
51
65
  end
52
66
 
53
67
  #
@@ -64,6 +78,11 @@ module Viaduct
64
78
  def validate
65
79
  @errors = []
66
80
 
81
+ #
82
+ # Ensure we have a stack
83
+ #
84
+ ensure_inclusion remote_properties['application_stacks'], 'stack'
85
+
67
86
  #
68
87
  # Check settings
69
88
  #
@@ -89,7 +108,6 @@ module Viaduct
89
108
  namespace process, 'processes', index
90
109
  ensure_string('command')
91
110
  ensure_inclusion(remote_properties['container_memory_allocations'], 'memory')
92
- ensure_inclusion(remote_properties['application_stacks'], 'stack')
93
111
  ensure_integer('quantity')
94
112
  ensure_matches(PATH_REGEX, 'name')
95
113
  ensure_integer('kill_after') if process['kill_after']
@@ -139,7 +157,6 @@ module Viaduct
139
157
  if spec['commands'].is_a?(Array)
140
158
  spec['commands'].each_with_index do |command, index|
141
159
  namespace command, 'commands', index
142
- ensure_inclusion remote_properties['application_stacks'], 'stack'
143
160
  ensure_inclusion remote_properties['command_events'], 'event'
144
161
  ensure_string 'command'
145
162
  ensure_integer 'success_exit_code'
@@ -163,7 +180,7 @@ module Viaduct
163
180
  private
164
181
 
165
182
  def value_for(item)
166
- @current_hash.is_a?(Hash) ? @current_hash[item] : nil
183
+ current_hash.is_a?(Hash) ? current_hash[item] : nil
167
184
  end
168
185
 
169
186
  def ensure_boolean(*items)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: viaduct-archfile
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Cooke
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-29 00:00:00.000000000 Z
11
+ date: 2014-02-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: safe_yaml