propono 0.10.0 → 0.11.0

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: d5f84182f9c9e4875a47a3ac2875a4982500831e
4
- data.tar.gz: 1b75f8844c07e4b9294584a8ca21e2658a7a9f50
3
+ metadata.gz: 4beace8cad555ffa121e2ca9efc98089023bc6f0
4
+ data.tar.gz: 432d01d8104389a8a23d58f8eda0979cc2a61642
5
5
  SHA512:
6
- metadata.gz: 32730a332521b97195a04228553fa44d01299afd182e64688ee35059dd97fdd46460b600424e6cd4d2e89819733449e63eb2eb9212f58a5d017ba40498021133
7
- data.tar.gz: 1e0f553345f7df641ce0ede23404aae1c436dabefc24b6d336eec7360665fb94c65265b335382d5d2b19e89c0d9d38a85bf5bbf512ee52e7792b23df5d7f6de1
6
+ metadata.gz: 79554f6eb90fb9d5310492cc944bb87fadd0fad5833083980b154143bd22f0cf2cade77f849dcd0f5af662737ae3a3be11c863397001f16705cf9f68dff8aa1a
7
+ data.tar.gz: 64e3690bcace483404d1fba22e85aa309aa237ea8e70630e7a93f11675e1ed2eb1683bfaf18a67177541b2973aebffe6bd55477de0196f2b1c111f3add93974b
data/.travis.yml CHANGED
@@ -1,4 +1,5 @@
1
1
  language: ruby
2
+ cache: bundler
2
3
  rvm:
3
4
  - 1.9.3
4
5
  - 2.0.0
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 0.11.0 / 2013-12-03
2
+
3
+ * [FEATURE] Add support for IAM profiles for AWS auth
4
+
1
5
  # 0.10.0 / 2013-12-03
2
6
 
3
7
  * [FEATURE] Add queue_suffix config variable
data/lib/propono.rb CHANGED
@@ -8,6 +8,7 @@ require 'propono/configuration'
8
8
 
9
9
  require "propono/helpers/hash"
10
10
 
11
+ require 'propono/components/aws_config'
11
12
  require 'propono/components/sns'
12
13
  require 'propono/components/sqs'
13
14
  require "propono/components/queue"
@@ -0,0 +1,28 @@
1
+ module Propono
2
+
3
+ def self.aws_options
4
+ AwsConfig.new(Propono.config).aws_options
5
+ end
6
+
7
+ class AwsConfig
8
+
9
+ def initialize(config)
10
+ @config = config
11
+ end
12
+
13
+ def aws_options
14
+ if @config.use_iam_profile
15
+ {
16
+ :use_iam_profile => true,
17
+ :region => @config.queue_region
18
+ }
19
+ else
20
+ {
21
+ :aws_access_key_id => @config.access_key,
22
+ :aws_secret_access_key => @config.secret_key,
23
+ :region => @config.queue_region
24
+ }
25
+ end
26
+ end
27
+ end
28
+ end
@@ -6,9 +6,7 @@ module Propono
6
6
 
7
7
  def sns
8
8
  @sns ||= Fog::AWS::SNS.new(
9
- :aws_access_key_id => Propono.config.access_key,
10
- :aws_secret_access_key => Propono.config.secret_key,
11
- :region => Propono.config.queue_region
9
+ Propono.aws_options
12
10
  )
13
11
  end
14
12
  end
@@ -6,9 +6,7 @@ module Propono
6
6
 
7
7
  def sqs
8
8
  @sqs ||= Fog::AWS::SQS.new(
9
- :aws_access_key_id => Propono.config.access_key,
10
- :aws_secret_access_key => Propono.config.secret_key,
11
- :region => Propono.config.queue_region
9
+ Propono.aws_options
12
10
  )
13
11
  end
14
12
  end
@@ -6,7 +6,7 @@ module Propono
6
6
  class Configuration
7
7
 
