kumo_keisei 3.1.1.pre.alpha4 → 3.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/kumo_keisei/stack.rb +4 -7
- data/spec/lib/kumo_keisei/stack_spec.rb +17 -46
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e434e0c19435d10b3c7a986b87979a47f693a8fc
|
4
|
+
data.tar.gz: 442d92aa71ecfb60f7955e2fb244afd8708020b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63fc7d4caf90e0d0c1725540d6758c361117f10149d47f6c3d8208170326c0905f0af5bc4d4f3f1c35e901172f201e5055c0140e20a4a88acb2e6eae4313e4a6
|
7
|
+
data.tar.gz: 823a33b5d53bb23e3810c9f1d0fa662a5fa96415c2e82401fdea70d5bc2f2d5e0b7569424619f7591d56c5e8c8d62678463133f918965073affea9b1784a82b9
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.1.1
|
1
|
+
3.1.1
|
data/lib/kumo_keisei/stack.rb
CHANGED
@@ -29,10 +29,10 @@ module KumoKeisei
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def initialize(app_name, environment_name, options = { confirmation_timeout: 30, waiter_delay: 20, waiter_attempts: 90 })
|
32
|
-
type = options
|
32
|
+
type = options[:type]
|
33
33
|
@env_name = environment_name
|
34
34
|
@app_name = app_name
|
35
|
-
@stack_name = "#{app_name}-#{type}-#{ environment_name }"
|
35
|
+
@stack_name = type.nil? ? "#{app_name}-#{ environment_name }" : "#{app_name}-#{type}-#{ environment_name }"
|
36
36
|
@confirmation_timeout = options[:confirmation_timeout]
|
37
37
|
@waiter_delay = options[:waiter_delay]
|
38
38
|
@waiter_attempts = options[:waiter_attempts]
|
@@ -85,10 +85,6 @@ module KumoKeisei
|
|
85
85
|
environment_config(stack_config).config
|
86
86
|
end
|
87
87
|
|
88
|
-
def params_template_path(stack_config)
|
89
|
-
stack_config.has_key?(:template_path) ? File.absolute_path(File.join(File.dirname(stack_config[:template_path]), "#{File.basename(stack_config[:template_path], '.*')}.yml.erb")) : nil
|
90
|
-
end
|
91
|
-
|
92
88
|
private
|
93
89
|
|
94
90
|
def transform_logical_resource_id(id)
|
@@ -166,7 +162,8 @@ module KumoKeisei
|
|
166
162
|
end
|
167
163
|
|
168
164
|
def environment_config(stack_config)
|
169
|
-
|
165
|
+
params_template_path = stack_config.has_key?(:template_path) ? File.absolute_path(File.join(File.dirname(stack_config[:template_path]), "#{@app_name}.yml.erb")) : nil
|
166
|
+
EnvironmentConfig.new(stack_config.merge(params_template_file_path: params_template_path))
|
170
167
|
end
|
171
168
|
|
172
169
|
def stack_events_url
|
@@ -10,10 +10,9 @@ describe KumoKeisei::Stack do
|
|
10
10
|
|
11
11
|
let(:app_name) { "my-stack" }
|
12
12
|
let(:environment_name) { 'non-production' }
|
13
|
-
let(:stack_name) { "#{app_name}
|
14
|
-
let(:
|
15
|
-
let(:
|
16
|
-
let(:stack_cfnparams_filename) { "#{stack_template_name}.yml.erb" }
|
13
|
+
let(:stack_name) { "#{app_name}-#{environment_name}" }
|
14
|
+
let(:stack_template_path) { "#{app_name}-#{environment_name}.json" }
|
15
|
+
let(:file_params_path) { nil }
|
17
16
|
let(:cloudformation) { instance_double(Aws::CloudFormation::Client) }
|
18
17
|
let(:happy_stack_status) { "CREATE_COMPLETE" }
|
19
18
|
let(:cf_stack) { stack_result_list_with_status(happy_stack_status, stack_name) }
|
@@ -35,7 +34,7 @@ describe KumoKeisei::Stack do
|
|
35
34
|
let(:stack_config) {
|
36
35
|
{
|
37
36
|
config_path: 'config-path',
|
38
|
-
template_path:
|
37
|
+
template_path: stack_template_path,
|
39
38
|
injected_config: { 'VpcId' => 'vpc-id' },
|
40
39
|
env_name: 'non-production'
|
41
40
|
}
|
@@ -50,10 +49,9 @@ describe KumoKeisei::Stack do
|
|
50
49
|
allow(Aws::CloudFormation::Client).to receive(:new).and_return(cloudformation)
|
51
50
|
allow(cloudformation).to receive(:describe_stacks).with({stack_name: stack_name}).and_return(cf_stack)
|
52
51
|
allow(KumoKeisei::ParameterBuilder).to receive(:new).and_return(parameter_builder)
|
53
|
-
allow(File).to receive(:read).with(
|
54
|
-
allow(KumoKeisei::EnvironmentConfig).to receive(:new).with(stack_config.merge(params_template_file_path: "
|
55
|
-
|
56
|
-
Dir.chdir('/')
|
52
|
+
allow(File).to receive(:read).with(stack_template_path).and_return(stack_template_body)
|
53
|
+
allow(KumoKeisei::EnvironmentConfig).to receive(:new).with(stack_config.merge(params_template_file_path: "#{app_name}.yml.erb")).and_return(double(:environment_config, cf_params: {}))
|
54
|
+
allow(File).to receive(:absolute_path).and_return("#{app_name}.yml.erb")
|
57
55
|
end
|
58
56
|
|
59
57
|
describe "#destroy!" do
|
@@ -273,8 +271,8 @@ describe KumoKeisei::Stack do
|
|
273
271
|
end
|
274
272
|
|
275
273
|
describe "#type" do
|
276
|
-
it "
|
277
|
-
expect(subject.stack_name).to eq("#{app_name}
|
274
|
+
it "uses appname-environment name as stack name if the type is not set" do
|
275
|
+
expect(subject.stack_name).to eq("#{app_name}-#{environment_name}")
|
278
276
|
end
|
279
277
|
|
280
278
|
it "embeds the type into the name of the stack if set" do
|
@@ -285,8 +283,11 @@ describe KumoKeisei::Stack do
|
|
285
283
|
|
286
284
|
describe "#config" do
|
287
285
|
context "when passed a config_path and params_template_file_path" do
|
286
|
+
before do
|
287
|
+
allow(KumoKeisei::EnvironmentConfig).to receive(:new).with(stack_config.merge(params_template_file_path: "#{app_name}.yml.erb")).and_return(double(:environment_config, cf_params: {}, config: { :foo=> 'bar', :baz=> 'qux' }))
|
288
|
+
end
|
289
|
+
|
288
290
|
it "will return the results of the nested KumoKeisei::EnvironmentConfig.config" do
|
289
|
-
expect(KumoKeisei::EnvironmentConfig).to receive(:new).with(stack_config.merge(params_template_file_path: "/#{stack_template_name}.yml.erb")).and_return(double(:environment_config, cf_params: {}, config: { :foo=> 'bar', :baz=> 'qux' }))
|
290
291
|
expect(subject.config(stack_config)).to eq({:foo=> 'bar', :baz=>'qux'})
|
291
292
|
end
|
292
293
|
end
|
@@ -299,8 +300,11 @@ describe KumoKeisei::Stack do
|
|
299
300
|
}
|
300
301
|
}
|
301
302
|
|
303
|
+
before do
|
304
|
+
allow(KumoKeisei::EnvironmentConfig).to receive(:new).with(stack_config.merge(params_template_file_path: nil)).and_return(double(:environment_config, cf_params: {}, config: { :foo=> 'bar', :baz=> 'qux' }))
|
305
|
+
end
|
306
|
+
|
302
307
|
it "will return the results of the nested KumoKeisei::EnvironmentConfig.config" do
|
303
|
-
expect(KumoKeisei::EnvironmentConfig).to receive(:new).with(stack_config.merge(params_template_file_path: nil)).and_return(double(:environment_config, cf_params: {}, config: { :foo=> 'bar', :baz=> 'qux' }))
|
304
308
|
expect(subject.config(stack_config)).to eq({:foo=> 'bar', :baz=>'qux'})
|
305
309
|
end
|
306
310
|
end
|
@@ -318,37 +322,4 @@ describe KumoKeisei::Stack do
|
|
318
322
|
end
|
319
323
|
end
|
320
324
|
|
321
|
-
describe "#params_template_path" do
|
322
|
-
context "when looking for the parameter template file" do
|
323
|
-
CFN_STACK_TEMPLATE_TO_PARAMATER_TEMPLATE = {
|
324
|
-
'/foo/app.json' => '/foo/app.yml.erb',
|
325
|
-
'/foo/rds.json' => '/foo/rds.yml.erb'
|
326
|
-
}
|
327
|
-
|
328
|
-
CFN_STACK_TEMPLATE_TO_PARAMATER_TEMPLATE.each_pair do |cfn_template, parameter_template|
|
329
|
-
context "given #{cfn_template}" do
|
330
|
-
let(:stack_cfntemplate_filename) { "#{cfn_template}" }
|
331
|
-
it "uses a matching file in the form of #{parameter_template}" do
|
332
|
-
expect(subject.params_template_path(stack_config)).to eq(File.join(Dir.pwd, parameter_template))
|
333
|
-
end
|
334
|
-
end
|
335
|
-
end
|
336
|
-
end
|
337
|
-
|
338
|
-
context "when the parameter template file has not been passed in" do
|
339
|
-
let(:stack_config) {
|
340
|
-
{
|
341
|
-
config_path: 'config-path',
|
342
|
-
injected_config: { 'VpcId' => 'vpc-id' },
|
343
|
-
env_name: 'non-production'
|
344
|
-
}
|
345
|
-
}
|
346
|
-
|
347
|
-
it "will return nil" do
|
348
|
-
expect(subject.params_template_path(stack_config)).to be_nil
|
349
|
-
end
|
350
|
-
end
|
351
|
-
|
352
|
-
end
|
353
|
-
|
354
325
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kumo_keisei
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.1
|
4
|
+
version: 3.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Redbubble
|
@@ -130,9 +130,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
130
130
|
version: '0'
|
131
131
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
132
132
|
requirements:
|
133
|
-
- - "
|
133
|
+
- - ">="
|
134
134
|
- !ruby/object:Gem::Version
|
135
|
-
version:
|
135
|
+
version: '0'
|
136
136
|
requirements: []
|
137
137
|
rubyforge_project:
|
138
138
|
rubygems_version: 2.2.2
|