dockly 4.1.0 → 4.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0eb949e588205c02f1c15dbc3b609b7d14e3fd24
4
- data.tar.gz: 52ab9c8916b071f0035400ced4c4fd73cf407885
3
+ metadata.gz: 817b3a75ce89c73e9ad40e97913c7e694f6d5d39
4
+ data.tar.gz: 7a0a50ba3a0c833f77deefda46eace5917b0b1d2
5
5
  SHA512:
6
- metadata.gz: e5ec4ce34a0bc5b270451dbd717988038a4ad3344e1a2f1d497a089cf287f3da1d8d3b940291575b8d69f75a9d00df685e36a1ec2cd9134e3d651d190f32dd75
7
- data.tar.gz: 3400f1bf912778501d3b360d75a17d22e959ad68d1a5dee63bbfe9785d73bbb9a42fac4465486f8445469dbd6fd9f99b67c38be066edfd2f2dbd860d808d4ca9
6
+ metadata.gz: d3e29e2b40e5dede34e76d19a7635b2e8d051fc799b41961871a5fee4e2011c1616954518aef46cae0f591561452180816e786aa0a919a9b0713c9c94b6c61a3
7
+ data.tar.gz: d4f4dc7bd97cbca3071ef9099ae8150b77b826daa4ba62c999d88ddb15dd62f175523f0c802d0e949d361c933179c987cb887fe1066917a8ad10f9387ed5bbef
data/dockly.gemspec CHANGED
@@ -18,7 +18,9 @@ Gem::Specification.new do |gem|
18
18
  gem.add_dependency 'docker-api', '>= 1.14.0'
19
19
  gem.add_dependency 'dockly-util', '>= 0.0.9', '< 1.0'
20
20
  gem.add_dependency 'excon'
21
- gem.add_dependency 'aws-sdk', '~> 2.0'
21
+ gem.add_dependency 'aws-sdk-core', '~> 3'
22
+ gem.add_dependency 'aws-sdk-s3', '~> 1'
23
+ gem.add_dependency 'aws-sdk-ecr', '~> 1'
22
24
  gem.add_dependency 'foreman'
23
25
  gem.add_dependency 'fpm', '~> 1.2.0'
24
26
  gem.add_dependency 'minigit', '~> 0.0.4'
data/lib/dockly.rb CHANGED
@@ -4,7 +4,9 @@ require 'dockly/util/git'
4
4
  require 'foreman/cli_fix'
5
5
  require 'foreman/export/base_fix'
6
6
  require 'minigit'
7
- require 'aws-sdk'
7
+ require 'aws-sdk-core'
8
+ require 'aws-sdk-s3'
9
+ require 'aws-sdk-ecr'
8
10
  require 'open3'
9
11
 
10
12
  module Dockly
@@ -1,6 +1,6 @@
1
1
  module Dockly
2
2
  MAJOR = 4
3
- MINOR = 1
3
+ MINOR = 2
4
4
  PATCH = 0
5
5
  RELEASE = nil
6
6
 
@@ -14,8 +14,11 @@ describe Dockly::BuildCache::Base do
14
14
  describe '#up_to_date?' do
15
15
  context 'when the object exists in s3' do
16
16
  before do
17
- allow(subject.connection)
18
- .to receive(:head_object)
17
+ allow(Dockly)
18
+ .to receive(:s3)
19
+ .and_return(
20
+ Aws::S3::Client.new(stub_responses: true)
21
+ )
19
22
  end
20
23
 
21
24
  its(:up_to_date?) { should be_true }
@@ -23,9 +26,13 @@ describe Dockly::BuildCache::Base do
23
26
 
24
27
  context 'when the object does not exist in s3' do
25
28
  before do
26
- allow(subject.connection)
27
- .to receive(:head_object)
28
- .and_raise(Aws::S3::Errors::NoSuchKey.new('Some Error', 500))
29
+ allow(Dockly)
30
+ .to receive(:s3)
31
+ .and_return(
32
+ Aws::S3::Client.new(
33
+ stub_responses: { :head_object => 'NoSuchKey' }
34
+ )
35
+ )
29
36
  end
30
37
 
31
38
  its(:up_to_date?) { should be_false }
