asset_sync 2.19.0 → 2.19.1

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,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9cdf3c86a21ba63d0de80b07420b5c4f1833f25dbbcefbc92a740599d2d166da
4
- data.tar.gz: a4c394ecc38feadf42e70643c7485a9dc68d6cccb9e86d8c9d00b99f41e5064f
3
+ metadata.gz: a3cff5bf62d9a38dccdb2cc331751542d095f116f65d57adb724ff73c9ee5c7a
4
+ data.tar.gz: e7ae0540fae435e27746843d3f6f252df988d48dfe38f5df0ee33935b6dabc57
5
5
  SHA512:
6
- metadata.gz: 1cf38f1aa03aa20864cd1b6afadffff78bb032cfe7f15bea92c3f196c034c603d2a1d79e4393ace6f9fda35b8759b2ac5108efb86c9fdf260b898478fc0c3a2f
7
- data.tar.gz: b26de287f9164b653e7404723672bd746cf899c57df8ed2b7100ba5a1470f0ca6619d6e7ed9b3bbb1c12f6af358e30665e449f4cfc235ff9db55b2b52c179c1a
6
+ metadata.gz: bae0a6a3491aa7b5f9e5f45aba77509a0d77511fbe03fe2f293660a58ddd59dfdfbce74f9d4c253350180b40ea623a78871472d135ce8961fb893d820b6991fc
7
+ data.tar.gz: 1294404e59e81c7557c312c2af66892d5c78c80ceeae4f2d38550389fccea111e5f40b711135ed896d90e83036baf709ba7cdab86ffccd867d414f2af643d741
data/CHANGELOG.md CHANGED
@@ -18,6 +18,15 @@ This project adheres to [Semantic Versioning](http://semver.org/).
18
18
  - Nothing
19
19
 
20
20
 
21
+ ## [2.19.1] - 2023-08-17
22
+
23
+ ### Fixed
24
+
25
+ - Fix issues from https://github.com/AssetSync/asset_sync/pull/435
26
+ - https://github.com/AssetSync/asset_sync/commit/35bef657e9c65268e4888d489950184b238ba13f
27
+ - https://github.com/AssetSync/asset_sync/pull/437
28
+
29
+
21
30
  ## [2.19.0] - 2023-08-15
22
31
 
23
32
  ### Added
@@ -1094,7 +1103,8 @@ Changes:
1094
1103
  * Merge branch 'sinatra'
1095
1104
 
1096
1105
 
1097
- [Unreleased]: https://github.com/AssetSync/asset_sync/compare/v2.19.0...HEAD
1106
+ [Unreleased]: https://github.com/AssetSync/asset_sync/compare/v2.19.1...HEAD
1107
+ [2.19.1]: https://github.com/AssetSync/asset_sync/compare/v2.19.0...v2.19.1
1098
1108
  [2.19.0]: https://github.com/AssetSync/asset_sync/compare/v2.18.1...v2.19.0
1099
1109
  [2.18.1]: https://github.com/AssetSync/asset_sync/compare/v2.18.0...v2.18.1
1100
1110
  [2.18.0]: https://github.com/AssetSync/asset_sync/compare/v2.17.0...v2.18.0
@@ -264,12 +264,13 @@ module AssetSync
264
264
  if config.compression
265
265
  compressed_name = "#{path}/#{f}.#{config.compression}"
266
266
 
267
- if File.extname(f) == config.compression
267
+ # `File.extname` returns value with `.` prefix, `config.compression` contains value without `.`
268
+ if File.extname(f)[1..-1] == config.compression
268
269
  # Don't bother uploading compressed assets if we are in compression mode
269
270
  # as we will overwrite file.css with file.css.gz if it exists.
270
271
  log "Ignoring: #{f}"
271
272
  ignore = true
272
- elsif File.exist?(compressed)
273
+ elsif File.exist?(compressed_name)
273
274
  original_size = File.size("#{path}/#{f}")
274
275
  compressed_size = File.size(compressed_name)
275
276
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AssetSync
4
- VERSION = "2.19.0"
4
+ VERSION = "2.19.1"
5
5
  end
@@ -393,6 +393,46 @@ describe AssetSync::Storage do
393
393
  end
394
394
  storage.upload_file('assets/some_longer_path/local_image2.jpg')
395
395
  end
396
+
397
+ context 'config.gzip_compression is enabled' do
398
+ context 'when the file is a css file' do
399
+ it 'should upload the file' do
400
+ @config.gzip_compression = true
401
+
402
+ storage = AssetSync::Storage.new(@config)
403
+ allow(storage).to receive(:get_local_files).and_return(@local_files)
404
+ allow(storage).to receive(:get_remote_files).and_return(@remote_files)
405
+ # Pretend they all exist
406
+ allow(File).to receive(:open).and_return(file_like_object)
407
+ bucket = double
408
+ files = double
409
+ allow(storage).to receive(:bucket).and_return(bucket)
410
+ allow(bucket).to receive(:files).and_return(files)
411
+
412
+ expect(files).to receive(:create).with({ body: file_like_object, content_type: "text/css", key: "assets/local.css", public: true }).once
413
+ storage.upload_file('assets/local.css')
414
+ end
415
+ end
416
+
417
+ context 'when the file is a gz file' do
418
+ it 'should not upload the file' do
419
+ @config.gzip_compression = true
420
+
421
+ storage = AssetSync::Storage.new(@config)
422
+ allow(storage).to receive(:get_local_files).and_return(@local_files)
423
+ allow(storage).to receive(:get_remote_files).and_return(@remote_files)
424
+ # Pretend they all exist
425
+ allow(File).to receive(:open).and_return(file_like_object)
426
+ bucket = double
427
+ files = double
428
+ allow(storage).to receive(:bucket).and_return(bucket)
429
+ allow(bucket).to receive(:files).and_return(files)
430
+
431
+ expect(files).to_not receive(:create)
432
+ storage.upload_file('assets/local.css.gz')
433
+ end
434
+ end
435
+ end
396
436
  end
397
437
 
398
438
  describe '#delete_extra_remote_files' do
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.19.0
4
+ version: 2.19.1
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: 2023-08-15 00:00:00.000000000 Z
14
+ date: 2023-08-17 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: fog-core