lono-cfn 0.0.5 → 0.0.6

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: dba98f281ab98c5eb7332eda9a4c03b9e90813b8
4
- data.tar.gz: ea1923322e0a914d25fc979198447c99d8c48c62
3
+ metadata.gz: 15502b5cd0ce076c8866ee2495d2d23e8e856b4d
4
+ data.tar.gz: '0715039ad6cceb813f049b22a15de5056fa81e42'
5
5
  SHA512:
6
- metadata.gz: 14c6d2c31564cd843ca90ed1a40a2f0d5f8f682b529d5964408b5571f167eab786c12983ba48c8d81aa68ba0c28a663ac00e1a023e6b552f105ed4082452fbc8
7
- data.tar.gz: 1a34a56708bbd269993157d0abfc7bb67149ba7810152847bb96388205104bb41624bac8f96cdbaa2e2ec5b87a58c5703ce591a75db05747a74cdeee6729ae33
6
+ metadata.gz: 82482c93760d52309c2f50933eb6f22af933ff0eb5e8d7260d14fbcdb88b1961518eafa41219b56df823f532749ee3e5db0500c0851f7c72132655dbadfaaff8
7
+ data.tar.gz: fff6fd771a4346cd9e22bbf1cc4910f8f2bd5b28dd54281c0b32bcdc931183ea5becc51e24b6e8d96d182a55d6c10e03a795a04b3e245f9880ea8d9014140d61
data/CHANGELOG.md CHANGED
@@ -3,6 +3,10 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  This project *tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
5
5
 
6
+ ## [0.0.6] add delete stack command
7
+
8
+ - add delete stack command
9
+
6
10
  ## [0.0.5] nicer error message
7
11
 
8
12
  - nicer error message when theres no stack update to be perform
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- lono-cfn (0.0.3)
4
+ lono-cfn (0.0.6)
5
5
  aws-sdk
6
6
  colorize
7
7
  hashie
@@ -12,22 +12,24 @@ PATH
12
12
  GEM
13
13
  remote: https://rubygems.org/
14
14
  specs:
15
- activemodel (4.0.13)
16
- activesupport (= 4.0.13)
17
- builder (~> 3.1.0)
18
- activesupport (4.0.13)
19
- i18n (~> 0.6, >= 0.6.9)
20
- minitest (~> 4.2)
21
- multi_json (~> 1.3)
22
- thread_safe (~> 0.1)
23
- tzinfo (~> 0.3.37)
24
- aws-sdk (2.6.5)
25
- aws-sdk-resources (= 2.6.5)
26
- aws-sdk-core (2.6.5)
15
+ activemodel (4.2.8)
16
+ activesupport (= 4.2.8)
17
+ builder (~> 3.1)
18
+ activesupport (4.2.8)
19
+ i18n (~> 0.7)
20
+ minitest (~> 5.1)
21
+ thread_safe (~> 0.3, >= 0.3.4)
22
+ tzinfo (~> 1.1)
23
+ aws-sdk (2.9.11)
24
+ aws-sdk-resources (= 2.9.11)
25
+ aws-sdk-core (2.9.11)
26
+ aws-sigv4 (~> 1.0)
27
27
  jmespath (~> 1.0)
28
- aws-sdk-resources (2.6.5)
29
- aws-sdk-core (= 2.6.5)
30
- builder (3.1.4)
28
+ aws-sdk-resources (2.9.11)
29
+ aws-sdk-core (= 2.9.11)
30
+ aws-sigv4 (1.0.0)
31
+ builder (3.2.3)
32
+ byebug (9.0.6)
31
33
  codeclimate-test-reporter (0.6.0)
32
34
  simplecov (>= 0.7.1, < 1.0.0)
33
35
  coderay (1.1.1)
@@ -60,8 +62,8 @@ GEM
60
62
  guard (~> 2.1)
61
63
  guard-compat (~> 1.1)
62
64
  rspec (>= 2.99.0, < 4.0)
