heirloom 0.12.0 → 0.12.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d6d73c91dfef2a41499f55632e29e331c92cdcb3
4
+ data.tar.gz: 7e42b9a64be37441bca4a742d63cd34d0ea677f5
5
+ SHA512:
6
+ metadata.gz: 85b6bb627ea3cf373d788bde7217d1b774eeb13aa1855a48fcf41d5e7d653ed1cb1f1b90e2df09b22a864fc779f5720525566a7790704d182bfc3059779b89a1
7
+ data.tar.gz: 1a07e220a9ed9a3ea9bc78e16bbc39b0f5c033abd6174dff3760246daea2961e5a24245b12d8bc4c87a7ce5cb30f32ac05bd4d8dc822ab77d9a9361efdcd6dff
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 1.9.3
1
+ 2.0.0
data/.travis.yml CHANGED
@@ -1,4 +1,5 @@
1
1
  rvm:
2
2
  - 1.9.2
3
3
  - 1.9.3
4
+ - 2.0.0
4
5
  script: "rake spec"
data/CHANGELOG.md CHANGED
@@ -1,4 +1,8 @@
1
- ## HEAD:
1
+ ## HEAD:
2
+
3
+ ## 0.12.1 (09/04/2013):
4
+
5
+ * Upgraded to fog 1.15.0
2
6
 
3
7
  ## 0.12.0 (08/14/2013):
4
8
 
data/heirloom.gemspec CHANGED
@@ -25,10 +25,8 @@ Gem::Specification.new do |s|
25
25
  s.add_development_dependency "vcr", '= 2.4.0'
26
26
  s.add_development_dependency "watchr"
27
27
 
28
- s.add_runtime_dependency 'excon', '= 0.16'
29
- s.add_runtime_dependency 'fog', '= 1.10.0'
28
+ s.add_runtime_dependency 'fog', '= 1.15.0'
30
29
  s.add_runtime_dependency 'hashie', '= 2.0.5'
31
30
  s.add_runtime_dependency 'trollop', '= 2.0'
32
31
  s.add_runtime_dependency 'xml-simple', '~> 1.1.2'
33
-
34
32
  end
@@ -6,7 +6,7 @@ module Heirloom
6
6
 
7
7
  def initialize(args)
8
8
  @config = args[:config]
9
-
9
+
10
10
  fog_args = { :region => @config.metadata_region }
11
11
 
12
12
  if @config.use_iam_profile
@@ -23,12 +23,12 @@ module Heirloom
23
23
  ensure_catalog_domain_exists :config => @config,
24
24
  :catalog => @catalog
25
25
  end
26
-
26
+
27
27
  def all
28
28
  if @opts[:json]
29
29
  jj catalog_with_heirloom_prefix_removed
30
30
  else
31
- formatter = Heirloom::CLI::Formatter::Catalog.new
31
+ formatter = Heirloom::CLI::Formatter::Catalog.new
32
32
  puts formatter.format :catalog => catalog_with_heirloom_prefix_removed,
33
33
  :name => @opts[:name]
34
34
  end
@@ -10,6 +10,11 @@ module Heirloom
10
10
  config.secret_key = opts[:aws_secret_key] if opts[:aws_secret_key]
11
11
  config.metadata_region = opts[:metadata_region] if opts[:metadata_region]
12
12
  config.use_iam_profile = opts[:use_iam_profile] if opts[:use_iam_profile]
13
+ if config.proxy
14
+ logger.debug "Using proxy #{config.proxy} from https_proxy environment variable."
15
+ else
16
+ logger.debug "Proxy environment variable https_proxy not set."
17
+ end
13
18
  config
14
19
  end
15
20
 
@@ -22,6 +22,10 @@ module Heirloom
22
22
  false
23
23
  end
24
24
 
25
+ def proxy
26
+ @proxy ||= env.load 'https_proxy'
27
+ end
28
+
25
29
  private
26
30
 
27
31
  def load_config_file
@@ -1,3 +1,3 @@
1
1
  module Heirloom
2
- VERSION = "0.12.0"
2
+ VERSION = "0.12.1"
3
3
  end
@@ -2,14 +2,10 @@ require 'spec_helper'
2
2
 
