dumbwaiter 0.3.5 → 0.3.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 266f730b1f4a463399570a2a28da34b682d4fbe6
4
- data.tar.gz: 405d175444fe7305d34c1fd129e46177e8be2f0f
3
+ metadata.gz: ecdc3bda7d10fbfb6e265a6bb7014bc6ff93f186
4
+ data.tar.gz: c2c3f6d0985a8e80088bcbbea20f3fc0f4ecaead
5
5
  SHA512:
6
- metadata.gz: d85594c47019afaf3f888e8fc10e8deda6342a1ea1f38866c71447d09972b9af71cf635a1c3b2ca4ae659f00f5b4bb36c0e48c70222dc91a31973d891d22d228
7
- data.tar.gz: 59884387325c6e6695d59594d02fa5afef33a28e8ce43351efd0d86abaac75df69e088faa4ce62a37a1c09d8dad9def721068688cadd8d915a56e6e6cc69f97d
6
+ metadata.gz: ea521ffdae488a9f1d2b8c8a3d1266ec7979f0ee143f8bccdd915dce9255d4fd5035b13af97d703d2c1c5c0a4cf5e30ebeaf58df9a1ac39217e0ce24ac724c8b
7
+ data.tar.gz: ad34b6685b65fcc70826277fc63ecc723addcaa1f90ee1ff7a4fefa49bcf47e784fefe483a4e4590b4d037c04f6475c616f0b7331e2b08595566e7b1aaf2bec3
@@ -34,7 +34,7 @@ class Dumbwaiter::Deployment
34
34
  end
35
35
 
36
36
  def to_log
37
- "#{created_at} - #{command_name} - #{status} - #{git_ref}"
37
+ "#{created_at} - #{user_name} - #{command_name} - #{status} - #{git_ref}"
38
38
  end
39
39
 
40
40
  protected
@@ -1,9 +1,12 @@
1
1
  class Dumbwaiter::UserProfile
2
2
  attr_reader :opsworks_user_profile, :opsworks
3
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
4
+ def self.cache
5
+ @cache ||= {}
6
+ end
6
7
 
8
+ def self.find(iam_user_arn, opsworks = Aws::OpsWorks.new(region: "us-east-1"))
9
+ cache[iam_user_arn] ||= opsworks.describe_user_profiles(iam_user_arns: [iam_user_arn]).user_profiles.first
7
10
  end
8
11
 
9
12
  def initialize(opsworks_user_profile, opsworks = Aws::OpsWorks.new(region: "us-east-1"))
@@ -1,3 +1,3 @@
1
1
  module Dumbwaiter
2
- VERSION = "0.3.5"
2
+ VERSION = "0.3.6"
3
3
  end
@@ -25,7 +25,7 @@ describe Dumbwaiter::Deployment do
25
25
  its(:status) { should == "badical" }
26
26
  its(:git_ref) { should == "eh-buddy" }
27
27
  its(:user_name) { should == "goose" }
28
- its(:to_log) { should == "#{DateTime.parse("last Tuesday")} - deplode - badical - eh-buddy" }
28
+ its(:to_log) { should == "#{DateTime.parse("last Tuesday")} - goose - deplode - badical - eh-buddy" }
29
29
 
30
30
  context "when custom_json is nil" do
31
31
  let(:fake_deployment) do
@@ -16,5 +16,11 @@ describe Dumbwaiter::UserProfile do
16
16
  fake_opsworks.should_receive(:describe_user_profiles).with(iam_user_arns: ["schwarz"])
17
17
  Dumbwaiter::UserProfile.find("schwarz", fake_opsworks).should == fake_user_profile
18
18
  end
19
+
20
+ it "caches duplicate requests for the same arn" do
21
+ fake_opsworks.should_receive(:describe_user_profiles).once
22
+ Dumbwaiter::UserProfile.find("schwarz", fake_opsworks)
23
+ Dumbwaiter::UserProfile.find("schwarz", fake_opsworks)
24
+ end
19
25
  end
20
26
  end
data/spec/spec_helper.rb CHANGED
@@ -21,4 +21,5 @@ RSpec.configure do |config|
21
21
  # the seed, which is printed after each run.
22
22
  # --seed 1234
23
23
  config.order = "random"
24
+ config.after { Dumbwaiter::UserProfile.cache.clear }
24
25
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dumbwaiter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Doc Ritezel