stackit 0.1.0 → 0.1.1

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: 426eae8667b341e8834521f00605632edd98b19d
4
- data.tar.gz: dc9890de3f68a1ee7198ea22597f46bbd7266a39
3
+ metadata.gz: 2aff5ca524ea49528392a501576e27e9aa944e6c
4
+ data.tar.gz: c21c2bd9ea0fa51735eb6fc4fe0ef537aed4e6e7
5
5
  SHA512:
6
- metadata.gz: 8cc56791184964fbf5752e5cf493b3c4cb5845c43beae200d33845dbc0bce23b5e34ffe3a4903a1c223943817fe942d3f7cc9198150b2279a0053d98039fb52f
7
- data.tar.gz: 196c75963e0d8fe4c4ebde6645a2d4eab0103028c18622856b87ae3c198dfe3ca287b74a6fc878e70fb3944e94f86ad406cb7be84b4f82c2135724ad86fae9fa
6
+ metadata.gz: 7a01703e3394799d829b01e4a9b783169df5e6b705d7141e5d78488e147d76061fbc6d5593c390041d129be0237b25fc7f555a7b0e7fb0f2f20cc50b6091b6b8
7
+ data.tar.gz: 9ea4daf3f9fb5775886d72afd792fdd7e634c32011dcc71d65fef8f26cb637d7496fb230933bbc54b436bdbfec1d190c09043f8ee19808b34f5e2cc3419c7048
data/lib/stackit.rb CHANGED
@@ -1,10 +1,10 @@
1
1
  require "logger"
2
2
  require "pp"
3
- require "stackit/version"
4
- require 'json'
3
+ require "json"
5
4
  require "active_support"
6
5
  require "active_support/all"
7
6
  require "awsclient"
7
+ require "stackit/version"
8
8
  require "stackit/aws"
9
9
  require "stackit/template"
10
10
  require "stackit/stack/default_notifier"
data/lib/stackit/stack.rb CHANGED
@@ -43,7 +43,7 @@ module Stackit
43
43
  def parameters
44
44
  @parameters ||= begin
45
45
  stack.parameters.inject({}) do |hash, param|
46
- hash.merge(param[:parameter_key] => param[:parameter_value])
46
+ hash.merge(param[:parameter_key].to_sym => param[:parameter_value])
47
47
  end
48
48
  rescue ::Aws::CloudFormation::Errors::ValidationError => e
49
49
  [] if e.message =~ /Stack with id #{stack_name} does not exist/
@@ -53,7 +53,7 @@ module Stackit
53
53
  def outputs
54
54
  @outputs ||= begin
55
55
  stack.outputs.inject({}) do |hash, output|
56
- hash.merge(output[:output_key] => output[:output_value])
56
+ hash.merge(output[:output_key].to_sym => output[:output_value])
57
57
  end
58
58
  rescue ::Aws::CloudFormation::Errors::ValidationError => e
59
59
  [] if e.message =~ /Stack with id #{stack_name} does not exist/
@@ -62,7 +62,7 @@ module Stackit
62
62
 
63
63
  def resources
64
64
  @resources ||= list_stack_resources.inject({}) do |hash, resource|
65
- hash.merge(resource[:logical_resource_id] => resource[:physical_resource_id])
65
+ hash.merge(resource[:logical_resource_id].to_sym => resource[:physical_resource_id])
66
66
  end
67
67
  end
68
68
 
@@ -40,7 +40,7 @@ module Stackit
40
40
  if param_map
41
41
  param_map.symbolize_keys!
42
42
  else
43
- []
43
+ {}
44
44
  end
45
45
  end
46
46
 
@@ -51,7 +51,10 @@ module Stackit
51
51
  def create_template(t)
52
52
  template_path = t ? t : File.join(Dir.pwd, 'cloudformation', "#{stack_name.underscore.dasherize}.json")
53
53
  return unless File.exist?(template_path)
54
- template = Template.new(:template_path => template_path)
54
+ template = Template.new(
55
+ :cloudformation => cloudformation,
56
+ :template_path => template_path
57
+ )
55
58
  template.parse!
56
59
  end
57
60
 
@@ -219,37 +222,23 @@ module Stackit
219
222
  end
220
223
  end
221
224
 
222
- def dependent_parameters
223
- depends.inject([]) do |arr, dep|
224
- arr.push(Stackit::Stack.new(stack_name))
225
- end
226
- end
227
-
228
225
  def merged_parameters
229
-
230
- parsed_parameters = template.parsed_parameters
226
+ merged_params = template.parsed_parameters
231
227
  return parsed_parameters unless depends.length
232
-
233
- validated_parameters = parsed_parameters.clone
234
-
235
228
  # merge file parameters
236
- validated_parameters.merge!(file_parameters) if file_parameters
237
-
238
- # merge --depends
229
+ merged_params.merge!(file_parameters) if file_parameters
239
230
  depends.each do |dependent_stack_name|
240
231
  this_stack = Stack.new({
241
232
  cloudformation: cloudformation,
242
233
  stack_name: dependent_stack_name
243
234
  })
244
- validated_parameters.select { |param|
235
+ merged_params.select { |param|
245
236
  !this_stack[mapped_key(param.to_s)].nil?
246
237
  }.each do | param_name, param_value |
247
- validated_parameters.merge!(param_name => this_stack[mapped_key(param_name)])
238
+ merged_params.merge!(param_name => this_stack[mapped_key(param_name)])
248
239
  end
249
240
  end
250
-
251
- # merge user defined parameters
252
- validated_parameters.merge!(user_defined_parameters)
241
+ merged_params.merge!(user_defined_parameters)
253
242
  end
254
243
 
255
244
  def mapped_key(param)
@@ -1,3 +1,3 @@
1
1
  module Stackit
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
data/stackit.gemspec CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
9
9
  spec.email = ["mail@jeremyhahn.com"]
10
10
 
11
11
  spec.summary = %q{Simple, elegant CloudFormation dependency management.}
12
- spec.description = %q{Use existing stack values (output, resource, or parameters) as input parmeters to templates.}
12
+ spec.description = %q{Use existing stack values (output, resource, or parameters) as input parmeters to CloudFormation templates.}
13
13
  spec.homepage = "https://github.com/jeremyhahn/stackit"
14
14
  spec.license = "GPLv3"
15
15
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stackit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Hahn
@@ -123,7 +123,7 @@ dependencies:
123
123
  - !ruby/object:Gem::Version
124
124
  version: '4.2'
125
125
  description: Use existing stack values (output, resource, or parameters) as input
126
- parmeters to templates.
126
+ parmeters to CloudFormation templates.
127
127
  email:
128
128
  - mail@jeremyhahn.com
129
129
  executables: []