stackup 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +6 -6
- data/lib/stackup/cli.rb +34 -25
- data/lib/stackup/stack.rb +14 -7
- data/lib/stackup.rb +4 -3
- data/pkg/stackup-0.0.4.gem +0 -0
- data/pkg/stackup-0.0.5.gem +0 -0
- data/spec/stackup/stack_spec.rb +7 -6
- data/stackup.gemspec +21 -21
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a76fe73e3081eb43b4b664f82ab8018f43d95e0
|
4
|
+
data.tar.gz: e888b62cdd79ecb05ae03c366b5deadcee497ddb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3d3b377393f712fe04de5ec8ce6b9a4527b8a9a1f15cef60c009483b0317d3d317f2ae453e75936e9b48f423644b63fbfa15b7c62f6b7c90ac16044c3bba17b3
|
7
|
+
data.tar.gz: 6f639914a99aed8803ee9a72cc3055b0f0071e0af561519c848b032d1e3ddb0e025f79ccd5c00eb00321e2ff130148ac98538ff8b5a840d2fcc7b279d60496f8
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
stackup (0.0.
|
4
|
+
stackup (0.0.4)
|
5
5
|
aws-sdk (~> 2.0)
|
6
6
|
clamp (~> 1.0)
|
7
7
|
|
@@ -11,12 +11,12 @@ GEM
|
|
11
11
|
ast (2.1.0)
|
12
12
|
astrolabe (1.3.1)
|
13
13
|
parser (~> 2.2)
|
14
|
-
aws-sdk (2.1.
|
15
|
-
aws-sdk-resources (= 2.1.
|
16
|
-
aws-sdk-core (2.1.
|
14
|
+
aws-sdk (2.1.21)
|
15
|
+
aws-sdk-resources (= 2.1.21)
|
16
|
+
aws-sdk-core (2.1.21)
|
17
17
|
jmespath (~> 1.0)
|
18
|
-
aws-sdk-resources (2.1.
|
19
|
-
aws-sdk-core (= 2.1.
|
18
|
+
aws-sdk-resources (2.1.21)
|
19
|
+
aws-sdk-core (= 2.1.21)
|
20
20
|
byebug (6.0.2)
|
21
21
|
clamp (1.0.0)
|
22
22
|
diff-lcs (1.2.5)
|
data/lib/stackup/cli.rb
CHANGED
@@ -1,25 +1,34 @@
|
|
1
|
-
module Stackup
|
2
|
-
class CLI < Clamp::Command
|
3
|
-
|
4
|
-
subcommand ["stack"], "Manage a stack." do
|
5
|
-
parameter "STACK-NAME", "Name of stack", :attribute_name => :stack_name
|
6
|
-
|
7
|
-
subcommand "
|
8
|
-
parameter "TEMPLATE", "CloudFormation template (.json)", :attribute_name => :template
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
1
|
+
module Stackup
|
2
|
+
class CLI < Clamp::Command
|
3
|
+
|
4
|
+
subcommand ["stack"], "Manage a stack." do
|
5
|
+
parameter "STACK-NAME", "Name of stack", :attribute_name => :stack_name
|
6
|
+
|
7
|
+
subcommand "deploy", "Create/update the stack" do
|
8
|
+
parameter "TEMPLATE", "CloudFormation template (.json)", :attribute_name => :template
|
9
|
+
parameter "PARAMETERS", "CloudFormation parameters (.json)", :attribute_name => :parameters
|
10
|
+
|
11
|
+
def execute
|
12
|
+
params = JSON.parse(parameters)
|
13
|
+
stack = Stackup::Stack.new(stack_name)
|
14
|
+
stack.create(template, params)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
subcommand "delete", "Remove the stack." do
|
19
|
+
def execute
|
20
|
+
stack = Stackup::Stack.new(stack_name)
|
21
|
+
stack.delete
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
subcommand "outputs", "Stack outputs." do
|
26
|
+
def execute
|
27
|
+
stack = Stackup::Stack.new(stack_name)
|
28
|
+
stack.outputs
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
data/lib/stackup/stack.rb
CHANGED
@@ -15,25 +15,28 @@ module Stackup
|
|
15
15
|
@name = name
|
16
16
|
end
|
17
17
|
|
18
|
-
def create(template)
|
18
|
+
def create(template, parameters)
|
19
19
|
response = cf.create_stack(:stack_name => name,
|
20
20
|
:template_body => template,
|
21
|
-
:disable_rollback => true
|
21
|
+
:disable_rollback => true,
|
22
|
+
:parameters => parameters)
|
22
23
|
wait_till_end
|
23
24
|
!response[:stack_id].nil?
|
24
25
|
end
|
25
26
|
|
26
|
-
def deploy(template)
|
27
|
+
def deploy(template, parameters = [])
|
27
28
|
if deployed?
|
28
|
-
update(template)
|
29
|
+
update(template, parameters)
|
29
30
|
else
|
30
|
-
create(template)
|
31
|
+
create(template, parameters)
|
31
32
|
end
|
33
|
+
rescue Aws::CloudFormation::Errors::ValidationError => e
|
34
|
+
puts e.message
|
32
35
|
end
|
33
36
|
|
34
|
-
def update(template)
|
37
|
+
def update(template, parameters)
|
35
38
|
return false unless deployed?
|
36
|
-
response = cf.update_stack(:stack_name => name, :template_body => template)
|
39
|
+
response = cf.update_stack(:stack_name => name, :template_body => template, :parameters => parameters)
|
37
40
|
wait_till_end
|
38
41
|
!response[:stack_id].nil?
|
39
42
|
end
|
@@ -45,6 +48,10 @@ module Stackup
|
|
45
48
|
puts "Stack does not exist."
|
46
49
|
end
|
47
50
|
|
51
|
+
def outputs
|
52
|
+
puts stack.outputs.flat_map { |output| "#{output.output_key} - #{output.output_value}" }
|
53
|
+
end
|
54
|
+
|
48
55
|
def display_events
|
49
56
|
monitor.new_events.each do |e|
|
50
57
|
ts = e.timestamp.localtime.strftime("%H:%M:%S")
|
data/lib/stackup.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
-
require "aws-sdk"
|
2
|
-
require_relative "stackup/monitor"
|
3
|
-
require_relative "stackup/stack"
|
1
|
+
require "aws-sdk"
|
2
|
+
require_relative "stackup/monitor"
|
3
|
+
require_relative "stackup/stack"
|
4
|
+
require "json"
|
Binary file
|
Binary file
|
data/spec/stackup/stack_spec.rb
CHANGED
@@ -5,6 +5,7 @@ describe Stackup::Stack do
|
|
5
5
|
let(:template) { double(String) }
|
6
6
|
let(:cf_stack) { double(Aws::CloudFormation::Stack) }
|
7
7
|
let(:cf) { double(Aws::CloudFormation::Client) }
|
8
|
+
let(:parameters) { [] }
|
8
9
|
|
9
10
|
before do
|
10
11
|
allow(Aws::CloudFormation::Client).to receive(:new).and_return(cf)
|
@@ -16,12 +17,12 @@ describe Stackup::Stack do
|
|
16
17
|
it "should call create if stack is not deployed" do
|
17
18
|
allow(stack).to receive(:deployed?).and_return(false)
|
18
19
|
expect(stack).to receive(:create).and_return(true)
|
19
|
-
expect(stack.deploy(template)).to be true
|
20
|
+
expect(stack.deploy(template, parameters)).to be true
|
20
21
|
end
|
21
22
|
it "should call update if stack is deployed" do
|
22
23
|
allow(stack).to receive(:deployed?).and_return(true)
|
23
24
|
expect(stack).to receive(:update).and_return(true)
|
24
|
-
expect(stack.deploy(template)).to be true
|
25
|
+
expect(stack.deploy(template, parameters)).to be true
|
25
26
|
end
|
26
27
|
end
|
27
28
|
|
@@ -32,12 +33,12 @@ describe Stackup::Stack do
|
|
32
33
|
allow(response).to receive(:[]).with(:stack_id).and_return("1")
|
33
34
|
allow(cf).to receive(:update_stack).and_return(response)
|
34
35
|
allow(cf_stack).to receive(:wait_until).and_return(true)
|
35
|
-
expect(stack.update(template)).to be true
|
36
|
+
expect(stack.update(template, parameters)).to be true
|
36
37
|
end
|
37
38
|
|
38
39
|
it "should not update if the stack is not deployed" do
|
39
40
|
allow(cf_stack).to receive(:stack_status).and_raise(Aws::CloudFormation::Errors::ValidationError.new("1", "2"))
|
40
|
-
expect(stack.update(template)).to be false
|
41
|
+
expect(stack.update(template, parameters)).to be false
|
41
42
|
end
|
42
43
|
end
|
43
44
|
|
@@ -56,14 +57,14 @@ describe Stackup::Stack do
|
|
56
57
|
allow(response).to receive(:[]).with(:stack_id).and_return("1")
|
57
58
|
allow(cf).to receive(:create_stack).and_return(response)
|
58
59
|
allow(cf_stack).to receive(:wait_until).and_return(true)
|
59
|
-
expect(stack.create(template)).to be true
|
60
|
+
expect(stack.create(template, parameters)).to be true
|
60
61
|
end
|
61
62
|
|
62
63
|
it "should return nil if stack was not created" do
|
63
64
|
allow(response).to receive(:[]).with(:stack_id).and_return(nil)
|
64
65
|
allow(cf).to receive(:create_stack).and_return(response)
|
65
66
|
allow(cf_stack).to receive(:wait_until).and_return(false)
|
66
|
-
expect(stack.create(template)).to be false
|
67
|
+
expect(stack.create(template, parameters)).to be false
|
67
68
|
end
|
68
69
|
end
|
69
70
|
|
data/stackup.gemspec
CHANGED
@@ -1,21 +1,21 @@
|
|
1
|
-
lib = File.expand_path("../lib", __FILE__)
|
2
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
-
|
4
|
-
Gem::Specification.new do |spec|
|
5
|
-
|
6
|
-
spec.name = "stackup"
|
7
|
-
spec.version = "0.0.
|
8
|
-
spec.authors = ["Arvind Kunday", "Mike Williams"]
|
9
|
-
spec.email = ["arvind.kunday@rea-group.com", "mike.williams@rea-group.com"]
|
10
|
-
spec.summary = "Tools for deployment to AWS"
|
11
|
-
spec.homepage = "https://github.com/realestate-com-au/stackup"
|
12
|
-
spec.license = "MIT"
|
13
|
-
|
14
|
-
spec.files = Dir["**/*"].reject { |f| File.directory?(f) }
|
15
|
-
spec.executables = spec.files.grep(/^bin/) { |f| File.basename(f) }
|
16
|
-
spec.require_paths = ["lib"]
|
17
|
-
|
18
|
-
spec.add_dependency "aws-sdk", "~> 2.0"
|
19
|
-
spec.add_dependency "clamp", "~> 1.0"
|
20
|
-
|
21
|
-
end
|
1
|
+
lib = File.expand_path("../lib", __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
|
4
|
+
Gem::Specification.new do |spec|
|
5
|
+
|
6
|
+
spec.name = "stackup"
|
7
|
+
spec.version = "0.0.5"
|
8
|
+
spec.authors = ["Arvind Kunday", "Mike Williams"]
|
9
|
+
spec.email = ["arvind.kunday@rea-group.com", "mike.williams@rea-group.com"]
|
10
|
+
spec.summary = "Tools for deployment to AWS"
|
11
|
+
spec.homepage = "https://github.com/realestate-com-au/stackup"
|
12
|
+
spec.license = "MIT"
|
13
|
+
|
14
|
+
spec.files = Dir["**/*"].reject { |f| File.directory?(f) }
|
15
|
+
spec.executables = spec.files.grep(/^bin/) { |f| File.basename(f) }
|
16
|
+
spec.require_paths = ["lib"]
|
17
|
+
|
18
|
+
spec.add_dependency "aws-sdk", "~> 2.0"
|
19
|
+
spec.add_dependency "clamp", "~> 1.0"
|
20
|
+
|
21
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stackup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arvind Kunday
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-09-
|
12
|
+
date: 2015-09-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: aws-sdk
|
@@ -59,6 +59,8 @@ files:
|
|
59
59
|
- lib/stackup/stack.rb
|
60
60
|
- pkg/stackup-0.0.2.gem
|
61
61
|
- pkg/stackup-0.0.3.gem
|
62
|
+
- pkg/stackup-0.0.4.gem
|
63
|
+
- pkg/stackup-0.0.5.gem
|
62
64
|
- sample.json
|
63
65
|
- spec/spec_helper.rb
|
64
66
|
- spec/stackup/monitor_spec.rb
|