3
3
  describe Heirloom::AWS::SimpleDB do
4
4
 
5
- before do
6
- @sdb = Heirloom::AWS::SimpleDB.new :config => mock_config
7
- end
5
+ let(:sdb) { Heirloom::AWS::SimpleDB.new :config => mock_config }
8
6
 
9
7
  context "credential management" do
10
-
11
8
  it "should use the access and secret keys by default" do
12
-
13
9
  config = mock_config :aws_access_key_id => 'key',
14
10
  :aws_secret_access_key => 'secret'
15
11
 
@@ -19,45 +15,42 @@ describe Heirloom::AWS::SimpleDB do
19
15
  :region => 'us-west-1'
20
16
 
21
17
  s3 = Heirloom::AWS::SimpleDB.new :config => config
22
-
23
18
  end
24
19
 
25
20
  it "should use the iam role if asked to" do
26
-
27
21
  config = mock_config :use_iam_profile => true
28
-
22
+
29
23
  Fog::AWS::SimpleDB.should_receive(:new).
30
24
  with :use_iam_profile => true,
31
25
  :region => 'us-west-1'
32
26
  s3 = Heirloom::AWS::SimpleDB.new :config => config
33
-
34
27
  end
35
28
 
36
29
  end
37
30
 
38
31
  # Data recorded with VCR after running ./spec/fixtures/create_test_data.sh
39
32
  context "select", :vcr => true do
40
-
33
+ let(:sdb) { Heirloom::AWS::SimpleDB.new :config => integration_or_mock_config }
34
+
41
35
  before do
42
- @sdb = Heirloom::AWS::SimpleDB.new :config => integration_or_mock_config
43
36
  @q = "select * from `heirloom_test_data` where built_at > '2000-01-01T00:00:00.000Z' order by built_at desc"
44
37
  end
45
38
 
46
39
  it "should get results" do
47
- keys = @sdb.select(@q).keys
40
+ keys = sdb.select(@q).keys
48
41
  keys.size.should == 10
49
42
  keys.first.should == "v10"
50
43
  end
51
44
 
52
45
  it "should be able to offset results" do
53
- keys = @sdb.select(@q, :offset => 2).keys
46
+ keys = sdb.select(@q, :offset => 2).keys
54
47
  keys.size.should == 8
55
48
  keys.first.should == "v8"
56
49
  end
57
50
 
58
51
  it "should yield when requested" do
59
52
  num_yields = 0
60
- @sdb.select(@q, :offset => 2) do |k, v|
53
+ sdb.select(@q, :offset => 2) do |k, v|
61
54
  num_yields += 1
62
55
  end
63
56
  num_yields.should == 8
@@ -66,11 +59,9 @@ describe Heirloom::AWS::SimpleDB do
66
59
  end
67
60
 
68
61
  context "sdb operations" do
69
-
70
62
  before do
71
63
  @fog_mock = mock 'fog'
72
64
  Fog::AWS::SimpleDB.stub :new => @fog_mock
73
- @sdb = Heirloom::AWS::SimpleDB.new :config => mock_config
74
65
  end
75
66
 
76
67
  it "should list the domains in simples db" do
@@ -79,35 +70,35 @@ describe Heirloom::AWS::SimpleDB do
79
70
  and_return body_mock
80
71
  body_mock.should_receive(:body).
81
72
  and_return 'Domains' => ['domain1']
82
- @sdb.domains.should == ['domain1']
73
+ sdb.domains.should == ['domain1']
83
74
  end
84
75
 
85
76
  it "should create a new domain when it does not exist" do
86
- @sdb.should_receive(:domains).and_return([])
77
+ sdb.should_receive(:domains).and_return([])
87
78
  @fog_mock.should_receive(:create_domain).with('new_domain')
88
- @sdb.create_domain('new_domain')
79
+ sdb.create_domain('new_domain')
89
80
  end
90
81
 
91
82
  it "should destroy the specified domain" do
92
83
  @fog_mock.should_receive(:delete_domain).with('new_domain')
93
- @sdb.delete_domain('new_domain')
84
+ sdb.delete_domain('new_domain')
94
85
  end
95
86
 
