stackit 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2e7de2608c7a0e73290b8a44445327d9f4972838
4
- data.tar.gz: e4dfcca00d75cc44fc0955545d5c1a161737a9bb
3
+ metadata.gz: 085a8e4f91fb78f0e6d84144add50f1ffac44d2e
4
+ data.tar.gz: bbe91f3ff0a581cdb8655b11dfed18e338b23dbf
5
5
  SHA512:
6
- metadata.gz: 436f1b7afa9173edce27d93965fc859f6bff41ce019a5571993063775e0979fc657331f189bb28c7805d33045bed38f117efe016201389ad6a6584f49de9b007
7
- data.tar.gz: 8a7643cb0183945ced21ea8569ef31c439af7c40ed5a651bb10fcd291130370b48ba49b836ba45299b3d175a430e571fe8bc7301ec1fe1c7d1481da396fd31d5
6
+ metadata.gz: 415f7583f29fd840aea24ab6d15c7fd5e01167e4fca2f1c157dc30710897fb9be74fb96479f89ae21661384663956701ab57e8a5e885cf7b119a8d4153292912
7
+ data.tar.gz: 7b33a406e9b789407c7059011df59613e7a21c9cf0e87eb7d0895aa89065ddf431955030b173e540b4eebbf551265d6dbbe25e2d2909d907be38a98b39db4dfd
@@ -147,22 +147,11 @@ module Stackit
147
147
  end
148
148
 
149
149
  def resolve_parameter(key)
150
- depends_stacks.each do |_stack|
151
- value = _stack[key.to_s]
152
- return value unless value.nil?
153
- end
154
- nil
150
+ Stackit::ParameterResolver.new(depends_stacks).resolve(key)
155
151
  end
156
152
 
157
153
  def resolve_parameters(keys)
158
- values = []
159
- depends_stacks.each do |s|
160
- keys.each do |key|
161
- value = s[key.to_s]
162
- values << value unless value.nil?
163
- end
164
- end
165
- values.join(',')
154
+ Stackit::ParameterResolver.new(depends_stacks).resolve(keys)
166
155
  end
167
156
 
168
157
  private
@@ -0,0 +1,42 @@
1
+ module Stackit
2
+
3
+ class ParameterResolver
4
+
5
+ attr_accessor :stacks
6
+
7
+ def initialize(stacks)
8
+ self.stacks = stacks.is_a?(Array) ? stacks : [stacks]
9
+ end
10
+
11
+ def resolve(parameter)
12
+ if parameter.is_a?(Array)
13
+ resolve_parameters(parameter)
14
+ else
15
+ resolve_parameter(parameter)
16
+ end
17
+ end
18
+
19
+ private
20
+
21
+ def resolve_parameter(key)
22
+ stacks.each do |_stack|
23
+ value = _stack[key.to_s]
24
+ return value unless value.nil?
25
+ end
26
+ nil
27
+ end
28
+
29
+ def resolve_parameters(keys)
30
+ values = []
31
+ stacks.each do |s|
32
+ keys.each do |key|
33
+ value = s[key.to_s]
34
+ values << value unless value.nil?
35
+ end
36
+ end
37
+ values.join(',')
38
+ end
39
+
40
+ end
41
+
42
+ end
@@ -1,3 +1,3 @@
1
1
  module Stackit
2
- VERSION = "0.3.3"
2
+ VERSION = "0.3.4"
3
3
  end
data/lib/stackit.rb CHANGED
@@ -1,5 +1,4 @@
1
1
  require "logger"
2
- require "pp"
3
2
  require "json"
4
3
  require "active_support"
5
4
  require "active_support/all"
@@ -12,6 +11,7 @@ require "stackit/wait"
12
11
  require "stackit/stack"
13
12
  require "stackit/stack/managed_stack"
14
13
  require "stackit/stack/managed_stack_service"
14
+ require "stackit/stack/parameter_resolver"
15
15
 
16
16
  module Stackit
17
17
  class << self
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stackit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Hahn
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-05-08 00:00:00.000000000 Z
11
+ date: 2016-05-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -154,6 +154,7 @@ files:
154
154
  - lib/stackit/stack/managed_stack.rb
155
155
  - lib/stackit/stack/managed_stack_service.rb
156
156
  - lib/stackit/stack/opsworks_managed_stack_service.rb
157
+ - lib/stackit/stack/parameter_resolver.rb
157
158
  - lib/stackit/template.rb
158
159
  - lib/stackit/version.rb
159
160
  - lib/stackit/wait.rb
@@ -185,7 +186,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
185
186
  version: '0'
186
187
  requirements: []
187
188
  rubyforge_project:
188
- rubygems_version: 2.4.8
189
+ rubygems_version: 2.2.2
189
190
  signing_key:
190
191
  specification_version: 4
191
192
  summary: Simple, elegant CloudFormation dependency management.