63
- hashie (3.4.6)
64
- i18n (0.7.0)
65
+ hashie (3.5.5)
66
+ i18n (0.8.1)
65
67
  jmespath (1.3.1)
66
68
  json (2.0.2)
67
69
  listen (3.1.5)
@@ -84,13 +86,12 @@ GEM
84
86
  thor
85
87
  lumberjack (1.0.10)
86
88
  method_source (0.8.2)
87
- minitest (4.7.5)
88
- multi_json (1.12.1)
89
+ minitest (5.10.1)
89
90
  nenv (0.3.0)
90
91
  notiffany (0.1.1)
91
92
  nenv (~> 0.1)
92
93
  shellany (~> 0.0)
93
- plissken (0.2.0)
94
+ plissken (0.3.0)
94
95
  symbolize (~> 4.2)
95
96
  pry (0.10.4)
96
97
  coderay (~> 1.1.0)
@@ -126,14 +127,16 @@ GEM
126
127
  activesupport (>= 3.2, < 5)
127
128
  i18n
128
129
  thor (0.19.1)
129
- thread_safe (0.3.5)
130
- tzinfo (0.3.51)
130
+ thread_safe (0.3.6)
131
+ tzinfo (1.2.3)
132
+ thread_safe (~> 0.1)
131
133
 
132
134
  PLATFORMS
133
135
  ruby
134
136
 
135
137
  DEPENDENCIES
136
138
  bundler (~> 1.3)
139
+ byebug
137
140
  codeclimate-test-reporter
138
141
  guard
139
142
  guard-bundler
@@ -142,4 +145,4 @@ DEPENDENCIES
142
145
  rake
143
146
 
144
147
  BUNDLED WITH
145
- 1.12.5
148
+ 1.14.6
data/lib/lono-cfn.rb CHANGED
@@ -3,8 +3,10 @@ require "lono_cfn/version"
3
3
  require "pp"
4
4
 
5
5
  module LonoCfn
6
+ autoload :AwsServices, 'lono_cfn/aws_services'
6
7
  autoload :CLI, 'lono_cfn/cli'
7
8
  autoload :Base, 'lono_cfn/base'
8
9
  autoload :Create, 'lono_cfn/create'
9
10
  autoload :Update, 'lono_cfn/update'
11
+ autoload :Delete, 'lono_cfn/delete'
10
12
  end
@@ -0,0 +1,9 @@
1
+ require "aws-sdk"
2
+
3
+ module LonoCfn
4
+ module AwsServices
5
+ def cfn
6
+ @cfn ||= Aws::CloudFormation::Client.new
7
+ end
8
+ end
9
+ end
data/lib/lono_cfn/base.rb CHANGED
@@ -1,9 +1,10 @@
1
1
  require "lono"
2
2
  require "lono-params"
3
- require "aws-sdk"
4
3
 
5
4
  module LonoCfn
6
5
  class Base
6
+ include AwsServices
7
+
7
8
  def initialize(stack_name, options={})
8
9
  @stack_name = stack_name
9
10
  @options = options
@@ -40,10 +41,6 @@ module LonoCfn
40
41
  generator.params # Returns Array in underscore keys format
41
42
  end
42
43
 
43
- def cfn
44
- @cfn ||= Aws::CloudFormation::Client.new
45
- end
46
-
47
44
  def check_for_errors
48
45
  errors = check_files
49
46
  unless errors.empty?
@@ -65,7 +62,8 @@ module LonoCfn
65
62
  end
66
63
 
67
64
  def stack_exists?
68
- return if @options[:noop]
65
+ return true if testing_update?
66
+ return false if @options[:noop]
69
67
 
70
68
  exist = true
71
69
  begin
@@ -104,5 +102,9 @@ module LonoCfn
104
102
  raise "hell: dont come here"
105
103
  end
106
104
  end
105
+
106
+ def testing_update?
107
+ ENV['TEST'] && self.class.name == "LonoCfn::Update"
108
+ end
107
109
  end
