dpl 1.7.12.travis.783.4 → 1.7.12.travis.784.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/dpl/provider/elastic_beanstalk.rb +5 -5
- data/spec/provider/elastic_beanstalk_spec.rb +27 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YTBkMzQxMjBiNjgwNTcyYjU0ZGM2Y2MxNjRjNjI2MmEzZGY5MjlmNg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZGQ2YmQ4NGJmZDZhNGQ2MDAwOWQ3MDIzMTJjYzdjYzNlMGEzMTU3Mw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ODQ1YzA3ZDUwM2I4YTlkZGE1NDI2NGJlNWQxOWM5OTdkOGE3YmE1ZGVjYzIw
|
10
|
+
MzM3Nzg1YzI3N2E0OWIyNzQwM2ExZmRmZDc5Yzk5MTliODc1ZGE4ZGMyYzEy
|
11
|
+
N2NlNTY0MjY4MjU2MTQ3MDNjMWRkOWVkMDA5MDU5NTc5YjNlOTk=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZDY2MTRjZmU1MTY0ZmE2OWY1MGU4NDk2ZjM0NWJmYjE3OGViYWM5ZmNjZmJj
|
14
|
+
YjM2YjJkM2E4YWFhZjZhMWY0NGQ2MTdjZTYyYzQ0MTk2YTZlODE5M2MxOTYy
|
15
|
+
ZjRhZjhlZjgxYTRjZjY4N2ViNmVkMmM5ODU0NTdhZDg5Zjk2YTI=
|
@@ -60,6 +60,10 @@ module DPL
|
|
60
60
|
option(:bucket_name)
|
61
61
|
end
|
62
62
|
|
63
|
+
def bucket_path
|
64
|
+
@bucket_path ||= options[:bucket_path] ? option(:bucket_path).gsub(/\/*$/,'/') : nil
|
65
|
+
end
|
66
|
+
|
63
67
|
def s3
|
64
68
|
@s3 ||= AWS::S3.new
|
65
69
|
end
|
@@ -95,11 +99,7 @@ module DPL
|
|
95
99
|
|
96
100
|
def upload(key, file)
|
97
101
|
obj = s3.buckets[bucket_name]
|
98
|
-
|
99
|
-
option(:bucket_path).gsub!(/\/*$/,'/')
|
100
|
-
end
|
101
|
-
|
102
|
-
obj = obj.objects["#{option(:bucket_path)}#{key}"]
|
102
|
+
obj = bucket_path ? obj.objects["#{bucket_path}#{key}"] : obj.objects[key]
|
103
103
|
obj.write(Pathname.new(file))
|
104
104
|
obj
|
105
105
|
end
|
@@ -22,6 +22,7 @@ describe DPL::Provider::ElasticBeanstalk do
|
|
22
22
|
allow(dbl).to receive(:objects).and_return(double("Hash", :[] => dbl))
|
23
23
|
dbl
|
24
24
|
end
|
25
|
+
|
25
26
|
let(:s3_mock) do
|
26
27
|
hash_dbl = double("Hash", :[] => bucket_mock, :map => [])
|
27
28
|
double("AWS::S3", buckets: hash_dbl)
|
@@ -34,6 +35,13 @@ describe DPL::Provider::ElasticBeanstalk do
|
|
34
35
|
)
|
35
36
|
end
|
36
37
|
|
38
|
+
subject :provider_without_bucket_path do
|
39
|
+
described_class.new(
|
40
|
+
DummyContext.new, :access_key_id => access_key_id, :secret_access_key => secret_access_key,
|
41
|
+
:region => region, :app => app, :env => env, :bucket_name => bucket_name
|
42
|
+
)
|
43
|
+
end
|
44
|
+
|
37
45
|
describe "#check_auth" do
|
38
46
|
example do
|
39
47
|
expect(AWS).to receive(:config).with(access_key_id: access_key_id, secret_access_key: secret_access_key, region: region)
|
@@ -74,5 +82,24 @@ describe DPL::Provider::ElasticBeanstalk do
|
|
74
82
|
|
75
83
|
provider.push_app
|
76
84
|
end
|
85
|
+
|
86
|
+
context 'When the bucket_path option is not set' do
|
87
|
+
example 'Does not prepend bucket_path to the s3 bucket' do
|
88
|
+
allow(s3_mock.buckets).to receive(:map).and_return([bucket_name])
|
89
|
+
|
90
|
+
expect(provider_without_bucket_path).to receive(:s3).and_return(s3_mock).twice
|
91
|
+
expect(provider_without_bucket_path).not_to receive(:create_bucket)
|
92
|
+
expect(provider_without_bucket_path).to receive(:create_zip).and_return('/path/to/file.zip')
|
93
|
+
expect(provider_without_bucket_path).to receive(:archive_name).and_return('file.zip')
|
94
|
+
expect(provider_without_bucket_path).to receive(:bucket_path).and_return(nil)
|
95
|
+
expect(bucket_mock.objects).to receive(:[]).with("file.zip").and_return(bucket_mock)
|
96
|
+
expect(provider_without_bucket_path).to receive(:upload).with('file.zip', '/path/to/file.zip').and_call_original
|
97
|
+
expect(provider_without_bucket_path).to receive(:sleep).with(5)
|
98
|
+
expect(provider_without_bucket_path).to receive(:create_app_version).with(bucket_mock).and_return(app_version)
|
99
|
+
expect(provider_without_bucket_path).to receive(:update_app).with(app_version)
|
100
|
+
|
101
|
+
provider_without_bucket_path.push_app
|
102
|
+
end
|
103
|
+
end
|
77
104
|
end
|
78
105
|
end
|