stackster 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +4 -0
- data/lib/stackster/aws/cloud_formation.rb +21 -35
- data/lib/stackster/aws/cloud_formation/error.rb +1 -1
- data/lib/stackster/aws/simpledb.rb +5 -1
- data/lib/stackster/entry/entry_lister.rb +6 -3
- data/lib/stackster/version.rb +1 -1
- data/spec/entry/entry_lister_spec.rb +16 -0
- data/spec/entry_spec.rb +4 -1
- metadata +14 -14
data/CHANGELOG
CHANGED
@@ -16,57 +16,45 @@ module Stackster
|
|
16
16
|
parameters = { 'Parameters' => args[:parameters] }
|
17
17
|
data = { 'Capabilities' => ['CAPABILITY_IAM'],
|
18
18
|
'TemplateBody' => args[:template] }.merge parameters
|
19
|
-
|
20
|
-
@connect.create_stack(args[:name], data)
|
21
|
-
rescue Exception => e
|
22
|
-
Error.new(:config => @config, :exception => e).process
|
23
|
-
end
|
19
|
+
@connect.create_stack(args[:name], data)
|
24
20
|
@logger.info "Cloud Formation stack creation completed."
|
21
|
+
rescue Exception => e
|
22
|
+
Error.new(:config => @config, :exception => e).process
|
25
23
|
end
|
26
24
|
|
27
25
|
def update(args)
|
28
26
|
parameters = { 'Parameters' => args[:parameters] }
|
29
27
|
data = { 'Capabilities' => ['CAPABILITY_IAM'],
|
30
28
|
'TemplateBody' => args[:template] }.merge parameters
|
31
|
-
|
32
|
-
@connect.update_stack(args[:name], data)
|
33
|
-
rescue Exception => e
|
34
|
-
Error.new(:config => @config, :exception => e).process
|
35
|
-
end
|
29
|
+
@connect.update_stack(args[:name], data)
|
36
30
|
@logger.info "Cloud Formation stack update completed."
|
31
|
+
rescue Exception => e
|
32
|
+
Error.new(:config => @config, :exception => e).process
|
37
33
|
end
|
38
34
|
|
39
35
|
def destroy(name)
|
40
|
-
|
41
|
-
@connect.delete_stack name
|
42
|
-
rescue Exception => e
|
43
|
-
Error.new(:config => @config, :exception => e).process
|
44
|
-
end
|
36
|
+
@connect.delete_stack name
|
45
37
|
@logger.info "Cloud Formation stack destroy completed."
|
38
|
+
rescue Exception => e
|
39
|
+
Error.new(:config => @config, :exception => e).process
|
46
40
|
end
|
47
41
|
|
48
42
|
def describe_stack(name)
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
Error.new(:config => @config, :exception => e).process
|
53
|
-
end
|
43
|
+
@connect.describe_stacks('StackName' => name).body['Stacks']
|
44
|
+
rescue Exception => e
|
45
|
+
Error.new(:config => @config, :exception => e).process
|
54
46
|
end
|
55
47
|
|
56
48
|
def stack_resources(name)
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
Error.new(:config => @config, :exception => e).process
|
61
|
-
end
|
49
|
+
@connect.describe_stack_resources('StackName' => name).body['StackResources']
|
50
|
+
rescue Exception => e
|
51
|
+
Error.new(:config => @config, :exception => e).process
|
62
52
|
end
|
63
53
|
|
64
54
|
def stack_events(name, limit)
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
Error.new(:config => @config, :exception => e).process
|
69
|
-
end
|
55
|
+
@connect.describe_stack_events(name).body['StackEvents'] [0..limit-1]
|
56
|
+
rescue Exception => e
|
57
|
+
Error.new(:config => @config, :exception => e).process
|
70
58
|
end
|
71
59
|
|
72
60
|
def stack_status(name)
|
@@ -78,11 +66,9 @@ module Stackster
|
|
78
66
|
end
|
79
67
|
|
80
68
|
def template(name)
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
Error.new(:config => @config, :exception => e).process
|
85
|
-
end
|
69
|
+
@connect.get_template(name).body['TemplateBody']
|
70
|
+
rescue Exception => e
|
71
|
+
Error.new(:config => @config, :exception => e).process
|
86
72
|
end
|
87
73
|
|
88
74
|
end
|
@@ -15,8 +15,12 @@ module Stackster
|
|
15
15
|
@connect.list_domains.body['Domains']
|
16
16
|
end
|
17
17
|
|
18
|
+
def domain_exists?(domain)
|
19
|
+
domains.include? domain
|
20
|
+
end
|
21
|
+
|
18
22
|
def create_domain(domain)
|
19
|
-
@connect.create_domain(domain) unless domains.
|
23
|
+
@connect.create_domain(domain) unless domains.exists?
|
20
24
|
end
|
21
25
|
|
22
26
|
def put_attributes(domain, key, attributes, options)
|
@@ -7,10 +7,13 @@ module Stackster
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def all
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
if sdb_connect.domain_exists? @domain
|
11
|
+
e = sdb_connect.select "select * from #{@domain}"
|
12
|
+
entries = e.keys.map do |name|
|
13
|
+
remove_region_from_entry(name)
|
14
|
+
end
|
13
15
|
end
|
16
|
+
entries ? entries : []
|
14
17
|
end
|
15
18
|
|
16
19
|
private
|
data/lib/stackster/version.rb
CHANGED
@@ -6,6 +6,9 @@ describe Stackster do
|
|
6
6
|
@simple_db_mock = mock 'simple db'
|
7
7
|
config = mock 'config mock'
|
8
8
|
Stackster::AWS::SimpleDB.should_receive(:new).and_return @simple_db_mock
|
9
|
+
@simple_db_mock.should_receive(:domain_exists?).
|
10
|
+
with("stacks").
|
11
|
+
and_return true
|
9
12
|
@simple_db_mock.should_receive(:select).
|
10
13
|
with("select * from stacks").
|
11
14
|
and_return('stack-to-find-us-west-1' => { 'attr1' => 'value1' })
|
@@ -13,4 +16,17 @@ describe Stackster do
|
|
13
16
|
entry_lister.all.should == ['stack-to-find']
|
14
17
|
end
|
15
18
|
|
19
|
+
it "should return a blank array if the domain does not exist" do
|
20
|
+
@simple_db_mock = mock 'simple db'
|
21
|
+
config = mock 'config mock'
|
22
|
+
Stackster::AWS::SimpleDB.should_receive(:new).and_return @simple_db_mock
|
23
|
+
@simple_db_mock.should_receive(:domain_exists?).
|
24
|
+
with("stacks").
|
25
|
+
and_return false
|
26
|
+
@simple_db_mock.should_receive(:select).
|
27
|
+
with("select * from stacks").exactly(0).times
|
28
|
+
entry_lister = Stackster::EntryLister.new :config => config
|
29
|
+
entry_lister.all.should == []
|
30
|
+
end
|
31
|
+
|
16
32
|
end
|
data/spec/entry_spec.rb
CHANGED
@@ -61,7 +61,10 @@ describe Stackster do
|
|
61
61
|
|
62
62
|
it "should set the attributes in simple db" do
|
63
63
|
@simple_db_mock.should_receive(:put_attributes).
|
64
|
-
with("stacks",
|
64
|
+
with("stacks",
|
65
|
+
"test-stack-us-west-1",
|
66
|
+
{ "key" => "value", "Name" => "test-stack-us-west-1" },
|
67
|
+
{ :replace => ["key", "Name"] } )
|
65
68
|
@entry.attributes = {"key"=>"value"}
|
66
69
|
|
67
70
|
@entry.save
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stackster
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-07-
|
12
|
+
date: 2012-07-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &70305096775860 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70305096775860
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: fog
|
27
|
-
requirement: &
|
27
|
+
requirement: &70305096775400 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70305096775400
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: logger
|
38
|
-
requirement: &
|
38
|
+
requirement: &70305096774920 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70305096774920
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: trollop
|
49
|
-
requirement: &
|
49
|
+
requirement: &70305096774500 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70305096774500
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: xml-simple
|
60
|
-
requirement: &
|
60
|
+
requirement: &70305096774040 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,7 +65,7 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70305096774040
|
69
69
|
description: Thats what I do
|
70
70
|
email:
|
71
71
|
- brett@weav.net
|
@@ -135,7 +135,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
135
135
|
version: '0'
|
136
136
|
segments:
|
137
137
|
- 0
|
138
|
-
hash:
|
138
|
+
hash: -4091889771990582798
|
139
139
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
140
140
|
none: false
|
141
141
|
requirements:
|
@@ -144,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
144
144
|
version: '0'
|
145
145
|
segments:
|
146
146
|
- 0
|
147
|
-
hash:
|
147
|
+
hash: -4091889771990582798
|
148
148
|
requirements: []
|
149
149
|
rubyforge_project: stackster
|
150
150
|
rubygems_version: 1.8.16
|