asset_sync 2.19.0 → 2.19.2
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 +4 -4
- data/.github/workflows/codeql.yml +1 -1
- data/.github/workflows/tests.yaml +6 -12
- data/Appraisals +8 -4
- data/CHANGELOG.md +21 -1
- data/gemfiles/{rails_6_0.gemfile → rails_7_1.gemfile} +1 -1
- data/gemfiles/rails_7_2.gemfile +10 -0
- data/lib/asset_sync/storage.rb +5 -4
- data/lib/asset_sync/version.rb +1 -1
- data/spec/unit/storage_spec.rb +89 -0
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f70e24d97f3b4f93b46abf1fc3548542c68459068488f77345c2372a2469eb69
|
4
|
+
data.tar.gz: 1b56251e0bf37a3a9ba87c2686489c0f28651a8869d0b218dcf8f523c98e9588
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3610b941614fbb44286c170fa4c5c6868207c67e18979ae25e520db158d66c4f343164b4c4c8f920fa1b33d5056166e53cf1e9782601aa11deb0ddf6e2a8a15
|
7
|
+
data.tar.gz: c7682095497be9206f92e4cddfcee6c1da9046a4445b99031ca1c89814c53c952d05ff73cc52a04f2c4e920d18e9f0874df7dbb5d7680d63f4898edf6e2347a7
|
@@ -26,33 +26,27 @@ jobs:
|
|
26
26
|
os:
|
27
27
|
- ubuntu
|
28
28
|
ruby:
|
29
|
-
- 2.7
|
30
29
|
- 3.0
|
31
30
|
- 3.1
|
32
31
|
- 3.2
|
32
|
+
- 3.3
|
33
33
|
- jruby
|
34
34
|
gemfile:
|
35
|
-
- gemfiles/rails_6_0.gemfile
|
36
35
|
- gemfiles/rails_6_1.gemfile
|
37
36
|
- gemfiles/rails_7_0.gemfile
|
37
|
+
- gemfiles/rails_7_1.gemfile
|
38
|
+
- gemfiles/rails_7_2.gemfile
|
38
39
|
allow_failures:
|
39
40
|
- false
|
40
41
|
include:
|
41
42
|
- os: ubuntu
|
42
43
|
ruby: ruby-head
|
43
|
-
gemfile: gemfiles/
|
44
|
+
gemfile: gemfiles/rails_7_2.gemfile
|
44
45
|
allow_failures: true
|
45
46
|
- os: ubuntu
|
46
47
|
ruby: jruby-head
|
47
|
-
gemfile: gemfiles/
|
48
|
+
gemfile: gemfiles/rails_7_2.gemfile
|
48
49
|
allow_failures: true
|
49
|
-
exclude:
|
50
|
-
- os: ubuntu
|
51
|
-
ruby: jruby
|
52
|
-
# Rails 7 requires Ruby 2.7
|
53
|
-
# `jruby-9.3.7.0` only supports 2.6.x
|
54
|
-
gemfile: gemfiles/rails_7_0.gemfile
|
55
|
-
allow_failures: false
|
56
50
|
env:
|
57
51
|
BUNDLE_GEMFILE: "${{ matrix.gemfile }}"
|
58
52
|
ALLOW_FAILURES: "${{ matrix.allow_failures }}"
|
@@ -60,7 +54,7 @@ jobs:
|
|
60
54
|
continue-on-error: ${{ endsWith(matrix.ruby, 'head') || matrix.ruby == 'debug' }}
|
61
55
|
steps:
|
62
56
|
- name: Checkout
|
63
|
-
uses: actions/checkout@
|
57
|
+
uses: actions/checkout@v4
|
64
58
|
- name: Setup Ruby
|
65
59
|
uses: ruby/setup-ruby@v1
|
66
60
|
with:
|
data/Appraisals
CHANGED
@@ -1,8 +1,4 @@
|
|
1
1
|
|
2
|
-
appraise "rails_6_0" do
|
3
|
-
gem "rails", "~> 6.0.0"
|
4
|
-
end
|
5
|
-
|
6
2
|
appraise "rails_6_1" do
|
7
3
|
gem "rails", "~> 6.1.0"
|
8
4
|
end
|
@@ -10,3 +6,11 @@ end
|
|
10
6
|
appraise "rails_7_0" do
|
11
7
|
gem "rails", "~> 7.0.0"
|
12
8
|
end
|
9
|
+
|
10
|
+
appraise "rails_7_1" do
|
11
|
+
gem "rails", "~> 7.1.0"
|
12
|
+
end
|
13
|
+
|
14
|
+
appraise "rails_7_2" do
|
15
|
+
gem "rails", "~> 7.2.0"
|
16
|
+
end
|
data/CHANGELOG.md
CHANGED
@@ -18,6 +18,25 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
18
18
|
- Nothing
|
19
19
|
|
20
20
|
|
21
|
+
## [2.19.2] - 2024-08-29
|
22
|
+
|
23
|
+
### Fixed
|
24
|
+
|
25
|
+
- Avoid duplicate files in remote files list cache
|
26
|
+
(https://github.com/AssetSync/asset_sync/pull/439)
|
27
|
+
- Drop trailing slash of prefix in #get_local_files
|
28
|
+
(https://github.com/AssetSync/asset_sync/pull/425)
|
29
|
+
|
30
|
+
|
31
|
+
## [2.19.1] - 2023-08-17
|
32
|
+
|
33
|
+
### Fixed
|
34
|
+
|
35
|
+
- Fix issues from https://github.com/AssetSync/asset_sync/pull/435
|
36
|
+
- https://github.com/AssetSync/asset_sync/commit/35bef657e9c65268e4888d489950184b238ba13f
|
37
|
+
- https://github.com/AssetSync/asset_sync/pull/437
|
38
|
+
|
39
|
+
|
21
40
|
## [2.19.0] - 2023-08-15
|
22
41
|
|
23
42
|
### Added
|
@@ -1094,7 +1113,8 @@ Changes:
|
|
1094
1113
|
* Merge branch 'sinatra'
|
1095
1114
|
|
1096
1115
|
|
1097
|
-
[Unreleased]: https://github.com/AssetSync/asset_sync/compare/v2.19.
|
1116
|
+
[Unreleased]: https://github.com/AssetSync/asset_sync/compare/v2.19.1...HEAD
|
1117
|
+
[2.19.1]: https://github.com/AssetSync/asset_sync/compare/v2.19.0...v2.19.1
|
1098
1118
|
[2.19.0]: https://github.com/AssetSync/asset_sync/compare/v2.18.1...v2.19.0
|
1099
1119
|
[2.18.1]: https://github.com/AssetSync/asset_sync/compare/v2.18.0...v2.18.1
|
1100
1120
|
[2.18.0]: https://github.com/AssetSync/asset_sync/compare/v2.17.0...v2.18.0
|
@@ -5,6 +5,6 @@ source "https://rubygems.org"
|
|
5
5
|
gem "rcov", platforms: :mri_18, group: [:development, :test]
|
6
6
|
gem "simplecov", platforms: [:jruby, :mri_19, :ruby_19, :mri_20, :rbx], group: [:development, :test], require: false
|
7
7
|
gem "jruby-openssl", platform: :jruby
|
8
|
-
gem "rails", "~>
|
8
|
+
gem "rails", "~> 7.1.0"
|
9
9
|
|
10
10
|
gemspec path: "../"
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
gem "rcov", platforms: :mri_18, group: [:development, :test]
|
6
|
+
gem "simplecov", platforms: [:jruby, :mri_19, :ruby_19, :mri_20, :rbx], group: [:development, :test], require: false
|
7
|
+
gem "jruby-openssl", platform: :jruby
|
8
|
+
gem "rails", "~> 7.2.0"
|
9
|
+
|
10
|
+
gemspec path: "../"
|
data/lib/asset_sync/storage.rb
CHANGED
@@ -108,7 +108,7 @@ module AssetSync
|
|
108
108
|
return if ignore_existing_remote_files?
|
109
109
|
|
110
110
|
File.open(self.remote_file_list_cache_file_path, 'w') do |file|
|
111
|
-
uploaded = local_files_to_upload + remote_files
|
111
|
+
uploaded = (local_files_to_upload + remote_files).uniq.sort
|
112
112
|
file.write(uploaded.to_json)
|
113
113
|
end
|
114
114
|
end
|
@@ -171,7 +171,7 @@ module AssetSync
|
|
171
171
|
|
172
172
|
log "Using: Directory Search of #{path}/#{self.config.assets_prefix}"
|
173
173
|
Dir.chdir(path) do
|
174
|
-
to_load = self.config.assets_prefix.present? ?
|
174
|
+
to_load = self.config.assets_prefix.present? ? File.join(self.config.assets_prefix, '/**/**') : '**/**'
|
175
175
|
Dir[to_load]
|
176
176
|
end
|
177
177
|
end
|
@@ -264,12 +264,13 @@ module AssetSync
|
|
264
264
|
if config.compression
|
265
265
|
compressed_name = "#{path}/#{f}.#{config.compression}"
|
266
266
|
|
267
|
-
|
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?(
|
273
|
+
elsif File.exist?(compressed_name)
|
273
274
|
original_size = File.size("#{path}/#{f}")
|
274
275
|
compressed_size = File.size(compressed_name)
|
275
276
|
|
data/lib/asset_sync/version.rb
CHANGED
data/spec/unit/storage_spec.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
+
require 'fileutils'
|
2
3
|
|
3
4
|
describe AssetSync::Storage do
|
4
5
|
include_context "mock Rails without_yml"
|
@@ -393,6 +394,46 @@ describe AssetSync::Storage do
|
|
393
394
|
end
|
394
395
|
storage.upload_file('assets/some_longer_path/local_image2.jpg')
|
395
396
|
end
|
397
|
+
|
398
|
+
context 'config.gzip_compression is enabled' do
|
399
|
+
context 'when the file is a css file' do
|
400
|
+
it 'should upload the file' do
|
401
|
+
@config.gzip_compression = true
|
402
|
+
|
403
|
+
storage = AssetSync::Storage.new(@config)
|
404
|
+
allow(storage).to receive(:get_local_files).and_return(@local_files)
|
405
|
+
allow(storage).to receive(:get_remote_files).and_return(@remote_files)
|
406
|
+
# Pretend they all exist
|
407
|
+
allow(File).to receive(:open).and_return(file_like_object)
|
408
|
+
bucket = double
|
409
|
+
files = double
|
410
|
+
allow(storage).to receive(:bucket).and_return(bucket)
|
411
|
+
allow(bucket).to receive(:files).and_return(files)
|
412
|
+
|
413
|
+
expect(files).to receive(:create).with({ body: file_like_object, content_type: "text/css", key: "assets/local.css", public: true }).once
|
414
|
+
storage.upload_file('assets/local.css')
|
415
|
+
end
|
416
|
+
end
|
417
|
+
|
418
|
+
context 'when the file is a gz file' do
|
419
|
+
it 'should not upload the file' do
|
420
|
+
@config.gzip_compression = true
|
421
|
+
|
422
|
+
storage = AssetSync::Storage.new(@config)
|
423
|
+
allow(storage).to receive(:get_local_files).and_return(@local_files)
|
424
|
+
allow(storage).to receive(:get_remote_files).and_return(@remote_files)
|
425
|
+
# Pretend they all exist
|
426
|
+
allow(File).to receive(:open).and_return(file_like_object)
|
427
|
+
bucket = double
|
428
|
+
files = double
|
429
|
+
allow(storage).to receive(:bucket).and_return(bucket)
|
430
|
+
allow(bucket).to receive(:files).and_return(files)
|
431
|
+
|
432
|
+
expect(files).to_not receive(:create)
|
433
|
+
storage.upload_file('assets/local.css.gz')
|
434
|
+
end
|
435
|
+
end
|
436
|
+
end
|
396
437
|
end
|
397
438
|
|
398
439
|
describe '#delete_extra_remote_files' do
|
@@ -450,4 +491,52 @@ describe AssetSync::Storage do
|
|
450
491
|
end
|
451
492
|
end
|
452
493
|
end
|
494
|
+
|
495
|
+
describe '#get_local_files' do
|
496
|
+
around(:each) do |example|
|
497
|
+
Dir.mktmpdir do |public_path|
|
498
|
+
@public_path = public_path
|
499
|
+
example.call
|
500
|
+
end
|
501
|
+
end
|
502
|
+
|
503
|
+
before(:each) do
|
504
|
+
@config = AssetSync::Config.new
|
505
|
+
@config.public_path = @public_path
|
506
|
+
@config.prefix = 'assets'
|
507
|
+
@storage = AssetSync::Storage.new(@config)
|
508
|
+
|
509
|
+
Dir.mkdir("#{@public_path}/assets")
|
510
|
+
end
|
511
|
+
|
512
|
+
context 'with empty directory' do
|
513
|
+
it 'has no files' do
|
514
|
+
expect(@storage.get_local_files).to eq([])
|
515
|
+
end
|
516
|
+
end
|
517
|
+
|
518
|
+
context 'with non-empty directory' do
|
519
|
+
before(:each) do
|
520
|
+
FileUtils.touch("#{@public_path}/assets/application.js")
|
521
|
+
end
|
522
|
+
|
523
|
+
it 'lists available files' do
|
524
|
+
expect(@storage.get_local_files).to eq([
|
525
|
+
'assets/application.js'
|
526
|
+
])
|
527
|
+
end
|
528
|
+
|
529
|
+
context 'with trailing slash on asset prefix' do
|
530
|
+
before(:each) do
|
531
|
+
@config.prefix = 'assets/'
|
532
|
+
end
|
533
|
+
|
534
|
+
it 'lists available files with single slashes' do
|
535
|
+
expect(@storage.get_local_files).to eq([
|
536
|
+
'assets/application.js'
|
537
|
+
])
|
538
|
+
end
|
539
|
+
end
|
540
|
+
end
|
541
|
+
end
|
453
542
|
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.19.
|
4
|
+
version: 2.19.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:
|
14
|
+
date: 2024-08-29 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: fog-core
|
@@ -233,9 +233,10 @@ files:
|
|
233
233
|
- UPGRADING.md
|
234
234
|
- asset_sync.gemspec
|
235
235
|
- docs/heroku.md
|
236
|
-
- gemfiles/rails_6_0.gemfile
|
237
236
|
- gemfiles/rails_6_1.gemfile
|
238
237
|
- gemfiles/rails_7_0.gemfile
|
238
|
+
- gemfiles/rails_7_1.gemfile
|
239
|
+
- gemfiles/rails_7_2.gemfile
|
239
240
|
- lib/asset_sync.rb
|
240
241
|
- lib/asset_sync/asset_sync.rb
|
241
242
|
- lib/asset_sync/config.rb
|
@@ -288,7 +289,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
288
289
|
- !ruby/object:Gem::Version
|
289
290
|
version: '0'
|
290
291
|
requirements: []
|
291
|
-
rubygems_version: 3.
|
292
|
+
rubygems_version: 3.5.18
|
292
293
|
signing_key:
|
293
294
|
specification_version: 4
|
294
295
|
summary: Synchronises Assets in a Rails 3 application and Amazon S3/Cloudfront and
|