@@ -37,9 +44,12 @@ describe Dockly::BuildCache::Base do
37
44
  let(:object) { double(:object) }
38
45
 
39
46
  before do
40
- allow(subject.connection)
41
- .to receive(:get_object)
42
- .and_return(object)
47
+ allow(Dockly)
48
+ .to receive(:s3)
49
+ .and_return(Aws::S3::Client.new(
50
+ stub_responses: { :get_object => object }
51
+ ))
52
+
43
53
  allow(object)
44
54
  .to receive(:body)
45
55
  .and_return(StringIO.new('hey dad').tap(&:rewind))
@@ -205,14 +205,19 @@ describe Dockly::Deb do
205
205
  pre_install "ls"
206
206
  post_install "rd /s /q C:\*"
207
207
  build_dir 'build/deb/s3'
208
+ s3_bucket 'bucket'
208
209
  end
209
210
  end
210
211
 
211
212
  context 'when the object does exist' do
212
213
  before do
213
- allow(Dockly.s3)
214
- .to receive(:head_object)
215
- .and_return({})
214
+ allow(Dockly)
215
+ .to receive(:s3)
216
+ .and_return(
217
+ Aws::S3::Client.new(
218
+ stub_responses: { :head_object => {} }
219
+ )
220
+ )
216
221
  end
217
222
 
218
223
  it 'is true' do
@@ -222,12 +227,16 @@ describe Dockly::Deb do
222
227
 
223
228
  context 'when the object does not exist' do
224
229
  before do
225
- allow(Dockly.s3)
226
- .to receive(:head_object)
227
- .and_raise(StandardError.new('object does not exist'))
230
+ allow(Dockly)
231
+ .to receive(:s3)
232
+ .and_return(
233
+ Aws::S3::Client.new(
234
+ stub_responses: { :head_object => 'ObjectDoesNotExist' }
235
+ )
236
+ )
228
237
  end
229
238
 
230
- it 'is true' do
239
+ it 'is false' do
231
240
  expect(subject.exists?).to be_false
232
241
  end
233
242
  end
@@ -267,12 +276,24 @@ describe Dockly::Deb do
267
276
  context 'when the package has been created' do
268
277
  before { subject.create_package! }
269
278
 
279
+ let(:client) do
280
+ client = Aws::S3::Client.new(stub_responses: true)
281
+ client.stub_responses(
282
+ :put_object, ->(context) do
283
+ expect(context.params[:bucket]).to eq(bucket_name)
284
+ expect(context.params[:key]).to eq(subject.s3_object_name)
285
+ expect(context.params).to have_key(:body)
286
+
287
+ {}
288
+ end
289
+ )
290
+ client
291
+ end
292
+
270
293
  it 'inserts the deb package into that bucket' do
271
- expect(Dockly.s3).to receive(:put_object) do |hash|
272
- expect(hash[:bucket]).to eq(bucket_name)
273
- expect(hash[:key]).to eq(subject.s3_object_name)
274
- expect(hash).to have_key(:body)
275
- end
294
+ expect(Dockly)
295
+ .to receive(:s3)
296
+ .and_return(client)
276
297
 
277
298
  subject.upload_to_s3
278
299
  end
@@ -204,11 +204,15 @@ describe Dockly::Docker do
204
204
  let(:url) { 's3://bucket/object' }
205
205
  let(:data) { 'sweet, sweet data' }
206
206
 
207
+ let(:client) { double() }
208
+
207
209
  before do
208
- allow(Dockly.s3)
210
+ allow(client)
209
211
  .to receive(:get_object)
210
- .with(bucket: 'bucket', key: 'object')
212
+ .with(hash_including({ bucket: 'bucket', key: 'object' }))
211
213
  .and_yield(data)
214
+
215
+ allow(Dockly).to receive(:s3).and_return(client)
212
216
  end
213
217
 
214
218
  it 'pulls the file from S3' do
@@ -11,6 +11,7 @@ describe Dockly::Rpm do
11
11
  pre_install "ls"
12
12
  post_install "rd /s /q C:\*"
13
13
  build_dir 'build'
14
+ s3_bucket 'bucket'
14
15
  end
15
16
  end
16
17
  let(:filename) { "build/rpm/my-sweet-rpm_77.0.8_x86_64.rpm" }
