asset_sync 2.8.1 → 2.8.2

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
  SHA256:
3
- metadata.gz: 8fe1b25680b5ffe0564794f00e56e46d6f25fb1880b23f6887d653aa8e6ccdbd
4
- data.tar.gz: 3d3b3847e385485bf86ba3752aa7a73e87418866cf475312844c5bd50130060f
3
+ metadata.gz: 5897684db35a90b21d8b5e24a262a3d5e38685e0e38df3cbc0f1ba745bff118c
4
+ data.tar.gz: 5f82d80aa6ca05cd26cc7f8548c8bd1306ee2686a959565879ce2a731e80b0a3
5
5
  SHA512:
6
- metadata.gz: d4b805b6cac2e2f7c0a1e15d1225aa52c263a9c38036871e5e34807ba51fd7fa568ac1d49d2da629f5132e0d41c9cce45c020a0439aace9809b1f5f6b6cb9f16
7
- data.tar.gz: 8bf270ecef14d5b3a1e1bc760d05aacd5009e5b69d5b927f731571380c008894adf33b7c9c554b39981b22c17f65afbab5b84b492c687c39b5828549a3504cde
6
+ metadata.gz: 73ac0a4ab2a64cd398783cb3b2b3dd67581e1e09b825453a9284472364161b4035dc98bba8b94bd114fe14ab513e9b73bd306482f1a5c4a73d1281b41e791fd7
7
+ data.tar.gz: 05a0c3b718aabf16aa1b355fc249cfbcedc60736a69a80270e2a80546f3cda2ccb1417cc35789bd1af8e6faef9d9aaf622ac89b106341ad11718add86207cdcd
@@ -9,6 +9,7 @@ rvm:
9
9
  - 2.4
10
10
  - 2.5
11
11
  - 2.6
12
+ - 2.7
12
13
  - ruby-head
13
14
  - jruby
14
15
  - jruby-head
@@ -21,7 +22,7 @@ gemfile:
21
22
  before_install:
22
23
  # Cannot use bundler 2.x due to dependency (mainly rails 4.2)
23
24
  # Solution from https://github.com/rails/rails/blob/4-2-stable/.travis.yml
24
- - "travis_retry gem update --system 2.7.8 --no-doc || travis_retry gem update --system 2.7.8 --no-rdoc --no-ri"
25
+ - "travis_retry gem update --system --no-doc || travis_retry gem update --system --no-rdoc --no-ri"
25
26
  - "travis_retry gem install bundler -v '<2'"
26
27
  env:
27
28
  global:
