dumbwaiter 0.3.7 → 0.3.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dumbwaiter/stack.rb +7 -1
- data/lib/dumbwaiter/version.rb +1 -1
- data/spec/lib/dumbwaiter/stack_spec.rb +16 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc87b1fc30c12a2faa171507be7097579ec077dc
|
4
|
+
data.tar.gz: f7a84fbb84d7d2a5c8bf25293c33474066c2584f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd91d3446ecd0fffc7aa82d1647c304ad6d654f54d427c2e79cd39ccb32b97d8d7f54f3e96dd413d2d24aebbe5187cc184ce1af43b54e01cb3bfcbefcbce6303
|
7
|
+
data.tar.gz: 828d4537a6ad2758c77c2027ab6ec880878a1bde305137ce7c922a4bbc23e23b6928dd6d875cd60dac0388f0fe10d34b060fbb4944572407946e92a2aed685a5
|
data/lib/dumbwaiter/stack.rb
CHANGED
@@ -12,11 +12,17 @@ class Dumbwaiter::Stack
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def self.find(stack_name, opsworks = Aws::OpsWorks.new(region: "us-east-1"))
|
15
|
-
stack = all(opsworks).detect { |stack| stack.name == stack_name}
|
15
|
+
stack = all(opsworks).detect { |stack| stack.name == stack_name }
|
16
16
|
raise NotFound.new("No stack found with name #{stack_name}") if stack.nil?
|
17
17
|
stack
|
18
18
|
end
|
19
19
|
|
20
|
+
def self.find_by_id(stack_id, opsworks = Aws::OpsWorks.new(region: "us-east-1"))
|
21
|
+
stack = all(opsworks).detect { |stack| stack.id == stack_id }
|
22
|
+
raise NotFound.new("No stack found with id #{stack_id}") if stack.nil?
|
23
|
+
stack
|
24
|
+
end
|
25
|
+
|
20
26
|
def initialize(opsworks_stack, opsworks = Aws::OpsWorks.new(region: "us-east-1"))
|
21
27
|
@opsworks = opsworks
|
22
28
|
@opsworks_stack = opsworks_stack
|
data/lib/dumbwaiter/version.rb
CHANGED
@@ -47,6 +47,22 @@ describe Dumbwaiter::Stack do
|
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
50
|
+
describe ".find_by_id" do
|
51
|
+
context "when the stack exists" do
|
52
|
+
it "finds the stack by name" do
|
53
|
+
Dumbwaiter::Stack.find_by_id("cool", fake_opsworks).name.should == "ducks"
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
context "when the stack does not exist" do
|
58
|
+
it "blows up" do
|
59
|
+
expect {
|
60
|
+
Dumbwaiter::Stack.find_by_id("teeth", fake_opsworks)
|
61
|
+
}.to raise_error(Dumbwaiter::Stack::NotFound)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
50
66
|
describe "#rechef" do
|
51
67
|
it "creates a deployment" do
|
52
68
|
fake_opsworks.should_receive(:create_deployment) do |params|
|