@@ -173,14 +174,17 @@ describe Dockly::Rpm do
173
174
  pre_install "ls"
174
175
  post_install "rd /s /q C:\*"
175
176
  build_dir 'build/rpm/s3'
177
+ s3_bucket 'bucket'
176
178
  end
177
179
  end
178
180
 
179
181
  context 'when the object does exist' do
180
182
  before do
181
- allow(Dockly.s3)
182
- .to receive(:head_object)
183
- .and_return({})
183
+ allow(Dockly)
184
+ .to receive(:s3)
185
+ .and_return(
186
+ Aws::S3::Client.new(stub_responses: true)
187
+ )
184
188
  end
185
189
 
186
190
  it 'is true' do
@@ -190,9 +194,13 @@ describe Dockly::Rpm do
190
194
 
191
195
  context 'when the object does not exist' do
192
196
  before do
193
- allow(Dockly.s3)
194
- .to receive(:head_object)
195
- .and_raise(StandardError.new('object does not exist'))
197
+ allow(Dockly)
198
+ .to receive(:s3)
199
+ .and_return(
200
+ Aws::S3::Client.new(
201
+ stub_responses: { :head_object => 'NoSuchKey' }
202
+ )
203
+ )
196
204
  end
197
205
 
198
206
  it 'is true' do
@@ -235,12 +243,24 @@ describe Dockly::Rpm do
235
243
  context 'when the package has been created' do
236
244
  before { subject.create_package! }
237
245
 
246
+ let(:client) do
247
+ client = Aws::S3::Client.new(stub_responses: true)
248
+ client.stub_responses(
249
+ :put_object, ->(context) do
250
+ expect(context.params[:bucket]).to eq(bucket_name)
251
+ expect(context.params[:key]).to eq(subject.s3_object_name)
252
+ expect(context.params).to have_key(:body)
253
+
254
+ {}
255
+ end
256
+ )
257
+ client
258
+ end
259
+
238
260
  it 'inserts the rpm package into that bucket' do
239
- expect(Dockly.s3).to receive(:put_object) do |hash|
240
- expect(hash[:bucket]).to eq(bucket_name)
241
- expect(hash[:key]).to eq(subject.s3_object_name)
242
- expect(hash).to have_key(:body)
243
- end
261
+ expect(Dockly)
262
+ .to receive(:s3)
263
+ .and_return(client)
244
264
 
245
265
  subject.upload_to_s3
246
266
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dockly
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.0
4
+ version: 4.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Swipely, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-26 00:00:00.000000000 Z
11
+ date: 2021-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: clamp
@@ -73,19 +73,47 @@ dependencies:
73
73
  - !ruby/object:Gem::Version
74
74
  version: '0'
75
75
  - !ruby/object:Gem::Dependency
76
- name: aws-sdk
76
+ name: aws-sdk-core
77
77
  requirement: !ruby/object:Gem::Requirement
78
78
  requirements:
79
79
  - - "~>"
80
80
  - !ruby/object:Gem::Version
81
- version: '2.0'
81
+ version: '3'
82
82
  type: :runtime
83
83
  prerelease: false
84
84
  version_requirements: !ruby/object:Gem::Requirement
85
85
  requirements:
86
86
  - - "~>"
87
87
  - !ruby/object:Gem::Version
88
- version: '2.0'
88
+ version: '3'
89
+ - !ruby/object:Gem::Dependency
90
+ name: aws-sdk-s3
91
+ requirement: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - "~>"
94
+ - !ruby/object:Gem::Version
95
+ version: '1'
96
+ type: :runtime
97
+ prerelease: false
98
+ version_requirements: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - "~>"
101
+ - !ruby/object:Gem::Version
102
+ version: '1'
103
+ - !ruby/object:Gem::Dependency
104
+ name: aws-sdk-ecr
105
+ requirement: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - "~>"
108
+ - !ruby/object:Gem::Version
109
+ version: '1'
110
+ type: :runtime
111
+ prerelease: false
112
+ version_requirements: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - "~>"
115
+ - !ruby/object:Gem::Version
116
+ version: '1'
89
117
  - !ruby/object:Gem::Dependency
90
118
  name: foreman
91
119
  requirement: !ruby/object:Gem::Requirement