dpl 1.7.12.travis.773.4 → 1.7.12.travis.774.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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YjQ1NmZiMDZmOTY2ZThjYWJlNWFiYzhiMjc1NDY0OTI0YWYwODI1Mg==
4
+ ZDU5ZmVlZGU0MzJlYzI3ZWFjZmRmNGI0NWZlNjViZGU1ZWVkMjg5OQ==
5
5
  data.tar.gz: !binary |-
6
- YjNhZDU5NTI3MjY3NjBmZjk2ZjhjN2I5MzdiYWZiY2Q5M2JkZTRiOA==
6
+ OWZlN2E2NzNlZmM1YTA1ODBhMDM1MGZmYTg0Y2MwYzA5N2IyOTUyMQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YTlkNzAxNjVjYTc0MzA5OWIyNmE0Yjg3Y2M3NmM2YTNkNGM2NjMwMzI3Njhh
10
- NzQ5YmZkNzQ4YWI4ZWQzNDI2NjhmM2JhNmE3OTliYWJhYTU5YTY0NzZhNTQz
11
- N2U4NjA1YzA0OGFiMGRhZWQ0MzdkNjg4MTBhMzg2OGFiZjgwYzU=
9
+ M2UzMjE5MTA0MzExNzA0OGUxMGZiMTA4NWZhMzBhMDg1ZTU4ODM1ZjlmYzA0
10
+ MGZlMTAyZDI4MTcxY2Y4MDgxYWM3ZjIwOTI0ZTI2Y2ZjMWE3YTdlMzljMTQ4
11
+ NzVkODg1NTc1NDM2MTM5YjlmN2E4OTBiNmNmMjQ3N2FjZWNiNjM=
12
12
  data.tar.gz: !binary |-
13
- ZmZhZWJiMDFhNzcyOGYwMWE3NTAzODgyMDRmZjBlNGI1MWUzOGU2ZWU3NWFk
14
- NzBjYmM1OTc5Y2RlYTYxYmZjOTJlN2Y0YWYxYTQ0Njg1NDBhNmNkOWY1MWU3
15
- MDlkMjY4NDRkYmZhNTRhYTJlY2ZhMjUzNGRkZjE0MGFiYWVhMGM=
13
+ YmNiNTQ5NjcwMTc1OGY4MjUyZDA0YTg3NGI4MTUxMTE3ZGQwMTUyMjc1NGZk
14
+ OGNkODgwOWUyMTdmMWIzOWRhYzkzNmU1NWVmN2Y2YWI5ZWE5MTA0ZmQzNDg0
15
+ ZWFlZDc3MTRjZmY1YzBjNjdlNDhhNmY2NzdlYjMyOWQzODRhMTI=
data/README.md CHANGED
@@ -402,6 +402,7 @@ For accounts using two factor authentication, you have to use an oauth token as
402
402
  * **env**: Elastic Beanstalk environment name which will be updated.
403
403
  * **zip-file**: The zip-file that you want to deploy. _**Note:**_ you also need to use the `skip-cleanup` or the zipfile you are trying to upload will be removed during cleanup.
404
404
  * **bucket_name**: Bucket name to upload app to.
405
+ * **bucket_path**: Location within Bucket to upload app to.
405
406
 
406
407
  #### Examples:
407
408
 
@@ -94,7 +94,12 @@ module DPL
94
94
  end
95
95
 
96
96
  def upload(key, file)
