asset_sync 1.2.1 → 1.3.0
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/CHANGELOG.md +11 -1
- data/README.md +2 -2
- data/lib/asset_sync/config.rb +1 -5
- data/lib/asset_sync/storage.rb +21 -17
- data/lib/asset_sync/version.rb +1 -1
- data/lib/generators/asset_sync/templates/asset_sync.rb +4 -0
- data/spec/unit/asset_sync_spec.rb +2 -8
- data/spec/unit/storage_spec.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd1393284c71b816a4c7adf08939bc98a3db8c85
|
4
|
+
data.tar.gz: dcd639f471d42d101d06203acbd395532948db5c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 56449736185bb8f05f762d366124ea6024811cfc3b34754a4c8f1673a29bba9cc6d423d3a523fc2a16339fd43dad702f7d3fe8c8e6d59451da7add64817e43ae
|
7
|
+
data.tar.gz: 28495c0ede2eb463c35afc429aa8d6b527b03a7c4595835bfcf12da5c7dcc96631f524df73ff612c9551a0faeb729abea86f294cdd367b12c987a7f1708a167d
|
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
|
+
## [1.3.0] - 2016-11-30
|
22
|
+
|
23
|
+
### Changed
|
24
|
+
|
25
|
+
- Add regex support to always_upload (https://github.com/AssetSync/asset_sync/pull/333)
|
26
|
+
- Stop failing sliently when YAML file does not contain key for rails environment (https://github.com/AssetSync/asset_sync/pull/270)
|
27
|
+
- Stop failing sliently when YAML file cannot be parsed due to syntax error
|
28
|
+
|
29
|
+
|
21
30
|
## [1.2.1] - 2016-08-19
|
22
31
|
|
23
32
|
### Fixed
|
@@ -781,6 +790,7 @@ Changes:
|
|
781
790
|
* Merge branch 'sinatra'
|
782
791
|
|
783
792
|
|
784
|
-
[Unreleased]: https://github.com/AssetSync/asset_sync/compare/v1.
|
793
|
+
[Unreleased]: https://github.com/AssetSync/asset_sync/compare/v1.3.0...HEAD
|
794
|
+
[1.3.0]: https://github.com/AssetSync/asset_sync/compare/v1.2.1...v1.3.0
|
785
795
|
[1.2.1]: https://github.com/AssetSync/asset_sync/compare/v1.2.0...v1.2.1
|
786
796
|
[1.2.0]: https://github.com/AssetSync/asset_sync/compare/v1.1.0...v1.2.0
|
data/README.md
CHANGED
@@ -229,7 +229,7 @@ defaults: &defaults
|
|
229
229
|
# Always upload. Useful if you want to overwrite specific remote assets regardless of their existence
|
230
230
|
# eg: Static files in public often reference non-fingerprinted application.css
|
231
231
|
# note: You will still need to expire them from the CDN's edge cache locations
|
232
|
-
# always_upload: ['application.js', 'application.css']
|
232
|
+
# always_upload: ['application.js', 'application.css', !ruby/regexp '/application-/\d{32}\.css/']
|
233
233
|
# Ignored files. Useful if there are some files that are created dynamically on the server and you don't want to upload on deploy.
|
234
234
|
# ignored_files: ['ignore_me.js', !ruby/regexp '/ignore_some/\d{32}\.css/']
|
235
235
|
|
@@ -272,7 +272,7 @@ AssetSync.config.gzip_compression == ENV['ASSET_SYNC_GZIP_COMPRESSION']
|
|
272
272
|
|
273
273
|
#### Fog (Optional)
|
274
274
|
|
275
|
-
* **fog\_region**: the region your storage bucket is in e.g. *eu-west-1*
|
275
|
+
* **fog\_region**: the region your storage bucket is in e.g. *eu-west-1* (AWS), *ord* (Rackspace)
|
276
276
|
* **fog\_path\_style**: To use buckets with dot in names, check https://github.com/fog/fog/issues/2381#issuecomment-28088524
|
277
277
|
|
278
278
|
#### AWS
|
data/lib/asset_sync/config.rb
CHANGED
@@ -115,11 +115,7 @@ module AssetSync
|
|
115
115
|
end
|
116
116
|
|
117
117
|
def yml
|
118
|
-
|
119
|
-
@yml ||= YAML.load(ERB.new(IO.read(yml_path)).result)[Rails.env] rescue nil || {}
|
120
|
-
rescue Psych::SyntaxError
|
121
|
-
@yml = {}
|
122
|
-
end
|
118
|
+
@yml ||= YAML.load(ERB.new(IO.read(yml_path)).result)[Rails.env] || {}
|
123
119
|
end
|
124
120
|
|
125
121
|
def yml_path
|
data/lib/asset_sync/storage.rb
CHANGED
@@ -33,22 +33,7 @@ module AssetSync
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def ignored_files
|
36
|
-
|
37
|
-
Array(self.config.ignored_files).each do |ignore|
|
38
|
-
case ignore
|
39
|
-
when Regexp
|
40
|
-
files += self.local_files.select do |file|
|
41
|
-
file =~ ignore
|
42
|
-
end
|
43
|
-
when String
|
44
|
-
files += self.local_files.select do |file|
|
45
|
-
file.split('/').last == ignore
|
46
|
-
end
|
47
|
-
else
|
48
|
-
log "Error: please define ignored_files as string or regular expression. #{ignore} (#{ignore.class}) ignored."
|
49
|
-
end
|
50
|
-
end
|
51
|
-
files.uniq
|
36
|
+
expand_file_names(self.config.ignored_files)
|
52
37
|
end
|
53
38
|
|
54
39
|
def local_files
|
@@ -56,7 +41,7 @@ module AssetSync
|
|
56
41
|
end
|
57
42
|
|
58
43
|
def always_upload_files
|
59
|
-
self.config.always_upload
|
44
|
+
expand_file_names(self.config.always_upload)
|
60
45
|
end
|
61
46
|
|
62
47
|
def files_with_custom_headers
|
@@ -251,5 +236,24 @@ module AssetSync
|
|
251
236
|
end.compact
|
252
237
|
end
|
253
238
|
|
239
|
+
def expand_file_names(names)
|
240
|
+
files = []
|
241
|
+
Array(names).each do |name|
|
242
|
+
case name
|
243
|
+
when Regexp
|
244
|
+
files += self.local_files.select do |file|
|
245
|
+
file =~ name
|
246
|
+
end
|
247
|
+
when String
|
248
|
+
files += self.local_files.select do |file|
|
249
|
+
file.split('/').last == name
|
250
|
+
end
|
251
|
+
else
|
252
|
+
log "Error: please define file names as string or regular expression. #{name} (#{name.class}) ignored."
|
253
|
+
end
|
254
|
+
end
|
255
|
+
files.uniq
|
256
|
+
end
|
257
|
+
|
254
258
|
end
|
255
259
|
end
|
data/lib/asset_sync/version.rb
CHANGED
@@ -38,4 +38,8 @@ AssetSync.configure do |config|
|
|
38
38
|
#
|
39
39
|
# Fail silently. Useful for environments such as Heroku
|
40
40
|
# config.fail_silently = true
|
41
|
+
#
|
42
|
+
# Log silently. Default is `true`. But you can set it to false if more logging message are preferred.
|
43
|
+
# Logging messages are sent to `STDOUT` when `log_silently` is falsy
|
44
|
+
# config.log_silently = true
|
41
45
|
end
|
@@ -249,18 +249,12 @@ describe AssetSync do
|
|
249
249
|
end
|
250
250
|
|
251
251
|
describe 'with invalid yml' do
|
252
|
-
|
253
252
|
before(:each) do
|
254
253
|
set_rails_root('with_invalid_yml')
|
255
|
-
AssetSync.config = AssetSync::Config.new
|
256
254
|
end
|
257
255
|
|
258
|
-
it "
|
259
|
-
expect
|
260
|
-
end
|
261
|
-
|
262
|
-
it "should raise a config invalid error" do
|
263
|
-
expect{ AssetSync.sync }.to raise_error()
|
256
|
+
it "an error" do
|
257
|
+
expect{ AssetSync::Config.new }.to raise_error(Psych::SyntaxError)
|
264
258
|
end
|
265
259
|
end
|
266
260
|
end
|
data/spec/unit/storage_spec.rb
CHANGED
@@ -6,7 +6,7 @@ describe AssetSync::Storage do
|
|
6
6
|
describe '#upload_files' do
|
7
7
|
before(:each) do
|
8
8
|
@local_files = ["local_image2.jpg", "local_image1.jpg", "local_stylesheet1.css", "local_stylesheet2.css"]
|
9
|
-
@remote_files = ["local_image.jpg", "local_stylesheet1.css"]
|
9
|
+
@remote_files = ["local_image.jpg", "local_image3.svg", "local_image4.svg", "local_stylesheet1.css"]
|
10
10
|
@config = AssetSync::Config.new
|
11
11
|
end
|
12
12
|
|
@@ -23,7 +23,7 @@ describe AssetSync::Storage do
|
|
23
23
|
end
|
24
24
|
|
25
25
|
it 'should allow force overwriting of specific files' do
|
26
|
-
@config.always_upload = ['local_image.jpg']
|
26
|
+
@config.always_upload = ['local_image.jpg', /local_image\d\.svg/]
|
27
27
|
|
28
28
|
storage = AssetSync::Storage.new(@config)
|
29
29
|
allow(storage).to receive(:local_files).and_return(@local_files)
|
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: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Simon Hamilton
|
@@ -209,7 +209,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
209
209
|
version: '0'
|
210
210
|
requirements: []
|
211
211
|
rubyforge_project: asset_sync
|
212
|
-
rubygems_version: 2.6.
|
212
|
+
rubygems_version: 2.6.7
|
213
213
|
signing_key:
|
214
214
|
specification_version: 4
|
215
215
|
summary: Synchronises Assets in a Rails 3 application and Amazon S3/Cloudfront and
|