96
87
  it "should not create a new domain when already exists" do
97
- @sdb.should_receive(:domains).and_return(['new_domain'])
88
+ sdb.should_receive(:domains).and_return(['new_domain'])
98
89
  @fog_mock.should_receive(:create_domain).exactly(0).times
99
- @sdb.create_domain('new_domain')
90
+ sdb.create_domain('new_domain')
100
91
  end
101
92
 
102
93
  it "should update the attributes for an entry" do
103
94
  @fog_mock.should_receive(:put_attributes).
104
95
  with('domain', 'key', {'key' => 'value'}, { "option" => "123" })
105
- @sdb.put_attributes('domain', 'key', {'key' => 'value'}, { "option" => "123" })
96
+ sdb.put_attributes('domain', 'key', {'key' => 'value'}, { "option" => "123" })
106
97
  end
107
98
 
108
99
  it "should delete the given entry from sdb" do
109
100
  @fog_mock.should_receive(:delete_attributes).with('domain', 'key')
110
- @sdb.delete('domain', 'key')
101
+ sdb.delete('domain', 'key')
111
102
  end
112
103
 
113
104
  context "testing counts" do
@@ -121,7 +112,7 @@ describe Heirloom::AWS::SimpleDB do
121
112
  with('SELECT count(*) FROM `heirloom_domain`').
122
113
  and_return @body_stub
123
114
  @body_stub.stub :body => data
124
- @sdb.count('heirloom_domain').should == 1
115
+ sdb.count('heirloom_domain').should == 1
125
116
  end
126
117
 
127
118
  it "should return true if no entries for the domain" do
@@ -130,7 +121,7 @@ describe Heirloom::AWS::SimpleDB do
130
121
  with('SELECT count(*) FROM `heirloom_domain`').
131
122
  and_return @body_stub
132
123
  @body_stub.stub :body => data
133
- @sdb.domain_empty?('heirloom_domain').should be_true
124
+ sdb.domain_empty?('heirloom_domain').should be_true
134
125
  end
135
126
 
136
127
  it "should return false if entries exist for the domain" do
@@ -139,7 +130,7 @@ describe Heirloom::AWS::SimpleDB do
139
130
  with('SELECT count(*) FROM `heirloom_domain`').
140
131
  and_return @body_stub
141
132
  @body_stub.stub :body => data
142
- @sdb.domain_empty?('heirloom_domain').should be_false
133
+ sdb.domain_empty?('heirloom_domain').should be_false
143
134
  end
144
135
 
145
136
  it "should return the count for a specific itemName within a domain" do
@@ -148,7 +139,7 @@ describe Heirloom::AWS::SimpleDB do
148
139
  with("SELECT count(*) FROM `heirloom` WHERE itemName() = 'archive'").
149
140
  and_return @body_stub
150
141
  @body_stub.stub :body => data
151
- @sdb.item_count('heirloom', 'archive').should == 1
142
+ sdb.item_count('heirloom', 'archive').should == 1
152
143
  end
153
144
  end
154
145
  end
@@ -67,34 +67,35 @@ describe Heirloom do
67
67
 
68
68
  before do
69
69
  @config_mock = mock 'config'
70
- @logger_mock = mock 'logger'
70
+ @logger_stub = stub 'logger', :debug => true
71
71
  @object = Object.new
72
72
  @object.extend Heirloom::CLI::Shared
73
- Heirloom::Config.should_receive(:new).with(:logger => @logger_mock, :environment => nil).
73
+ Heirloom::Config.should_receive(:new).with(:logger => @logger_stub, :environment => nil).
74
74
  and_return @config_mock
75
+ @config_mock.stub :proxy => nil
75
76
  end
76
77
 
77
78
  it "should return the configuration" do