@@ -18,6 +18,14 @@ This project adheres to [Semantic Versioning](http://semver.org/).
18
18
  - Nothing
19
19
 
20
20
 
21
+ ## [2.8.2] - 2019-12-27
22
+
23
+ ### Changed
24
+
25
+ - Use `delete_multiple_objects` when storage is `aws`
26
+ (https://github.com/AssetSync/asset_sync/pull/392)
27
+
28
+
21
29
  ## [2.8.1] - 2019-07-25
22
30
 
23
31
  ### Changed
@@ -922,7 +930,8 @@ Changes:
922
930
  * Merge branch 'sinatra'
923
931
 
924
932
 
925
- [Unreleased]: https://github.com/AssetSync/asset_sync/compare/v2.8.1...HEAD
933
+ [Unreleased]: https://github.com/AssetSync/asset_sync/compare/v2.8.2...HEAD
934
+ [2.8.2]: https://github.com/AssetSync/asset_sync/compare/v2.8.1...v2.8.2
926
935
  [2.8.1]: https://github.com/AssetSync/asset_sync/compare/v2.8.0...v2.8.1
927
936
  [2.8.0]: https://github.com/AssetSync/asset_sync/compare/v2.7.0...v2.8.0
928
937
  [2.7.0]: https://github.com/AssetSync/asset_sync/compare/v2.6.0...v2.7.0
@@ -132,9 +132,15 @@ module AssetSync
132
132
  from_remote_files_to_delete = remote_files - local_files - ignored_files - always_upload_files
133
133
 
134
134
  log "Flagging #{from_remote_files_to_delete.size} file(s) for deletion"
135
- # Delete unneeded remote files
136
- bucket.files.each do |f|
137
- delete_file(f, from_remote_files_to_delete)
135
+ # Delete unneeded remote files, if we are on aws delete in bulk else use sequential delete
136
+ if self.config.aws? && connection.respond_to?(:delete_multiple_objects)
137
+ from_remote_files_to_delete.each_slice(500) do |slice|
138
+ connection.delete_multiple_objects(config.fog_directory, slice)
139
+ end
140
+ else
141
+ bucket.files.each do |f|
142
+ delete_file(f, from_remote_files_to_delete)
143
+ end
138
144
  end
139
145
  end
140
146
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AssetSync
4
- VERSION = "2.8.1".freeze
4
+ VERSION = "2.8.2"
5
5
  end
@@ -307,4 +307,59 @@ describe AssetSync::Storage do
307
307
  storage.upload_file('assets/some_longer_path/local_image2.jpg')
308
308
  end
309
309
  end
310
+
311
+ describe '#delete_extra_remote_files' do
312
+ it 'should delete the files in bulk' do
313
+ remote_files = ['public/image.png']
314
+ connection = double
315
+ config = double
316
+
317
+ storage = AssetSync::Storage.new(@config)
318
+
319
+ [:local_files, :ignored_files, :always_upload_files].each do |method|
320
+ expect(storage).to receive(method).and_return([])
321
+ end
322
+
323
+ allow(storage).to receive(:get_remote_files).and_return(remote_files)
324
+ allow(storage).to receive(:connection).and_return(connection).twice
325
+ allow(storage).to receive(:config).and_return(config).twice
326
+ allow(config).to receive(:aws?).and_return(true)
327
+ allow(config).to receive(:fog_directory).and_return('foo')
328
+ expect(connection).to receive(:delete_multiple_objects).with('foo', remote_files)
329
+
330
+ storage.delete_extra_remote_files
331
+ end
332
+
333
+ context 'when not aws' do
334
+ it 'deletes files sequentially' do
335
+ remote_files = ['public/image.png']
336
+ connection = double
337
+ config = double
338
+ directories = double
339
+ directory = double
340
+ file = double
341
+
342
+ storage = AssetSync::Storage.new(@config)
343
+
344
+ [:local_files, :ignored_files, :always_upload_files].each do |method|
345
+ expect(storage).to receive(method).and_return([])
346
+ end
347
+
348
+ allow(storage).to receive(:get_remote_files).and_return(remote_files)
349
+ allow(storage).to receive(:connection).and_return(connection).twice
350
+ allow(storage).to receive(:config).and_return(config)
351
+ allow(config).to receive(:aws?).and_return(false)
352
+ allow(config).to receive(:fog_directory).and_return('foo')
353
+ allow(config).to receive(:assets_prefix).and_return('foo')
354
+ allow(directories).to receive(:get).and_return(directory)
355
+ allow(directory).to receive(:files).and_return([file])
356
+ allow(file).to receive(:key).and_return('public/image.png')
357
+ allow(connection).to receive(:directories).and_return(directories)
358
+ expect(connection).not_to receive(:delete_multiple_objects)
359
+ expect(file).to receive(:destroy)
360
+
361
+ storage.delete_extra_remote_files
362
+ end
363
+ end
364
+ end
310
365
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asset_sync
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.8.1
4
+ version: 2.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simon Hamilton
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2019-07-25 00:00:00.000000000 Z
14
+ date: 2019-12-27 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: fog-core
@@ -257,7 +257,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
257
257
  - !ruby/object:Gem::Version
258
258
  version: '0'
259
259
  requirements: []
260
- rubygems_version: 3.0.4
260
+ rubygems_version: 3.1.2
261
261
  signing_key:
262
262
  specification_version: 4
263
263
  summary: Synchronises Assets in a Rails 3 application and Amazon S3/Cloudfront and