asset_sync 2.18.1 → 2.19.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +20 -1
- data/README.md +15 -9
- data/lib/asset_sync/config.rb +10 -5
- data/lib/asset_sync/engine.rb +2 -1
- data/lib/asset_sync/storage.rb +37 -28
- data/lib/asset_sync/version.rb +1 -1
- data/spec/unit/asset_sync_spec.rb +6 -6
- data/spec/unit/azure_rm_spec.rb +6 -6
- data/spec/unit/backblaze_spec.rb +6 -6
- data/spec/unit/google_spec.rb +6 -6
- data/spec/unit/railsless_spec.rb +2 -2
- data/spec/unit/storage_spec.rb +40 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a3cff5bf62d9a38dccdb2cc331751542d095f116f65d57adb724ff73c9ee5c7a
|
4
|
+
data.tar.gz: e7ae0540fae435e27746843d3f6f252df988d48dfe38f5df0ee33935b6dabc57
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bae0a6a3491aa7b5f9e5f45aba77509a0d77511fbe03fe2f293660a58ddd59dfdfbce74f9d4c253350180b40ea623a78871472d135ce8961fb893d820b6991fc
|
7
|
+
data.tar.gz: 1294404e59e81c7557c312c2af66892d5c78c80ceeae4f2d38550389fccea111e5f40b711135ed896d90e83036baf709ba7cdab86ffccd867d414f2af643d741
|
data/CHANGELOG.md
CHANGED
@@ -18,6 +18,23 @@ 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
|
+
|
30
|
+
## [2.19.0] - 2023-08-15
|
31
|
+
|
32
|
+
### Added
|
33
|
+
|
34
|
+
- Add brotli support (new option `compression` which supports both gzip/brotli to replace now deprecated `gzip_compression`)
|
35
|
+
(https://github.com/AssetSync/asset_sync/pull/435)
|
36
|
+
|
37
|
+
|
21
38
|
## [2.18.1] - 2023-08-02
|
22
39
|
|
23
40
|
### Changed
|
@@ -1086,7 +1103,9 @@ Changes:
|
|
1086
1103
|
* Merge branch 'sinatra'
|
1087
1104
|
|
1088
1105
|
|
1089
|
-
[Unreleased]: https://github.com/AssetSync/asset_sync/compare/v2.
|
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
|
1108
|
+
[2.19.0]: https://github.com/AssetSync/asset_sync/compare/v2.18.1...v2.19.0
|
1090
1109
|
[2.18.1]: https://github.com/AssetSync/asset_sync/compare/v2.18.0...v2.18.1
|
1091
1110
|
[2.18.0]: https://github.com/AssetSync/asset_sync/compare/v2.17.0...v2.18.0
|
1092
1111
|
[2.17.0]: https://github.com/AssetSync/asset_sync/compare/v2.16.0...v2.17.0
|
data/README.md
CHANGED
@@ -165,7 +165,7 @@ heroku config:add FOG_DIRECTORY=xxxx
|
|
165
165
|
heroku config:add FOG_PROVIDER=AWS
|
166
166
|
# and optionally:
|
167
167
|
heroku config:add FOG_REGION=eu-west-1
|
168
|
-
heroku config:add
|
168
|
+
heroku config:add ASSET_SYNC_COMPRESSION=gz
|
169
169
|
heroku config:add ASSET_SYNC_MANIFEST=true
|
170
170
|
heroku config:add ASSET_SYNC_EXISTING_REMOTE_FILES=keep
|
171
171
|
```
|
@@ -260,8 +260,8 @@ AssetSync.configure do |config|
|
|
260
260
|
# Overrides any existing value (even those set by AssetSync)
|
261
261
|
# config.fog_options = {}
|
262
262
|
#
|
263
|
-
# Automatically replace files with their equivalent gzip compressed version
|
264
|
-
# config.
|
263
|
+
# Automatically replace files with their equivalent gzip/brotli compressed version
|
264
|
+
# config.compression = 'gz'
|
265
265
|
#
|
266
266
|
# Use the Rails generated 'manifest.yml' file to produce the list of files to
|
267
267
|
# upload instead of searching the assets directory.
|
@@ -340,8 +340,8 @@ defaults: &defaults
|
|
340
340
|
# existing_remote_files: delete
|
341
341
|
# To ignore existing remote files and overwrite.
|
342
342
|
# existing_remote_files: ignore
|
343
|
-
# Automatically replace files with their equivalent gzip compressed version
|
344
|
-
#
|
343
|
+
# Automatically replace files with their equivalent gzip/brotli compressed version
|
344
|
+
# compression: "gz"
|
345
345
|
# Fail silently. Useful for environments such as Heroku
|
346
346
|
# fail_silently: true
|
347
347
|
# Always upload. Useful if you want to overwrite specific remote assets regardless of their existence
|
@@ -379,13 +379,14 @@ AssetSync.config.fog_provider == ENV['FOG_PROVIDER']
|
|
379
379
|
Simply **upcase** the ruby attribute names to get the equivalent environment variable to set. The only exception to that rule are the internal **AssetSync** config variables, they must be prepended with `ASSET_SYNC_*` e.g.
|
380
380
|
|
381
381
|
```ruby
|
382
|
-
AssetSync.config.
|
382
|
+
AssetSync.config.compression == ENV['ASSET_SYNC_COMPRESSION']
|
383
383
|
```
|
384
384
|
|
385
385
|
#### AssetSync (optional)
|
386
386
|
|
387
387
|
* **existing_remote_files**: (`'keep', 'delete', 'ignore'`) what to do with previously precompiled files. **default:** `'keep'`
|
388
|
-
* **gzip\_compression**: (
|
388
|
+
* **gzip\_compression**: (deprecated, can still be used but use `compression` when possible)
|
389
|
+
* **compression**: (`'gz', 'br'`) when enabled (non `nil` value set), will automatically replace files that have a gzip/brotli compressed equivalent with the compressed version. **default:** `nil`
|
389
390
|
* **manifest**: (`true, false`) when enabled, will use the `manifest.yml` generated by Rails to get the list of local files to upload. **experimental**. **default:** `'false'`
|
390
391
|
* **include_manifest**: (`true, false`) when enabled, will upload the `manifest.yml` generated by Rails. **default:** `'false'`
|
391
392
|
* **concurrent_uploads**: (`true, false`) when enabled, will upload the files in different Threads, this greatly improves the upload speed. **default:** `'false'`
|
@@ -540,12 +541,17 @@ end
|
|
540
541
|
```
|
541
542
|
|
542
543
|
|
543
|
-
## Automatic gzip compression
|
544
|
+
## Automatic gzip/brotli compression
|
544
545
|
|
545
|
-
With the `
|
546
|
+
With the `compression` option enabled, when uploading your assets. If a file has a gzip/brotli (only 1 of them, depending on the option value set) compressed equivalent we will replace that asset with the compressed version and sets the correct headers for S3 to serve it. For example, if you have a file **master.css** and it was compressed to **master.css.gz** we will upload the **.gz** file to S3 in place of the uncompressed file.
|
546
547
|
|
547
548
|
If the compressed file is actually larger than the uncompressed file we will ignore this rule and upload the standard uncompressed version.
|
548
549
|
|
550
|
+
Option `compression` supported values:
|
551
|
+
- `nil` => Disabled
|
552
|
+
- `'gz'` => Only consider gzip compressed one
|
553
|
+
- `'br'` => Only consider brotli compressed one
|
554
|
+
|
549
555
|
## Fail Silently
|
550
556
|
|
551
557
|
With the `fail_silently` option enabled, when running `rake assets:precompile` AssetSync will never throw an error due to missing configuration variables.
|
data/lib/asset_sync/config.rb
CHANGED
@@ -11,7 +11,7 @@ module AssetSync
|
|
11
11
|
|
12
12
|
# AssetSync
|
13
13
|
attr_accessor :existing_remote_files # What to do with your existing remote files? (keep or delete)
|
14
|
-
attr_accessor :
|
14
|
+
attr_accessor :compression
|
15
15
|
attr_accessor :manifest
|
16
16
|
attr_accessor :fail_silently
|
17
17
|
attr_accessor :log_silently
|
@@ -94,7 +94,7 @@ module AssetSync
|
|
94
94
|
self.fog_region = nil
|
95
95
|
self.fog_public = true
|
96
96
|
self.existing_remote_files = 'keep'
|
97
|
-
self.
|
97
|
+
self.compression = nil
|
98
98
|
self.manifest = false
|
99
99
|
self.fail_silently = false
|
100
100
|
self.log_silently = true
|
@@ -126,8 +126,12 @@ module AssetSync
|
|
126
126
|
end
|
127
127
|
end
|
128
128
|
|
129
|
-
def
|
130
|
-
|
129
|
+
def gzip_compression= bool
|
130
|
+
if bool
|
131
|
+
self.compression = 'gz'
|
132
|
+
else
|
133
|
+
self.compression = nil
|
134
|
+
end
|
131
135
|
end
|
132
136
|
|
133
137
|
def existing_remote_files?
|
@@ -246,7 +250,8 @@ module AssetSync
|
|
246
250
|
self.google_storage_access_key_id = yml["google_storage_access_key_id"] if yml.has_key?("google_storage_access_key_id")
|
247
251
|
self.google_json_key_string = yml["google_json_key_string"] if yml.has_key?("google_json_key_string")
|
248
252
|
self.existing_remote_files = yml["existing_remote_files"] if yml.has_key?("existing_remote_files")
|
249
|
-
self.
|
253
|
+
self.compression = 'gz' if yml.has_key?("gzip_compression")
|
254
|
+
self.compression = yml["compression"] if yml.has_key?("compression")
|
250
255
|
self.manifest = yml["manifest"] if yml.has_key?("manifest")
|
251
256
|
self.fail_silently = yml["fail_silently"] if yml.has_key?("fail_silently")
|
252
257
|
self.log_silently = yml["log_silently"] if yml.has_key?("log_silently")
|
data/lib/asset_sync/engine.rb
CHANGED
@@ -44,7 +44,8 @@ module AssetSync
|
|
44
44
|
config.enabled = (ENV['ASSET_SYNC_ENABLED'] == 'true') if ENV.has_key?('ASSET_SYNC_ENABLED')
|
45
45
|
|
46
46
|
config.existing_remote_files = ENV['ASSET_SYNC_EXISTING_REMOTE_FILES'] || "keep"
|
47
|
-
config.
|
47
|
+
config.compression = 'gz' if ENV.has_key?('ASSET_SYNC_GZIP_COMPRESSION') && ENV['ASSET_SYNC_GZIP_COMPRESSION'] == 'true'
|
48
|
+
config.compression = ENV['ASSET_SYNC_COMPRESSION'] if ENV.has_key?('ASSET_SYNC_COMPRESSION')
|
48
49
|
config.manifest = (ENV['ASSET_SYNC_MANIFEST'] == 'true') if ENV.has_key?('ASSET_SYNC_MANIFEST')
|
49
50
|
config.prefix = ENV['ASSET_SYNC_PREFIX'] if ENV.has_key?('ASSET_SYNC_PREFIX')
|
50
51
|
config.include_manifest = (ENV['ASSET_SYNC_INCLUDE_MANIFEST'] == 'true') if ENV.has_key?('ASSET_SYNC_INCLUDE_MANIFEST')
|
data/lib/asset_sync/storage.rb
CHANGED
@@ -7,6 +7,11 @@ module AssetSync
|
|
7
7
|
REGEXP_FINGERPRINTED_FILES = /\A(.*)\/(.+)-[^\.]+\.([^\.]+)\z/m
|
8
8
|
REGEXP_ASSETS_TO_CACHE_CONTROL = /-[0-9a-fA-F]{32,}$/
|
9
9
|
|
10
|
+
CONTENT_ENCODING = {
|
11
|
+
'gz' => 'gzip',
|
12
|
+
'br' => 'br',
|
13
|
+
}.freeze
|
14
|
+
|
10
15
|
class BucketNotFound < StandardError;
|
11
16
|
end
|
12
17
|
|
@@ -211,7 +216,7 @@ module AssetSync
|
|
211
216
|
one_year = 31557600
|
212
217
|
ext = File.extname(f)[1..-1]
|
213
218
|
mime = MultiMime.lookup(ext)
|
214
|
-
|
219
|
+
compressed_file_handle = nil
|
215
220
|
file_handle = File.open("#{path}/#{f}")
|
216
221
|
file = {
|
217
222
|
:key => f,
|
@@ -255,41 +260,45 @@ module AssetSync
|
|
255
260
|
end
|
256
261
|
|
257
262
|
|
258
|
-
gzipped = "#{path}/#{f}.gz"
|
259
263
|
ignore = false
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
#
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
264
|
+
if config.compression
|
265
|
+
compressed_name = "#{path}/#{f}.#{config.compression}"
|
266
|
+
|
267
|
+
# `File.extname` returns value with `.` prefix, `config.compression` contains value without `.`
|
268
|
+
if File.extname(f)[1..-1] == config.compression
|
269
|
+
# Don't bother uploading compressed assets if we are in compression mode
|
270
|
+
# as we will overwrite file.css with file.css.gz if it exists.
|
271
|
+
log "Ignoring: #{f}"
|
272
|
+
ignore = true
|
273
|
+
elsif File.exist?(compressed_name)
|
274
|
+
original_size = File.size("#{path}/#{f}")
|
275
|
+
compressed_size = File.size(compressed_name)
|
276
|
+
|
277
|
+
if compressed_size < original_size
|
278
|
+
percentage = ((compressed_size.to_f/original_size.to_f)*100).round(2)
|
279
|
+
compressed_file_handle = File.open(compressed_name)
|
280
|
+
file.merge!({
|
281
|
+
:key => f,
|
282
|
+
:body => compressed_file_handle,
|
283
|
+
:content_encoding => CONTENT_ENCODING[config.compression]
|
284
|
+
})
|
285
|
+
log "Uploading: #{compressed_name} in place of #{f} saving #{percentage}%"
|
286
|
+
else
|
287
|
+
percentage = ((original_size.to_f/compressed_size.to_f)*100).round(2)
|
288
|
+
log "Uploading: #{f} instead of #{compressed_name} (compression increases this file by #{percentage}%)"
|
289
|
+
end
|
282
290
|
end
|
283
291
|
else
|
284
|
-
|
285
|
-
|
292
|
+
compressed_encoding = CONTENT_ENCODING[File.extname(f).delete('.')]
|
293
|
+
if compressed_encoding
|
294
|
+
# set content encoding for compressed files this allows cloudfront to properly handle requests with Accept-Encoding
|
286
295
|
# http://docs.amazonwebservices.com/AmazonCloudFront/latest/DeveloperGuide/ServingCompressedFiles.html
|
287
296
|
uncompressed_filename = f[0..-4]
|
288
297
|
ext = File.extname(uncompressed_filename)[1..-1]
|
289
298
|
mime = MultiMime.lookup(ext)
|
290
299
|
file.merge!({
|
291
300
|
:content_type => mime,
|
292
|
-
:content_encoding =>
|
301
|
+
:content_encoding => compressed_encoding
|
293
302
|
})
|
294
303
|
end
|
295
304
|
log "Uploading: #{f}"
|
@@ -303,7 +312,7 @@ module AssetSync
|
|
303
312
|
|
304
313
|
bucket.files.create( file ) unless ignore
|
305
314
|
file_handle.close
|
306
|
-
|
315
|
+
compressed_file_handle.close if compressed_file_handle
|
307
316
|
end
|
308
317
|
|
309
318
|
def upload_files
|
data/lib/asset_sync/version.rb
CHANGED
@@ -59,8 +59,8 @@ describe AssetSync do
|
|
59
59
|
expect(AssetSync.config.existing_remote_files).to eq("keep")
|
60
60
|
end
|
61
61
|
|
62
|
-
it "should default
|
63
|
-
expect(AssetSync.config.
|
62
|
+
it "should default compression to nil" do
|
63
|
+
expect(AssetSync.config.compression).to be_nil
|
64
64
|
end
|
65
65
|
|
66
66
|
it "should default manifest to false" do
|
@@ -139,8 +139,8 @@ describe AssetSync do
|
|
139
139
|
expect(AssetSync.config.existing_remote_files).to eq("keep")
|
140
140
|
end
|
141
141
|
|
142
|
-
it "should default
|
143
|
-
expect(AssetSync.config.
|
142
|
+
it "should default compression to nil" do
|
143
|
+
expect(AssetSync.config.compression).to be_nil
|
144
144
|
end
|
145
145
|
|
146
146
|
it "should default manifest to false" do
|
@@ -230,8 +230,8 @@ describe AssetSync do
|
|
230
230
|
AssetSync.config.gzip_compression = true
|
231
231
|
end
|
232
232
|
|
233
|
-
it "config.
|
234
|
-
expect(AssetSync.config.
|
233
|
+
it "config.compression should be 'gz'" do
|
234
|
+
expect(AssetSync.config.compression).to eq("gz")
|
235
235
|
end
|
236
236
|
end
|
237
237
|
|
data/spec/unit/azure_rm_spec.rb
CHANGED
@@ -40,8 +40,8 @@ describe AssetSync do
|
|
40
40
|
expect(AssetSync.config.existing_remote_files).to eq("keep")
|
41
41
|
end
|
42
42
|
|
43
|
-
it "should default
|
44
|
-
expect(AssetSync.config.
|
43
|
+
it "should default compression to nil" do
|
44
|
+
expect(AssetSync.config.compression).to be_nil
|
45
45
|
end
|
46
46
|
|
47
47
|
it "should default manifest to false" do
|
@@ -71,8 +71,8 @@ describe AssetSync do
|
|
71
71
|
expect(AssetSync.config.existing_remote_files).to eq("keep")
|
72
72
|
end
|
73
73
|
|
74
|
-
it "should default
|
75
|
-
expect(AssetSync.config.
|
74
|
+
it "should default compression to nil" do
|
75
|
+
expect(AssetSync.config.compression).to be_nil
|
76
76
|
end
|
77
77
|
|
78
78
|
it "should default manifest to false" do
|
@@ -110,8 +110,8 @@ describe AssetSync do
|
|
110
110
|
AssetSync.config.gzip_compression = true
|
111
111
|
end
|
112
112
|
|
113
|
-
it "config.
|
114
|
-
expect(AssetSync.config.
|
113
|
+
it "config.compression should be 'gz'" do
|
114
|
+
expect(AssetSync.config.compression).to eq("gz")
|
115
115
|
end
|
116
116
|
end
|
117
117
|
|
data/spec/unit/backblaze_spec.rb
CHANGED
@@ -44,8 +44,8 @@ describe AssetSync do
|
|
44
44
|
expect(AssetSync.config.existing_remote_files).to eq("keep")
|
45
45
|
end
|
46
46
|
|
47
|
-
it "should default
|
48
|
-
expect(AssetSync.config.
|
47
|
+
it "should default compression to nil" do
|
48
|
+
expect(AssetSync.config.compression).to be_nil
|
49
49
|
end
|
50
50
|
|
51
51
|
it "should default manifest to false" do
|
@@ -79,8 +79,8 @@ describe AssetSync do
|
|
79
79
|
expect(AssetSync.config.existing_remote_files).to eq("keep")
|
80
80
|
end
|
81
81
|
|
82
|
-
it "should default
|
83
|
-
expect(AssetSync.config.
|
82
|
+
it "should default compression to nil" do
|
83
|
+
expect(AssetSync.config.compression).to be_nil
|
84
84
|
end
|
85
85
|
|
86
86
|
it "should default manifest to false" do
|
@@ -118,8 +118,8 @@ describe AssetSync do
|
|
118
118
|
AssetSync.config.gzip_compression = true
|
119
119
|
end
|
120
120
|
|
121
|
-
it "config.
|
122
|
-
expect(AssetSync.config.
|
121
|
+
it "config.compression should be 'gz'" do
|
122
|
+
expect(AssetSync.config.compression).to eq("gz")
|
123
123
|
end
|
124
124
|
end
|
125
125
|
|
data/spec/unit/google_spec.rb
CHANGED
@@ -30,8 +30,8 @@ describe AssetSync do
|
|
30
30
|
expect(AssetSync.config.existing_remote_files).to eq("keep")
|
31
31
|
end
|
32
32
|
|
33
|
-
it "should default
|
34
|
-
expect(AssetSync.config.
|
33
|
+
it "should default compression to nil" do
|
34
|
+
expect(AssetSync.config.compression).to be_nil
|
35
35
|
end
|
36
36
|
|
37
37
|
it "should default manifest to false" do
|
@@ -174,8 +174,8 @@ describe AssetSync do
|
|
174
174
|
expect(AssetSync.config.existing_remote_files).to eq("keep")
|
175
175
|
end
|
176
176
|
|
177
|
-
it "should default
|
178
|
-
expect(AssetSync.config.
|
177
|
+
it "should default compression to nil" do
|
178
|
+
expect(AssetSync.config.compression).to be_nil
|
179
179
|
end
|
180
180
|
|
181
181
|
it "should default manifest to false" do
|
@@ -229,8 +229,8 @@ describe AssetSync do
|
|
229
229
|
AssetSync.config.gzip_compression = true
|
230
230
|
end
|
231
231
|
|
232
|
-
it "config.
|
233
|
-
expect(AssetSync.config.
|
232
|
+
it "config.compression should be 'gz'" do
|
233
|
+
expect(AssetSync.config.compression).to eq("gz")
|
234
234
|
end
|
235
235
|
end
|
236
236
|
|
data/spec/unit/railsless_spec.rb
CHANGED
@@ -61,8 +61,8 @@ describe AssetSync do
|
|
61
61
|
expect(AssetSync.config.existing_remote_files).to eq("keep")
|
62
62
|
end
|
63
63
|
|
64
|
-
it "should default
|
65
|
-
expect(AssetSync.config.
|
64
|
+
it "should default compression to nil" do
|
65
|
+
expect(AssetSync.config.compression).to be_nil
|
66
66
|
end
|
67
67
|
|
68
68
|
it "should default manifest to false" do
|
data/spec/unit/storage_spec.rb
CHANGED
@@ -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.
|
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-
|
14
|
+
date: 2023-08-17 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: fog-core
|
@@ -288,7 +288,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
288
288
|
- !ruby/object:Gem::Version
|
289
289
|
version: '0'
|
290
290
|
requirements: []
|
291
|
-
rubygems_version: 3.4.
|
291
|
+
rubygems_version: 3.4.18
|
292
292
|
signing_key:
|
293
293
|
specification_version: 4
|
294
294
|
summary: Synchronises Assets in a Rails 3 application and Amazon S3/Cloudfront and
|