78
- @object.load_config(:logger => @logger_mock,
79
+ @object.load_config(:logger => @logger_stub,
79
80
  :opts => {}).should == @config_mock
80
81
  end
81
82
 
82
83
  it "should set the metadata region if specified" do
83
84
  opts = { :metadata_region => 'us-west-1' }
84
85
  @config_mock.should_receive(:metadata_region=).with 'us-west-1'
85
- @object.load_config :logger => @logger_mock, :opts => opts
86
+ @object.load_config :logger => @logger_stub, :opts => opts
86
87
  end
87
88
 
88
89
  it "should set the access key if specified" do
89
90
  opts = { :aws_access_key => 'the_key' }
90
91
  @config_mock.should_receive(:access_key=).with 'the_key'
91
- @object.load_config :logger => @logger_mock, :opts => opts
92
+ @object.load_config :logger => @logger_stub, :opts => opts
92
93
  end
93
94
 
94
95
  it "should set the secret key if specified" do
95
96
  opts = { :aws_secret_key => 'the_secret' }
96
97
  @config_mock.should_receive(:secret_key=).with 'the_secret'
97
- @object.load_config :logger => @logger_mock, :opts => opts
98
+ @object.load_config :logger => @logger_stub, :opts => opts
98
99
  end
99
100
 
100
101
  end
data/spec/config_spec.rb CHANGED
@@ -3,7 +3,7 @@ require 'spec_helper'
3
3
  describe Heirloom do
4
4
 
5
5
  before do
6
- @config_file = { 'default' =>
6
+ @config_file = { 'default' =>
7
7
  { 'access_key' => 'key',
8
8
  'secret_key' => 'secret',
9
9
  'metadata_region' => 'us-west-2'
@@ -17,7 +17,6 @@ describe Heirloom do
17
17
  @opts = { :aws_access_key => 'optkey',
18
18
  :aws_secret_key => 'optsec',
19
19
  :metadata_region => 'optmd' }
20
-
21
20
  end
22
21
 
23
22
  context "#test the config file" do
@@ -43,6 +42,18 @@ describe Heirloom do
43
42
  end
44
43
  end
45
44
 
45
+ context "#reading env variables" do
46
+ it "should return the proxy as set by https_proxy" do
47
+ env_mock = mock 'env'
48
+ env_mock.should_receive(:load).with('HEIRLOOM_CONFIG_FILE').and_return(nil)
49
+ env_mock.should_receive(:load).with('HOME').and_return('~')
50
+ env_mock.should_receive(:load).with('https_proxy').and_return('https://proxy.example.com:3128')
51
+ Heirloom::Env.stub(:new).and_return(env_mock)
52
+ config = Heirloom::Config.new :opts => @opts
53
+ expect(config.proxy).to eq('https://proxy.example.com:3128')
54
+ end
55
+ end
56
+
46
57
  context "#with config file set" do
47
58
  before do
48
59
  env_mock = mock 'env'
@@ -70,7 +81,7 @@ describe Heirloom do
70
81
  config.secret_key.should == @config_file['default']['secret_key']
71
82
  config.metadata_region.should == @config_file['default']['metadata_region']
72
83
  end
73
-
84
+
74
85
  it "should override config settings in file from opts" do
75
86
  File.stub :exists? => true
76
87
  File.should_receive(:open).with("~/.heirloom.yml").and_return(@config_file.to_yaml)
data/spec/spec_helper.rb CHANGED
@@ -30,6 +30,7 @@ module SpecHelpers
30
30
  args[:secret_key] ||= 'secret'
31
31
  args[:metadata_region] ||= 'us-west-1'
32
32
  args[:use_iam_profile] ||= false
33
+ args[:proxy] ||= nil
33
34
 
34
35
  Hashie::Mash.new args
35
36
  end
metadata CHANGED
@@ -1,36 +1,32 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: heirloom
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.0
5
- prerelease:
4
+ version: 0.12.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - Brett Weaver
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-08-14 00:00:00.000000000 Z
11
+ date: 2013-09-04 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rake
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rspec
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ~>
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ~>
44
39
  - !ruby/object:Gem::Version
@@ -46,23 +41,20 @@ dependencies:
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: simplecov
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - '>='
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - '>='
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: vcr
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
59
  - - '='
68
60
  - !ruby/object:Gem::Version
@@ -70,7 +62,6 @@ dependencies:
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
66
  - - '='
76
67
  - !ruby/object:Gem::Version
@@ -78,55 +69,34 @@ dependencies:
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: watchr
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
- - - ! '>='
73
+ - - '>='
84
74
  - !ruby/object:Gem::Version
85
75
  version: '0'
86
76
  type: :development
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
- - - ! '>='
80
+ - - '>='
92
81
  - !ruby/object:Gem::Version
93
82
  version: '0'
94
- - !ruby/object:Gem::Dependency
95
- name: excon
96
- requirement: !ruby/object:Gem::Requirement
97
- none: false
98
- requirements:
99
- - - '='
100
- - !ruby/object:Gem::Version
101
- version: '0.16'
102
- type: :runtime
103
- prerelease: false
104
- version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
- requirements:
107
- - - '='
108
- - !ruby/object:Gem::Version
109
- version: '0.16'
110
83
  - !ruby/object:Gem::Dependency
111
84
  name: fog
112
85
  requirement: !ruby/object:Gem::Requirement
113
- none: false
114
86
  requirements:
115
87
  - - '='
116
88
  - !ruby/object:Gem::Version
117
- version: 1.10.0
89
+ version: 1.15.0
118
90
  type: :runtime
119
91
  prerelease: false
120
92
  version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
93
  requirements:
123
94
  - - '='
124
95
  - !ruby/object:Gem::Version
125
- version: 1.10.0
96
+ version: 1.15.0
126
97
  - !ruby/object:Gem::Dependency
127
98
  name: hashie
128
99
  requirement: !ruby/object:Gem::Requirement
129
- none: false
130
100
  requirements:
131
101
  - - '='
132
102
  - !ruby/object:Gem::Version
@@ -134,7 +104,6 @@ dependencies:
134
104
  type: :runtime
135
105
  prerelease: false
136
106
  version_requirements: !ruby/object:Gem::Requirement
137
- none: false
138
107
  requirements:
139
108
  - - '='
140
109
  - !ruby/object:Gem::Version
@@ -142,7 +111,6 @@ dependencies:
142
111
  - !ruby/object:Gem::Dependency
143
112
  name: trollop
144
113
  requirement: !ruby/object:Gem::Requirement
145
- none: false
146
114
  requirements:
147
115
  - - '='
148
116
  - !ruby/object:Gem::Version
@@ -150,7 +118,6 @@ dependencies:
150
118
  type: :runtime
151
119
  prerelease: false
152
120
  version_requirements: !ruby/object:Gem::Requirement
153
- none: false
154
121
  requirements:
155
122
  - - '='
156
123
  - !ruby/object:Gem::Version
@@ -158,7 +125,6 @@ dependencies:
158
125
  - !ruby/object:Gem::Dependency
159
126
  name: xml-simple
160
127
  requirement: !ruby/object:Gem::Requirement
161
- none: false
162
128
  requirements:
163
129
  - - ~>
164
130
  - !ruby/object:Gem::Version
@@ -166,7 +132,6 @@ dependencies:
166
132
  type: :runtime
167
133
  prerelease: false
168
134
  version_requirements: !ruby/object:Gem::Requirement
169
- none: false
170
135
  requirements:
171
136
  - - ~>
172
137
  - !ruby/object:Gem::Version
@@ -316,27 +281,26 @@ files:
316
281
  - watchr.rb
317
282
  homepage: ''
318
283
  licenses: []
284
+ metadata: {}
319
285
  post_install_message:
320
286
  rdoc_options: []
321
287
  require_paths:
322
288
  - lib
323
289
  required_ruby_version: !ruby/object:Gem::Requirement
324
- none: false
325
290
  requirements:
326
- - - ! '>='
291
+ - - '>='
327
292
  - !ruby/object:Gem::Version
328
293
  version: '0'
329
294
  required_rubygems_version: !ruby/object:Gem::Requirement
330
- none: false
331
295
  requirements:
332
- - - ! '>='
296
+ - - '>='
333
297
  - !ruby/object:Gem::Version
334
298
  version: '0'
335
299
  requirements: []
336
300
  rubyforge_project: heirloom
337
- rubygems_version: 1.8.24
301
+ rubygems_version: 2.0.6
338
302
  signing_key:
339
- specification_version: 3
303
+ specification_version: 4
340
304
  summary: I help with deploying code into the cloud
341
305
  test_files:
342
306
  - spec/acl/s3_spec.rb