dumbwaiter 0.3.3 → 0.3.4
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/deployment.rb +13 -3
- data/lib/dumbwaiter/stack.rb +4 -0
- data/lib/dumbwaiter/user_profile.rb +21 -0
- data/lib/dumbwaiter/version.rb +1 -1
- data/spec/lib/dumbwaiter/deployment_spec.rb +7 -3
- data/spec/lib/dumbwaiter/stack_spec.rb +2 -1
- data/spec/lib/dumbwaiter/user_profile_spec.rb +20 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b9a26e924bd8b00b73ec8cb0e324a0721c166944
|
4
|
+
data.tar.gz: c678a21527a23982a32d6131f2ed740e2705d188
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e589c89ce6429b82bee6c8e50a9c9ab6dd641818b7b14ddb3bc65d335ed17470291a81378ee6f49b24eada95c4291f3d1e61518ef5cc18f9aa1dcb4d1b47b44
|
7
|
+
data.tar.gz: 7f17bc639481d9b36c1a5da08246e4122a11038933ba6758228f5d183eccce37b1277830df12cd2ea243e0c85eb406d15d8c96edce3c340fa29bcf6b121c716d
|
@@ -1,14 +1,16 @@
|
|
1
1
|
require "dumbwaiter/deployment_custom_json"
|
2
|
+
require "dumbwaiter/user_profile"
|
2
3
|
|
3
4
|
class Dumbwaiter::Deployment
|
4
|
-
attr_reader :opsworks_deployment
|
5
|
+
attr_reader :opsworks_deployment, :opsworks
|
5
6
|
|
6
7
|
def self.all(stack, opsworks = Aws::OpsWorks.new(region: "us-east-1"))
|
7
|
-
opsworks.describe_deployments(stack_id: stack.id).deployments.map { |d| new(d) }
|
8
|
+
opsworks.describe_deployments(stack_id: stack.id).deployments.map { |d| new(d, opsworks) }
|
8
9
|
end
|
9
10
|
|
10
|
-
def initialize(opsworks_deployment)
|
11
|
+
def initialize(opsworks_deployment, opsworks)
|
11
12
|
@opsworks_deployment = opsworks_deployment
|
13
|
+
@opsworks = opsworks
|
12
14
|
end
|
13
15
|
|
14
16
|
def created_at
|
@@ -23,6 +25,10 @@ class Dumbwaiter::Deployment
|
|
23
25
|
opsworks_deployment.status
|
24
26
|
end
|
25
27
|
|
28
|
+
def user_name
|
29
|
+
user_profile.name
|
30
|
+
end
|
31
|
+
|
26
32
|
def git_ref
|
27
33
|
deployment_custom_json.git_ref
|
28
34
|
end
|
@@ -33,6 +39,10 @@ class Dumbwaiter::Deployment
|
|
33
39
|
|
34
40
|
protected
|
35
41
|
|
42
|
+
def user_profile
|
43
|
+
Dumbwaiter::UserProfile.find(opsworks_deployment.iam_user_arn, opsworks)
|
44
|
+
end
|
45
|
+
|
36
46
|
def deployment_custom_json
|
37
47
|
Dumbwaiter::DeploymentCustomJson.from_json(custom_json)
|
38
48
|
end
|
data/lib/dumbwaiter/stack.rb
CHANGED
@@ -0,0 +1,21 @@
|
|
1
|
+
class Dumbwaiter::UserProfile
|
2
|
+
attr_reader :opsworks_user_profile, :opsworks
|
3
|
+
|
4
|
+
def self.find(iam_user_arn, opsworks = Aws::OpsWorks.new(region: "us-east-1"))
|
5
|
+
opsworks.describe_user_profiles(iam_user_arns: [iam_user_arn]).user_profiles.first
|
6
|
+
|
7
|
+
end
|
8
|
+
|
9
|
+
def initialize(opsworks_user_profile, opsworks)
|
10
|
+
@opsworks_user_profile = opsworks_user_profile
|
11
|
+
@opsworks = opsworks
|
12
|
+
end
|
13
|
+
|
14
|
+
def iam_user_arn
|
15
|
+
opsworks_user_profile.iam_user_arn
|
16
|
+
end
|
17
|
+
|
18
|
+
def name
|
19
|
+
opsworks_user_profile.name
|
20
|
+
end
|
21
|
+
end
|
data/lib/dumbwaiter/version.rb
CHANGED
@@ -8,19 +8,23 @@ describe Dumbwaiter::Deployment do
|
|
8
8
|
created_at: "last Tuesday",
|
9
9
|
command: fake_command,
|
10
10
|
status: "badical",
|
11
|
-
custom_json: custom_json
|
11
|
+
custom_json: custom_json,
|
12
|
+
iam_user_arn: "ie"
|
12
13
|
)
|
13
14
|
end
|
14
15
|
let(:fake_deployments) { double(:deployments, deployments: [fake_deployment]) }
|
15
|
-
let(:
|
16
|
+
let(:fake_user_profile) { double(:user_profile, name: "goose") }
|
17
|
+
let(:fake_user_profiles) { double(:user_profiles, user_profiles: [fake_user_profile]) }
|
18
|
+
let(:fake_opsworks) { double(:opsworks, describe_deployments: fake_deployments, describe_user_profiles: fake_user_profiles) }
|
16
19
|
|
17
|
-
subject(:deployment) { Dumbwaiter::Deployment.new(fake_deployment) }
|
20
|
+
subject(:deployment) { Dumbwaiter::Deployment.new(fake_deployment, fake_opsworks) }
|
18
21
|
|
19
22
|
its(:opsworks_deployment) { should == fake_deployment }
|
20
23
|
its(:created_at) { should == DateTime.parse("last Tuesday") }
|
21
24
|
its(:command_name) { should == "deplode" }
|
22
25
|
its(:status) { should == "badical" }
|
23
26
|
its(:git_ref) { should == "eh-buddy" }
|
27
|
+
its(:user_name) { should == "goose" }
|
24
28
|
its(:to_log) { should == "#{DateTime.parse("last Tuesday")} - deplode - badical - eh-buddy" }
|
25
29
|
|
26
30
|
context "when custom_json is nil" do
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
describe Dumbwaiter::Stack do
|
4
|
-
let(:fake_stack) { double(:stack, name: "ducks", stack_id: "cool") }
|
4
|
+
let(:fake_stack) { double(:stack, name: "ducks", stack_id: "cool", attributes: {"Color" => "hot pink"}) }
|
5
5
|
let(:fake_stacks) { double(:stacks, stacks: [fake_stack]) }
|
6
6
|
let(:fake_opsworks) { double(:opsworks, describe_stacks: fake_stacks) }
|
7
7
|
let(:fake_app) { double(:app) }
|
@@ -19,6 +19,7 @@ describe Dumbwaiter::Stack do
|
|
19
19
|
its(:opsworks_stack) { should == fake_stack }
|
20
20
|
its(:id) { should == "cool" }
|
21
21
|
its(:name) { should == "ducks" }
|
22
|
+
its(:color) { should == "hot pink" }
|
22
23
|
|
23
24
|
its(:apps) { should == [fake_app] }
|
24
25
|
its(:deployments) { should == [fake_deployment] }
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Dumbwaiter::UserProfile do
|
4
|
+
let(:fake_user_profile) { double(:user_profile, iam_user_arn: "schwarz", name: "conan") }
|
5
|
+
let(:fake_user_profiles) { double(:user_profiles, user_profiles: [fake_user_profile])}
|
6
|
+
let(:fake_opsworks) { double(:opsworks, describe_user_profiles: fake_user_profiles) }
|
7
|
+
|
8
|
+
subject(:user_profile) { Dumbwaiter::UserProfile.new(fake_user_profile, fake_opsworks) }
|
9
|
+
|
10
|
+
its(:opsworks_user_profile) { should == fake_user_profile }
|
11
|
+
its(:iam_user_arn) { should == "schwarz" }
|
12
|
+
its(:name) { should == "conan" }
|
13
|
+
|
14
|
+
describe ".find" do
|
15
|
+
it "finds a user profile for the given iam user arn" do
|
16
|
+
fake_opsworks.should_receive(:describe_user_profiles).with(iam_user_arns: ["schwarz"])
|
17
|
+
Dumbwaiter::UserProfile.find("schwarz", fake_opsworks).should == fake_user_profile
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dumbwaiter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Doc Ritezel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-12-
|
11
|
+
date: 2013-12-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-core
|
@@ -121,6 +121,7 @@ files:
|
|
121
121
|
- lib/dumbwaiter/instance.rb
|
122
122
|
- lib/dumbwaiter/layer.rb
|
123
123
|
- lib/dumbwaiter/stack.rb
|
124
|
+
- lib/dumbwaiter/user_profile.rb
|
124
125
|
- lib/dumbwaiter/version.rb
|
125
126
|
- script/ci.sh
|
126
127
|
- spec/lib/dumbwaiter/app_spec.rb
|
@@ -130,6 +131,7 @@ files:
|
|
130
131
|
- spec/lib/dumbwaiter/instance_spec.rb
|
131
132
|
- spec/lib/dumbwaiter/layer_spec.rb
|
132
133
|
- spec/lib/dumbwaiter/stack_spec.rb
|
134
|
+
- spec/lib/dumbwaiter/user_profile_spec.rb
|
133
135
|
- spec/spec_helper.rb
|
134
136
|
homepage: https://github.com/minifast/dumbwaiter
|
135
137
|
licenses:
|
@@ -163,4 +165,5 @@ test_files:
|
|
163
165
|
- spec/lib/dumbwaiter/instance_spec.rb
|
164
166
|
- spec/lib/dumbwaiter/layer_spec.rb
|
165
167
|
- spec/lib/dumbwaiter/stack_spec.rb
|
168
|
+
- spec/lib/dumbwaiter/user_profile_spec.rb
|
166
169
|
- spec/spec_helper.rb
|