dumbwaiter 0.3.8 → 0.3.9
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.
- checksums.yaml +4 -4
- data/lib/dumbwaiter/app.rb +7 -1
- data/lib/dumbwaiter/version.rb +1 -1
- data/spec/lib/dumbwaiter/app_spec.rb +16 -0
- data/spec/lib/dumbwaiter/stack_spec.rb +1 -1
- 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: cfb7090316683071d3ce265c16b526bdb5572778
|
4
|
+
data.tar.gz: 9f7d7cfc83b396d190d6e183edb02c31176e489a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ea5b7c3d7f8454d9b33b4d56ae4fd4cae2b502146ee87fc06fd43124a607cafec6d284404517062b1b7b78fe60008f407fff1ce2ec2058de1cea9b42015190c3
|
7
|
+
data.tar.gz: 55768221bc46cbf6f3d5061a475eb1b4a8f993d07ca354f3de4c9743f0eabeb11f96cab645cf0bf115ebd2ffbe2f8a28c77467bcf463081b270fedc5e8664b4c
|
data/lib/dumbwaiter/app.rb
CHANGED
@@ -10,11 +10,17 @@ class Dumbwaiter::App
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def self.find(stack, app_name, opsworks = Aws::OpsWorks.new(region: "us-east-1"))
|
13
|
-
app = all(stack, opsworks).detect { |app| app.name == app_name}
|
13
|
+
app = all(stack, opsworks).detect { |app| app.name == app_name }
|
14
14
|
raise NotFound.new("No app found with name #{app_name}") if app.nil?
|
15
15
|
app
|
16
16
|
end
|
17
17
|
|
18
|
+
def self.find_by_id(stack, app_id, opsworks = Aws::OpsWorks.new(region: "us-east-1"))
|
19
|
+
app = all(stack, opsworks).detect { |app| app.id == app_id }
|
20
|
+
raise NotFound.new("No app found with id #{app_id}") if app.nil?
|
21
|
+
app
|
22
|
+
end
|
23
|
+
|
18
24
|
def initialize(stack, opsworks_app, opsworks = Aws::OpsWorks.new(region: "us-east-1"))
|
19
25
|
@stack = stack
|
20
26
|
@opsworks_app = opsworks_app
|
data/lib/dumbwaiter/version.rb
CHANGED
@@ -68,4 +68,20 @@ describe Dumbwaiter::App do
|
|
68
68
|
end
|
69
69
|
end
|
70
70
|
end
|
71
|
+
|
72
|
+
describe ".find" do
|
73
|
+
context "when the app exists" do
|
74
|
+
it "finds the app by id" do
|
75
|
+
Dumbwaiter::App.find_by_id(fake_stack, "amazing", fake_opsworks).name.should == "goose"
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
context "when the app does not exist" do
|
80
|
+
it "blows up" do
|
81
|
+
expect {
|
82
|
+
Dumbwaiter::App.find_by_id(fake_stack, "teeth", fake_opsworks)
|
83
|
+
}.to raise_error(Dumbwaiter::App::NotFound)
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
71
87
|
end
|