8
8
  SETTINGS = [
9
- :access_key, :secret_key, :queue_region, :queue_suffix,
9
+ :use_iam_profile, :access_key, :secret_key, :queue_region, :queue_suffix,
10
10
  :application_name,
11
11
  :udp_host, :udp_port,
12
12
  :tcp_host, :tcp_port,
@@ -17,6 +17,7 @@ module Propono
17
17
  def initialize
18
18
  self.logger = Propono::Logger.new
19
19
  self.queue_suffix = ""
20
+ self.use_iam_profile = false
20
21
  end
21
22
 
22
23
  SETTINGS.each do |setting|
@@ -24,7 +25,9 @@ module Propono
24
25
  get_or_raise(setting)
25
26
  end
26
27
  end
27
-
28
+
29
+ attr_reader :use_iam_profile
30
+
28
31
  private
29
32
 
30
33
  def get_or_raise(setting)
@@ -1,3 +1,3 @@
1
1
  module Propono
2
- VERSION = "0.10.0"
2
+ VERSION = "0.11.0"
3
3
  end
@@ -0,0 +1,52 @@
1
+ require File.expand_path('../../test_helper', __FILE__)
2
+
3
+ module Propono
4
+ class AwsConfigTest < Minitest::Test
5
+
6
+ def setup
7
+ @config = Propono::Configuration.new
8
+
9
+ @config.access_key = "test-access-key"
10
+ @config.secret_key = "test-secret-key"
11
+ @config.queue_region = "test-queue-region"
12
+
13
+ @aws_config = Propono::AwsConfig.new(@config)
14
+ end
15
+
16
+ def test_access_key
17
+ assert_equal "test-access-key", @aws_config.aws_options[:aws_access_key_id]
18
+ end
19
+
20
+ def test_secret_key
21
+ assert_equal "test-secret-key", @aws_config.aws_options[:aws_secret_access_key]
22
+ end
23
+
24
+ def test_region
25
+ assert_equal "test-queue-region", @aws_config.aws_options[:region]
26
+ end
27
+
28
+ def test_no_iam_profile_selected
29
+ assert ! @aws_config.aws_options.has_key?(:use_iam_profile)
30
+ end
31
+
32
+ def test_use_iam_profile
33
+ @config.use_iam_profile = true
34
+ assert @aws_config.aws_options[:use_iam_profile]
35
+ end
36
+
37
+ def test_selecting_use_iam_profile_results_in_no_access_key
38
+ @config.use_iam_profile = true
39
+ assert ! @aws_config.aws_options.has_key?(:aws_access_key_id)
40
+ end
41
+
42
+ def test_selecting_use_iam_profile_results_in_no_secret_key
43
+ @config.use_iam_profile = true
44
+ assert ! @aws_config.aws_options.has_key?(:aws_secret_access_key)
45
+ end
46
+
47
+ def test_region_when_using_iam_profile
48
+ @config.use_iam_profile = true
49
+ assert_equal "test-queue-region", @aws_config.aws_options[:region]
50
+ end
51
+ end
52
+ end
@@ -19,6 +19,15 @@ module Propono
19
19
  assert_equal test_key, Propono.config.access_key
20
20
  end
21
21
 
22
+ def test_use_iam_profile_defaults_false
23
+ assert ! Propono.config.use_iam_profile
24
+ end
25
+
26
+ def test_use_iam_profile
27
+ Propono.config.use_iam_profile = true
28
+ assert Propono.config.use_iam_profile
29
+ end
30
+
22
31
  def test_access_key
23
32
  access_key = "test-access-key"
24
33
  Propono.config.access_key = access_key
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: propono
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - MalcyL
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-12-03 00:00:00.000000000 Z
12
+ date: 2013-12-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fog
@@ -112,6 +112,7 @@ files:
112
112
  - README.md
113
113
  - Rakefile
114
114
  - lib/propono.rb
115
+ - lib/propono/components/aws_config.rb
115
116
  - lib/propono/components/post_subscription.rb
116
117
  - lib/propono/components/queue.rb
117
118
  - lib/propono/components/queue_subscription.rb
@@ -131,6 +132,7 @@ files:
131
132
  - lib/propono/services/udp_listener.rb
132
133
  - lib/propono/version.rb
133
134
  - propono.gemspec
135
+ - test/components/aws_config_test.rb
134
136
  - test/components/post_subscription_test.rb
135
137
  - test/components/queue_subscription_test.rb
136
138
  - test/components/queue_test.rb
@@ -175,11 +177,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
175
177
  version: '0'
176
178
  requirements: []
177
179
  rubyforge_project:
178
- rubygems_version: 2.1.9
180
+ rubygems_version: 2.0.3
179
181
  signing_key:
180
182
  specification_version: 4
181
183
  summary: General purpose pub/sub library built on top of AWS SNS and SQS
182
184
  test_files:
185
+ - test/components/aws_config_test.rb
183
186
  - test/components/post_subscription_test.rb
184
187
  - test/components/queue_subscription_test.rb
185
188
  - test/components/queue_test.rb