108
110
  end
data/lib/lono_cfn/cli.rb CHANGED
@@ -25,5 +25,11 @@ module LonoCfn
25
25
  def update(name)
26
26
  Update.new(name, options).run
27
27
  end
28
+
29
+ desc "delete STACK", "delete a CloudFormation stack"
30
+ long_desc Help.delete
31
+ def delete(name)
32
+ Delete.new(name, options).run
33
+ end
28
34
  end
29
35
  end
@@ -53,6 +53,16 @@ $ lono-cfn update my-stack --template different-name3 --params different-name4
53
53
 
54
54
  The template that will be use is output/different-name3.json and the parameters will use params/different-name4.json.
55
55
 
56
+ EOL
57
+ end
58
+
59
+ def delete
60
+ <<-EOL
61
+ Examples:
62
+
63
+ $ lono-cfn delete my-stack
64
+
65
+ The above command will delete my-stack.
56
66
  EOL
57
67
  end
58
68
  end
@@ -0,0 +1,21 @@
1
+ module LonoCfn
2
+ class Delete
3
+ include AwsServices
4
+
5
+ def initialize(stack_name, options={})
6
+ @stack_name = stack_name
7
+ @options = options
8
+ @project_root = options[:project_root] || '.'
9
+ end
10
+
11
+ def run
12
+ message = "Deleted #{@stack_name}."
13
+ if @options[:noop]
14
+ message = "NOOP #{message}"
15
+ else
16
+ cfn.delete_stack(stack_name: @stack_name)
17
+ end
18
+ puts message
19
+ end
20
+ end
21
+ end
@@ -1,3 +1,3 @@
1
1
  module LonoCfn
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
data/lono_cfn.gemspec CHANGED
@@ -30,4 +30,5 @@ Gem::Specification.new do |spec|
30
30
  spec.add_development_dependency "guard"
31
31
  spec.add_development_dependency "guard-bundler"
32
32
  spec.add_development_dependency "guard-rspec"
33
+ spec.add_development_dependency "byebug"
33
34
  end
data/spec/lib/cli_spec.rb CHANGED
@@ -20,5 +20,10 @@ describe LonoCfn::CLI do
20
20
  out = execute("bin/lono-cfn update my-stack #{@args}")
21
21
  expect(out).to include("stack updating.")
22
22
  end
23
+
24
+ it "deletes stack" do
25
+ out = execute("bin/lono-cfn delete my-stack #{@args}")
26
+ expect(out).to include("Deleted")
27
+ end
23
28
  end
24
29
  end
data/spec/spec_helper.rb CHANGED
@@ -4,7 +4,7 @@ require "codeclimate-test-reporter"
4
4
  CodeClimate::TestReporter.start
5
5
 
6
6
  require "pp"
7
-
7
+
8
8
  root = File.expand_path('../../', __FILE__)
9
9
  require "#{root}/lib/lono-cfn"
10
10
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lono-cfn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tung Nguyen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-24 00:00:00.000000000 Z
11
+ date: 2017-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -164,6 +164,20 @@ dependencies:
164
164
  - - ">="
165
165
  - !ruby/object:Gem::Version
166
166
  version: '0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: byebug
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
167
181
  description: Wrapper cfn tool to quickly create CloudFormation stacks from lono templates
168
182
  and params files
169
183
  email:
@@ -184,10 +198,12 @@ files:
184
198
  - Rakefile
185
199
  - bin/lono-cfn
186
200
  - lib/lono-cfn.rb
201
+ - lib/lono_cfn/aws_services.rb
187
202
  - lib/lono_cfn/base.rb
188
203
  - lib/lono_cfn/cli.rb
189
204
  - lib/lono_cfn/cli/help.rb
190
205
  - lib/lono_cfn/create.rb
206
+ - lib/lono_cfn/delete.rb
191
207
  - lib/lono_cfn/update.rb
192
208
  - lib/lono_cfn/version.rb
193
209
  - lono_cfn.gemspec