cloudformer 0.0.13 → 0.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,5 @@
1
+ FROM ruby:2.1.2
2
+
3
+ ADD . /usr/local/app
4
+ WORKDIR /usr/local/app
5
+ RUN bundle install
data/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ ![Build Status](https://travis-ci.org/kunday/cloudformer.svg?branch=master)
2
+
1
3
  # CloudFormer
2
4
 
3
5
  Cloudformer attempts to simplify AWS Cloudformation stack creation process in ruby projects by providing reusable rake tasks to perform common operations such as apply(create/update), delete, recreate on stack along with validations on templates. Task executions which enforce a stack change will wait until ROLLBACK/COMPLETE or DELETE is signalled on the stack (useful in continuous deployment environments to wait until deployment is successful). Refer [examples section](#example) for more information.
data/Rakefile CHANGED
@@ -1 +1,12 @@
1
- require "bundler/gem_tasks"
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec'
3
+
4
+ begin
5
+ require 'rspec/core/rake_task'
6
+
7
+ RSpec::Core::RakeTask.new(:spec)
8
+
9
+ task :default => :spec
10
+ rescue LoadError
11
+ # no rspec available
12
+ end
@@ -28,7 +28,7 @@ class Stack
28
28
  validation = validate(template)
29
29
  unless validation["valid"]
30
30
  puts "Unable to update - #{validation["response"][:code]} - #{validation["response"][:message]}"
31
- return false
31
+ return :Failed
32
32
  end
33
33
  pending_operations = false
34
34
  begin
@@ -39,10 +39,10 @@ class Stack
39
39
  end
40
40
  rescue ::AWS::CloudFormation::Errors::ValidationError => e
41
41
  puts e.message
42
- return false
42
+ return (if e.message == "No updates are to be performed." then :NoUpdates else :Failed end)
43
43
  end
44
44
  wait_until_end if pending_operations
45
- return deploy_succeded?
45
+ return (if deploy_succeded? then :Succeeded else :Failed end)
46
46
  end
47
47
 
48
48
  def deploy_succeded?
@@ -35,7 +35,9 @@ module Cloudformer
35
35
  if retry_delete
36
36
  @stack.delete
37
37
  end
38
- exit 1 unless @stack.apply(template, parameters, disable_rollback, capabilities, notify)
38
+ result = @stack.apply(template, parameters, disable_rollback, capabilities, notify)
39
+ if result == :Failed then exit 1 end
40
+ if result == :NoUpdates then exit 2 end
39
41
  end
40
42
  end
41
43
 
@@ -1,3 +1,3 @@
1
1
  module Cloudformer
2
- VERSION = "0.0.13"
2
+ VERSION = "0.0.14"
3
3
  end
@@ -49,8 +49,38 @@ describe Stack do
49
49
  @cf_stack.should_receive(:update).and_raise(AWS::CloudFormation::Errors::ValidationError)
50
50
  end
51
51
 
52
- it "apply should return false to signal the error" do
53
- @stack.apply(nil, nil).should be_false
52
+ it "apply should return Failed to signal the error" do
53
+ @stack.apply(nil, nil).should be(:Failed)
54
54
  end
55
55
  end
56
- end
56
+
57
+ describe "when stack operation throws ValidationError because no updates are to be performed" do
58
+ before :each do
59
+ @stack = Stack.new("stack")
60
+ @cf_stack.should_receive(:exists?).and_return(true)
61
+ File.should_receive(:read).and_return("template")
62
+ @cf.should_receive(:validate_template).and_return({"valid" => true})
63
+ @cf_stack.should_receive(:update).and_raise(AWS::CloudFormation::Errors::ValidationError.new("No updates are to be performed."))
64
+ end
65
+
66
+ it "apply should return NoUpdate to signal the error" do
67
+ @stack.apply(nil, nil).should be(:NoUpdates)
68
+ end
69
+ end
70
+
71
+ describe "when stack update succeeds" do
72
+ before :each do
73
+ @stack = Stack.new("stack")
74
+ @cf_stack.should_receive(:exists?).at_least(:once).and_return(true)
75
+ File.should_receive(:read).and_return("template")
76
+ @cf.should_receive(:validate_template).and_return({"valid" => true})
77
+ @cf_stack.should_receive(:update).and_return(false)
78
+ @cf_stack.should_receive(:events).and_return([])
79
+ @cf_stack.should_receive(:status).at_least(:once).and_return("UPDATE_COMPLETE")
80
+ end
81
+
82
+ it "apply should return Succeeded" do
83
+ @stack.apply(nil, nil).should be(:Succeeded)
84
+ end
85
+ end
86
+ end
metadata CHANGED
@@ -1,69 +1,78 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudformer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.13
4
+ version: 0.0.14
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Arvind Kunday
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2014-10-08 00:00:00.000000000 Z
12
+ date: 2014-10-10 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: bundler
15
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
- - - "~>"
19
+ - - ~>
18
20
  - !ruby/object:Gem::Version
19
21
  version: '1.3'
20
22
  type: :development
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
23
26
  requirements:
24
- - - "~>"
27
+ - - ~>
25
28
  - !ruby/object:Gem::Version
26
29
  version: '1.3'
27
30
  - !ruby/object:Gem::Dependency
28
31
  name: rspec
29
32
  requirement: !ruby/object:Gem::Requirement
33
+ none: false
30
34
  requirements:
31
- - - ">="
35
+ - - ! '>='
32
36
  - !ruby/object:Gem::Version
33
37
  version: '0'
34
38
  type: :development
35
39
  prerelease: false
36
40
  version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
37
42
  requirements:
38
- - - ">="
43
+ - - ! '>='
39
44
  - !ruby/object:Gem::Version
40
45
  version: '0'
41
46
  - !ruby/object:Gem::Dependency
42
47
  name: rake
43
48
  requirement: !ruby/object:Gem::Requirement
49
+ none: false
44
50
  requirements:
45
- - - ">="
51
+ - - ! '>='
46
52
  - !ruby/object:Gem::Version
47
53
  version: '0'
48
54
  type: :runtime
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
51
58
  requirements:
52
- - - ">="
59
+ - - ! '>='
53
60
  - !ruby/object:Gem::Version
54
61
  version: '0'
55
62
  - !ruby/object:Gem::Dependency
56
63
  name: aws-sdk
57
64
  requirement: !ruby/object:Gem::Requirement
65
+ none: false
58
66
  requirements:
59
- - - ">="
67
+ - - ! '>='
60
68
  - !ruby/object:Gem::Version
61
69
  version: '0'
62
70
  type: :runtime
63
71
  prerelease: false
64
72
  version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
65
74
  requirements:
66
- - - ">="
75
+ - - ! '>='
67
76
  - !ruby/object:Gem::Version
68
77
  version: '0'
69
78
  description: Cloudformation tasks for apply(create/update), delete, recreate on stack
@@ -74,7 +83,8 @@ executables: []
74
83
  extensions: []
75
84
  extra_rdoc_files: []
76
85
  files:
77
- - ".gitignore"
86
+ - .gitignore
87
+ - Dockerfile
78
88
  - Gemfile
79
89
  - LICENSE.txt
80
90
  - README.md
@@ -90,26 +100,33 @@ files:
90
100
  homepage: https://github.com/kunday/cloudformer
91
101
  licenses:
92
102
  - MIT
93
- metadata: {}
94
103
  post_install_message:
95
104
  rdoc_options: []
96
105
  require_paths:
97
106
  - lib
98
107
  required_ruby_version: !ruby/object:Gem::Requirement
108
+ none: false
99
109
  requirements:
100
- - - ">="
110
+ - - ! '>='
101
111
  - !ruby/object:Gem::Version
102
112
  version: '0'
113
+ segments:
114
+ - 0
115
+ hash: -2892285902264336317
103
116
  required_rubygems_version: !ruby/object:Gem::Requirement
117
+ none: false
104
118
  requirements:
105
- - - ">="
119
+ - - ! '>='
106
120
  - !ruby/object:Gem::Version
107
121
  version: '0'
122
+ segments:
123
+ - 0
124
+ hash: -2892285902264336317
108
125
  requirements: []
109
126
  rubyforge_project:
110
- rubygems_version: 2.2.2
127
+ rubygems_version: 1.8.23
111
128
  signing_key:
112
- specification_version: 4
129
+ specification_version: 3
113
130
  summary: Cloudformer attempts to simplify AWS Cloudformation stack creation process
114
131
  in ruby projects by providing reusable rake tasks to perform common operations such
115
132
  as apply(create/update), delete, recreate on stack along with validations on templates.
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: b9c98549041a2396decdcfb5088092fb9247d240
4
- data.tar.gz: 2a77a8e0d924a973f71b2e94199868154bbf0af8
5
- SHA512:
6
- metadata.gz: dbafea82432445daebcdff073bd747265cee7505dd5b7db7fbbf72b6e6f64f22d6d997256dee25ad9a1bfe5c6952965d84233212f74c2095b780304da7d678b8
7
- data.tar.gz: 398746d059addfd5bb3f5b8c3b3aa906176dd4d014b4b169d2ca5c320a48ba7cfdcc45e70a0c95c5a30720d83438fd7b339a653407f93903b6418e63fdd3321d