97
- obj = s3.buckets[bucket_name].objects[key]
97
+ obj = s3.buckets[bucket_name]
98
+ if option(:bucket_path)
99
+ option(:bucket_path).gsub!(/\/*$/,'/')
100
+ end
101
+
102
+ obj = obj.objects["#{option(:bucket_path)}#{key}"]
98
103
  obj.write(Pathname.new(file))
99
104
  obj
100
105
  end
@@ -15,11 +15,22 @@ describe DPL::Provider::ElasticBeanstalk do
15
15
  let(:app) { 'example-app' }
16
16
  let(:env) { 'live' }
17
17
  let(:bucket_name) { "travis-elasticbeanstalk-test-builds-#{region}" }
18
+ let(:bucket_path) { "some/app"}
19
+
20
+ let(:bucket_mock) do
21
+ dbl = double("bucket mock", write: nil)
22
+ allow(dbl).to receive(:objects).and_return(double("Hash", :[] => dbl))
23
+ dbl
24
+ end
25
+ let(:s3_mock) do
26
+ hash_dbl = double("Hash", :[] => bucket_mock, :map => [])
27
+ double("AWS::S3", buckets: hash_dbl)
28
+ end
18
29
 
19
30
  subject :provider do
20
31
  described_class.new(
21
32
  DummyContext.new, :access_key_id => access_key_id, :secret_access_key => secret_access_key,
22
- :region => region, :app => app, :env => env, :bucket_name => bucket_name
33
+ :region => region, :app => app, :env => env, :bucket_name => bucket_name, :bucket_path => bucket_path
23
34
  )
24
35
  end
25
36
 
@@ -33,35 +44,32 @@ describe DPL::Provider::ElasticBeanstalk do
33
44
  describe "#push_app" do
34
45
 
35
46
  let(:bucket_name) { "travis-elasticbeanstalk-test-builds-#{region}" }
36
- let(:s3_object) { Object.new }
37
47
  let(:app_version) { Object.new }
38
48
 
39
- let(:bucket) { Struct.new(:name) }
40
- let(:s3) { Struct.new(:buckets) }
41
-
42
49
  example 'bucket exists already' do
43
- s3_mock = s3.new([bucket.new(bucket_name)])
44
- expect(provider).to receive(:s3).and_return(s3_mock)
50
+ allow(s3_mock.buckets).to receive(:map).and_return([bucket_name])
51
+
52
+ expect(provider).to receive(:s3).and_return(s3_mock).twice
45
53
  expect(provider).not_to receive(:create_bucket)
46
54
  expect(provider).to receive(:create_zip).and_return('/path/to/file.zip')
47
55
  expect(provider).to receive(:archive_name).and_return('file.zip')
48
- expect(provider).to receive(:upload).with('file.zip', '/path/to/file.zip').and_return(s3_object)
56
+ expect(bucket_mock.objects).to receive(:[]).with("#{bucket_path}/file.zip").and_return(bucket_mock)
57
+ expect(provider).to receive(:upload).with('file.zip', '/path/to/file.zip').and_call_original
49
58
  expect(provider).to receive(:sleep).with(5)
50
- expect(provider).to receive(:create_app_version).with(s3_object).and_return(app_version)
59
+ expect(provider).to receive(:create_app_version).with(bucket_mock).and_return(app_version)
51
60
  expect(provider).to receive(:update_app).with(app_version)
52
61
 
53
62
  provider.push_app
54
63
  end
55
64
 
56
65
  example 'bucket doesnt exist yet' do
57
- s3_mock = s3.new([])
58
- expect(provider).to receive(:s3).and_return(s3_mock)
66
+ expect(provider).to receive(:s3).and_return(s3_mock).twice
59
67
  expect(provider).to receive(:create_bucket)
60
68
  expect(provider).to receive(:create_zip).and_return('/path/to/file.zip')
61
69
  expect(provider).to receive(:archive_name).and_return('file.zip')
62
- expect(provider).to receive(:upload).with('file.zip', '/path/to/file.zip').and_return(s3_object)
70
+ expect(provider).to receive(:upload).with('file.zip', '/path/to/file.zip').and_call_original
63
71
  expect(provider).to receive(:sleep).with(5)
64
- expect(provider).to receive(:create_app_version).with(s3_object).and_return(app_version)
72
+ expect(provider).to receive(:create_app_version).with(bucket_mock).and_return(app_version)
65
73
  expect(provider).to receive(:update_app).with(app_version)
66
74
 
67
75
  provider.push_app
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dpl
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.12.travis.773.4
4
+ version: 1.7.12.travis.774.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Konstantin Haase
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-04 00:00:00.000000000 Z
11
+ date: 2015-05-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec