asset_sync 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Appraisals +9 -8
- data/CHANGELOG.md +18 -1
- data/Gemfile +1 -1
- data/README.md +18 -8
- data/Rakefile +7 -1
- data/asset_sync.gemspec +2 -3
- data/gemfiles/rails_4_1.gemfile +10 -0
- data/gemfiles/rails_4_2.gemfile +10 -0
- data/gemfiles/rails_5_0.gemfile +10 -0
- data/gemfiles/rails_5_1.gemfile +10 -0
- data/lib/asset_sync/config.rb +7 -0
- data/lib/asset_sync/multi_mime.rb +7 -5
- data/lib/asset_sync/storage.rb +6 -1
- data/lib/asset_sync/version.rb +1 -1
- data/lib/generators/asset_sync/templates/asset_sync.rb +5 -0
- data/lib/generators/asset_sync/templates/asset_sync.yml +2 -0
- data/spec/fixtures/aws_with_yml/config/asset_sync.yml +1 -0
- data/spec/unit/asset_sync_spec.rb +26 -0
- data/spec/unit/multi_mime_spec.rb +24 -0
- data/spec/unit/storage_spec.rb +32 -12
- metadata +11 -12
- data/gemfiles/rails_3.1.gemfile +0 -10
- data/gemfiles/rails_3.2.gemfile +0 -10
- data/gemfiles/rails_4.0.gemfile +0 -10
- data/gemfiles/rails_4.1.gemfile +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5ea1bceb8cfa4d10954bac53e96fe5bd2129b47c
|
4
|
+
data.tar.gz: d0396ac1587c86f5ab9a192bdd847e95f45e1cdf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: adb609d088e1e7a92105739ebcedd35cb2dd0dabd64bdca483e27ffe5a448fff99135d8cc6af5eae5a3ee0568147eb1927d317c9ef278eccf6dc7e23e33f1624
|
7
|
+
data.tar.gz: fa9dea180a9a7394e8a56f31dc646e138070b3d2af40ed17c858d1ef3e48c4ddecac381d17641397576477ee7d37cec26d2076e46963f2013837cb259ee0c6b0
|
data/Appraisals
CHANGED
@@ -1,15 +1,16 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
|
2
|
+
appraise "rails_4_1" do
|
3
|
+
gem "rails", "~> 4.1.0"
|
3
4
|
end
|
4
5
|
|
5
|
-
appraise "
|
6
|
-
gem "rails", "~>
|
6
|
+
appraise "rails_4_2" do
|
7
|
+
gem "rails", "~> 4.2.0"
|
7
8
|
end
|
8
9
|
|
9
|
-
appraise "
|
10
|
-
gem "rails", "~>
|
10
|
+
appraise "rails_5_0" do
|
11
|
+
gem "rails", "~> 5.0.0"
|
11
12
|
end
|
12
13
|
|
13
|
-
appraise "
|
14
|
-
gem "rails", "~>
|
14
|
+
appraise "rails_5_1" do
|
15
|
+
gem "rails", "~> 5.1.0"
|
15
16
|
end
|
data/CHANGELOG.md
CHANGED
@@ -18,6 +18,22 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
18
18
|
- Nothing
|
19
19
|
|
20
20
|
|
21
|
+
## [2.1.0] - 2016-05-19
|
22
|
+
|
23
|
+
### Added
|
24
|
+
|
25
|
+
- Allow customization of regexp of files on target bucket to be marked as 'Cacheable'
|
26
|
+
so that browsers when serving the content would cache them.
|
27
|
+
The value can be set by `cache_asset_regexps`
|
28
|
+
|
29
|
+
### Changed
|
30
|
+
|
31
|
+
- Only support mime-type >= 2.99,
|
32
|
+
which is released at the end of 2015
|
33
|
+
- Only support mactivemodel >= 4.1,
|
34
|
+
which is released in 2014
|
35
|
+
|
36
|
+
|
21
37
|
## [2.0.0] - 2016-12-21
|
22
38
|
|
23
39
|
### Changed
|
@@ -797,7 +813,8 @@ Changes:
|
|
797
813
|
* Merge branch 'sinatra'
|
798
814
|
|
799
815
|
|
800
|
-
[Unreleased]: https://github.com/AssetSync/asset_sync/compare/v2.
|
816
|
+
[Unreleased]: https://github.com/AssetSync/asset_sync/compare/v2.1.0...HEAD
|
817
|
+
[2.1.0]: https://github.com/AssetSync/asset_sync/compare/v2.0.0...v2.1.0
|
801
818
|
[2.0.0]: https://github.com/AssetSync/asset_sync/compare/v1.3.0...v2.0.0
|
802
819
|
[1.3.0]: https://github.com/AssetSync/asset_sync/compare/v1.2.1...v1.3.0
|
803
820
|
[1.2.1]: https://github.com/AssetSync/asset_sync/compare/v1.2.0...v1.2.1
|
data/Gemfile
CHANGED
@@ -3,4 +3,4 @@ gemspec
|
|
3
3
|
gem 'rcov', :platforms => :mri_18, :group => [:development, :test]
|
4
4
|
gem 'simplecov', :platforms => [:jruby, :mri_19, :ruby_19, :mri_20, :rbx], :group => [:development, :test], :require => false
|
5
5
|
gem 'jruby-openssl', :platform => :jruby
|
6
|
-
gem 'rails'
|
6
|
+
gem 'rails'
|
data/README.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
|
-
|
2
|
-
[![
|
1
|
+
|
2
|
+
[![Gem Version](https://img.shields.io/gem/v/asset_sync.svg?style=flat-square)](http://badge.fury.io/rb/asset_sync)
|
3
|
+
[![Build Status](https://img.shields.io/travis/rumblelabs/asset_sync.svg?style=flat-square)](http://travis-ci.org/rumblelabs/asset_sync)
|
4
|
+
[![Code Climate](https://img.shields.io/codeclimate/github/AssetSync/asset_sync/badges/gpa.svg?style=flat-square)](https://codeclimate.com/github/AssetSync/asset_sync)
|
5
|
+
|
6
|
+
(Build Status is broken as expected until Travis is fixed by AssetSync organization owner)
|
7
|
+
|
3
8
|
|
4
9
|
# Asset Sync
|
5
10
|
|
@@ -191,6 +196,12 @@ AssetSync.configure do |config|
|
|
191
196
|
# Log silently. Default is `true`. But you can set it to false if more logging message are preferred.
|
192
197
|
# Logging messages are sent to `STDOUT` when `log_silently` is falsy
|
193
198
|
# config.log_silently = true
|
199
|
+
#
|
200
|
+
# Allow custom assets to be cacheable. Note: The base filename will be matched
|
201
|
+
# If you have an asset with name `app.0b1a4cd3.js`, only `app.0b1a4cd3` will need to be matched
|
202
|
+
# only one of `cache_asset_regexp` or `cache_asset_regexps` is allowed.
|
203
|
+
# config.cache_asset_regexp = /\.[a-f0-9]{8}$/i
|
204
|
+
# config.cache_asset_regexps = [ /\.[a-f0-9]{8}$/i, /\.[a-f0-9]{20}$/i ]
|
194
205
|
end
|
195
206
|
```
|
196
207
|
|
@@ -226,6 +237,9 @@ defaults: &defaults
|
|
226
237
|
# always_upload: ['application.js', 'application.css', !ruby/regexp '/application-/\d{32}\.css/']
|
227
238
|
# Ignored files. Useful if there are some files that are created dynamically on the server and you don't want to upload on deploy.
|
228
239
|
# ignored_files: ['ignore_me.js', !ruby/regexp '/ignore_some/\d{32}\.css/']
|
240
|
+
# Allow custom assets to be cacheable. Note: The base filename will be matched
|
241
|
+
# If you have an asset with name "app.0b1a4cd3.js", only "app.0b1a4cd3" will need to be matched
|
242
|
+
# cache_asset_regexps: ['cache_me.js', !ruby/regexp '/cache_some\.\d{8}\.css/']
|
229
243
|
|
230
244
|
development:
|
231
245
|
<<: *defaults
|
@@ -258,6 +272,7 @@ AssetSync.config.gzip_compression == ENV['ASSET_SYNC_GZIP_COMPRESSION']
|
|
258
272
|
* **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'`
|
259
273
|
* **enabled**: (`true, false`) when false, will disable asset sync. **default:** `'true'` (enabled)
|
260
274
|
* **ignored\_files**: an array of files to ignore e.g. `['ignore_me.js', %r(ignore_some/\d{32}\.css)]` Useful if there are some files that are created dynamically on the server and you don't want to upload on deploy **default**: `[]`
|
275
|
+
* **cache\_asset\_regexps**: an array of files to add cache headers e.g. `['cache_me.js', %r(cache_some\.\d{8}\.css)]` Useful if there are some files that are added to sprockets assets list and need to be set as 'Cacheable' on uploaded server. Only rails compiled regexp is matched internally **default**: `[]`
|
261
276
|
|
262
277
|
|
263
278
|
#### Fog (Required)
|
@@ -329,12 +344,7 @@ IAM User Policy Example (replace "bucket_name" with your bucket):
|
|
329
344
|
"Resource": "arn:aws:s3:::*"
|
330
345
|
},
|
331
346
|
{
|
332
|
-
"Action": "s3
|
333
|
-
"Effect": "Allow",
|
334
|
-
"Resource": "arn:aws:s3:::bucket_name"
|
335
|
-
},
|
336
|
-
{
|
337
|
-
"Action": "s3:*",
|
347
|
+
"Action": "s3:PutObject*",
|
338
348
|
"Effect": "Allow",
|
339
349
|
"Resource": "arn:aws:s3:::bucket_name/*"
|
340
350
|
}
|
data/Rakefile
CHANGED
data/asset_sync.gemspec
CHANGED
@@ -6,7 +6,6 @@ require "asset_sync/version"
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "asset_sync"
|
8
8
|
s.version = AssetSync::VERSION
|
9
|
-
s.date = "2013-08-26"
|
10
9
|
s.platform = Gem::Platform::RUBY
|
11
10
|
s.authors = ["Simon Hamilton", "David Rice", "Phil McClure", "Toby Osbourn"]
|
12
11
|
s.email = ["shamilton@rumblelabs.com", "me@davidjrice.co.uk", "pmcclure@rumblelabs.com", "tosbourn@rumblelabs.com"]
|
@@ -20,8 +19,8 @@ Gem::Specification.new do |s|
|
|
20
19
|
|
21
20
|
s.add_dependency("fog-core")
|
22
21
|
s.add_dependency('unf')
|
23
|
-
s.add_dependency('activemodel')
|
24
|
-
s.add_dependency('mime-types')
|
22
|
+
s.add_dependency('activemodel', ">= 4.1.0")
|
23
|
+
s.add_dependency('mime-types', ">= 2.99")
|
25
24
|
|
26
25
|
s.add_development_dependency "rspec"
|
27
26
|
s.add_development_dependency "bundler"
|
@@ -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", "~> 4.1.0"
|
9
|
+
|
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", "~> 4.2.0"
|
9
|
+
|
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", "~> 5.0.0"
|
9
|
+
|
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", "~> 5.1.0"
|
9
|
+
|
10
|
+
gemspec path: "../"
|
data/lib/asset_sync/config.rb
CHANGED
@@ -23,6 +23,7 @@ module AssetSync
|
|
23
23
|
attr_accessor :run_on_precompile
|
24
24
|
attr_accessor :invalidate
|
25
25
|
attr_accessor :cdn_distribution_id
|
26
|
+
attr_accessor :cache_asset_regexps
|
26
27
|
|
27
28
|
# FOG configuration
|
28
29
|
attr_accessor :fog_provider # Currently Supported ['AWS', 'Rackspace']
|
@@ -65,6 +66,7 @@ module AssetSync
|
|
65
66
|
self.run_on_precompile = true
|
66
67
|
self.cdn_distribution_id = nil
|
67
68
|
self.invalidate = []
|
69
|
+
self.cache_asset_regexps = []
|
68
70
|
load_yml! if defined?(::Rails) && yml_exists?
|
69
71
|
end
|
70
72
|
|
@@ -114,6 +116,10 @@ module AssetSync
|
|
114
116
|
fog_provider =~ /google/i
|
115
117
|
end
|
116
118
|
|
119
|
+
def cache_asset_regexp=(cache_asset_regexp)
|
120
|
+
self.cache_asset_regexps = [cache_asset_regexp]
|
121
|
+
end
|
122
|
+
|
117
123
|
def yml_exists?
|
118
124
|
defined?(::Rails.root) ? File.exist?(self.yml_path) : false
|
119
125
|
end
|
@@ -160,6 +166,7 @@ module AssetSync
|
|
160
166
|
self.run_on_precompile = yml["run_on_precompile"] if yml.has_key?("run_on_precompile")
|
161
167
|
self.invalidate = yml["invalidate"] if yml.has_key?("invalidate")
|
162
168
|
self.cdn_distribution_id = yml['cdn_distribution_id'] if yml.has_key?("cdn_distribution_id")
|
169
|
+
self.cache_asset_regexps = yml['cache_asset_regexps'] if yml.has_key?("cache_asset_regexps")
|
163
170
|
|
164
171
|
# TODO deprecate the other old style config settings. FML.
|
165
172
|
self.aws_access_key_id = yml["aws_access_key"] if yml.has_key?("aws_access_key")
|
@@ -5,13 +5,15 @@ module AssetSync
|
|
5
5
|
|
6
6
|
def self.lookup(ext)
|
7
7
|
|
8
|
-
if defined?(
|
9
|
-
|
10
|
-
elsif defined?(
|
8
|
+
if defined?(::MIME::Types)
|
9
|
+
::MIME::Types.type_for(ext).first
|
10
|
+
elsif defined?(::Mime::Type)
|
11
|
+
::Mime::Type.lookup_by_extension(ext)
|
12
|
+
elsif defined?(::Rack::Mime)
|
11
13
|
ext_with_dot = ".#{ext}"
|
12
|
-
Rack::Mime.mime_type(ext_with_dot)
|
14
|
+
::Rack::Mime.mime_type(ext_with_dot)
|
13
15
|
else
|
14
|
-
|
16
|
+
raise "No library found for mime type lookup"
|
15
17
|
end
|
16
18
|
|
17
19
|
end
|
data/lib/asset_sync/storage.rb
CHANGED
@@ -1,8 +1,11 @@
|
|
1
1
|
require "fog/core"
|
2
2
|
|
3
|
+
require "asset_sync/multi_mime"
|
4
|
+
|
3
5
|
module AssetSync
|
4
6
|
class Storage
|
5
7
|
REGEXP_FINGERPRINTED_FILES = /^(.*)\/([^-]+)-[^\.]+\.([^\.]+)$/
|
8
|
+
REGEXP_ASSETS_TO_CACHE_CONTROL = /-[0-9a-fA-F]{32,}$/
|
6
9
|
|
7
10
|
class BucketNotFound < StandardError;
|
8
11
|
end
|
@@ -126,7 +129,9 @@ module AssetSync
|
|
126
129
|
|
127
130
|
uncompressed_filename = f.sub(/\.gz\z/, '')
|
128
131
|
basename = File.basename(uncompressed_filename, File.extname(uncompressed_filename))
|
129
|
-
|
132
|
+
|
133
|
+
assets_to_cache_control = Regexp.union([REGEXP_ASSETS_TO_CACHE_CONTROL] | config.cache_asset_regexps).source
|
134
|
+
if basename.match(Regexp.new(assets_to_cache_control)).present?
|
130
135
|
file.merge!({
|
131
136
|
:cache_control => "public, max-age=#{one_year}",
|
132
137
|
:expires => CGI.rfc1123_date(Time.now + one_year)
|
data/lib/asset_sync/version.rb
CHANGED
@@ -42,4 +42,9 @@ AssetSync.configure do |config|
|
|
42
42
|
# Log silently. Default is `true`. But you can set it to false if more logging message are preferred.
|
43
43
|
# Logging messages are sent to `STDOUT` when `log_silently` is falsy
|
44
44
|
# config.log_silently = true
|
45
|
+
#
|
46
|
+
# Allow custom assets to be cacheable. Note: The base filename will be matched
|
47
|
+
# If you have an asset with name `app.0ba4d3.js`, only `app.0ba4d3` will need to be matched
|
48
|
+
# config.cache_asset_regexps = [ /\.[a-f0-9]{8}$/i, /\.[a-f0-9]{20}$/i ]
|
49
|
+
# config.cache_asset_regexp = /\.[a-f0-9]{8}$/i
|
45
50
|
end
|
@@ -26,6 +26,8 @@ defaults: &defaults
|
|
26
26
|
# gzip_compression: true
|
27
27
|
# Fail silently. Useful for environments such as Heroku
|
28
28
|
# fail_silently: true
|
29
|
+
# Allow custom assets to be cacheable. Note: The base filename will be matched
|
30
|
+
# cache_asset_regexps: ['cache_me.js', !ruby/regexp '/cache_some\.\d{8}\.css/']
|
29
31
|
|
30
32
|
development:
|
31
33
|
<<: *defaults
|
@@ -90,6 +90,10 @@ describe AssetSync do
|
|
90
90
|
it "should default invalidate to empty array" do
|
91
91
|
expect(AssetSync.config.invalidate).to eq([])
|
92
92
|
end
|
93
|
+
|
94
|
+
it "should default asset_regexps to empty array" do
|
95
|
+
expect(AssetSync.config.cache_asset_regexps).to eq([])
|
96
|
+
end
|
93
97
|
end
|
94
98
|
|
95
99
|
describe 'from yml' do
|
@@ -138,6 +142,10 @@ describe AssetSync do
|
|
138
142
|
it "should default manifest to false" do
|
139
143
|
expect(AssetSync.config.manifest).to be_falsey
|
140
144
|
end
|
145
|
+
|
146
|
+
it "should default asset_regexps to match regexps" do
|
147
|
+
expect(AssetSync.config.cache_asset_regexps).to eq(['cache_me.js', /cache_some\.\d{8}\.css/])
|
148
|
+
end
|
141
149
|
end
|
142
150
|
|
143
151
|
describe 'from yml, exporting to a mobile hybrid development directory' do
|
@@ -247,6 +255,24 @@ describe AssetSync do
|
|
247
255
|
expect(AssetSync.config.manifest_path).to match(/public\/custom_assets\/manifest.yml/)
|
248
256
|
end
|
249
257
|
end
|
258
|
+
|
259
|
+
describe 'with cache_asset_regexps' do
|
260
|
+
before(:each) do
|
261
|
+
AssetSync.config = AssetSync::Config.new
|
262
|
+
end
|
263
|
+
|
264
|
+
it "config.cache_asset_regexp should set cache_asset_regexps" do
|
265
|
+
AssetSync.config.cache_asset_regexp = /\.[a-f0-9]{8}/i
|
266
|
+
expect(AssetSync.config.cache_asset_regexps.size).to eq(1)
|
267
|
+
expect(AssetSync.config.cache_asset_regexps[0]).to eq(/\.[a-f0-9]{8}/i)
|
268
|
+
end
|
269
|
+
|
270
|
+
it "set cache_asset_regexps" do
|
271
|
+
AssetSync.config.cache_asset_regexps = ["app.abc123.js", /\.[a-f0-9]{10}/i]
|
272
|
+
expect(AssetSync.config.cache_asset_regexps.size).to eq(2)
|
273
|
+
expect(AssetSync.config.cache_asset_regexps).to eq(["app.abc123.js", /\.[a-f0-9]{10}/i])
|
274
|
+
end
|
275
|
+
end
|
250
276
|
|
251
277
|
describe 'with invalid yml' do
|
252
278
|
before(:each) do
|
@@ -3,15 +3,39 @@ require File.dirname(__FILE__) + '/../spec_helper'
|
|
3
3
|
describe AssetSync::MultiMime do
|
4
4
|
|
5
5
|
before(:each) do
|
6
|
+
# Object#remove_const does not remove the loaded
|
7
|
+
# file from the $" variable
|
8
|
+
#
|
9
|
+
# So we need do both
|
10
|
+
#
|
11
|
+
# 1. Remove constant(s) to avoid warning messages
|
12
|
+
# 2. Remove loaded file(s)
|
6
13
|
Object.send(:remove_const, :Rails) if defined?(Rails)
|
7
14
|
Object.send(:remove_const, :Mime) if defined?(Mime)
|
8
15
|
Object.send(:remove_const, :Rack) if defined?(Rack)
|
16
|
+
Object.send(:remove_const, :MIME) if defined?(MIME)
|
17
|
+
|
18
|
+
$".grep(/mime\//).each do |file_path|
|
19
|
+
$".delete(file_path)
|
20
|
+
end
|
9
21
|
end
|
10
22
|
|
11
23
|
after(:each) do
|
24
|
+
# Object#remove_const does not remove the loaded
|
25
|
+
# file from the $" variable
|
26
|
+
#
|
27
|
+
# So we need do both
|
28
|
+
#
|
29
|
+
# 1. Remove constant(s) to avoid warning messages
|
30
|
+
# 2. Remove loaded file(s)
|
12
31
|
Object.send(:remove_const, :Rails) if defined?(Rails)
|
13
32
|
Object.send(:remove_const, :Mime) if defined?(Mime)
|
14
33
|
Object.send(:remove_const, :Rack) if defined?(Rack)
|
34
|
+
Object.send(:remove_const, :MIME) if defined?(MIME)
|
35
|
+
|
36
|
+
$".grep(/mime\//).each do |file_path|
|
37
|
+
$".delete(file_path)
|
38
|
+
end
|
15
39
|
end
|
16
40
|
|
17
41
|
after(:all) do
|
data/spec/unit/storage_spec.rb
CHANGED
@@ -98,7 +98,17 @@ describe AssetSync::Storage do
|
|
98
98
|
'dir1/dir2/file2-1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef.jpg',
|
99
99
|
'dir1/dir2/file2-1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef.jpg.gz'
|
100
100
|
]
|
101
|
+
local_files += [
|
102
|
+
'file3.png',
|
103
|
+
'file3.zabcde.png',
|
104
|
+
'file3.zab1cde2.png',
|
105
|
+
'file3.abcdef.jpg',
|
106
|
+
'file3.abc1def2.jpg',
|
107
|
+
'dir3/file3.abc123.jpg',
|
108
|
+
'dir3/file3.abcdf123.jpg'
|
109
|
+
]
|
101
110
|
remote_files = []
|
111
|
+
@config.cache_asset_regexps = [/\.[a-f0-9]{6}$/i, /\.[a-f0-9]{8}$/i]
|
102
112
|
storage = AssetSync::Storage.new(@config)
|
103
113
|
allow(storage).to receive(:local_files).and_return(local_files)
|
104
114
|
allow(storage).to receive(:get_remote_files).and_return(remote_files)
|
@@ -107,17 +117,24 @@ describe AssetSync::Storage do
|
|
107
117
|
|
108
118
|
def check_file(file)
|
109
119
|
case file[:key]
|
110
|
-
when 'file1.jpg'
|
111
|
-
|
120
|
+
when 'file1.jpg',
|
121
|
+
'dir1/dir2/file2.jpg',
|
122
|
+
'file3.png',
|
123
|
+
'file3.zabcde.png',
|
124
|
+
'file3.zab1cde2.png'
|
112
125
|
!expect(file).not_to include(:cache_control, :expires)
|
113
|
-
when 'file1-1234567890abcdef1234567890abcdef.jpg'
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
126
|
+
when 'file1-1234567890abcdef1234567890abcdef.jpg',
|
127
|
+
'file1-1234567890abcdef1234567890abcdef.jpg.gz',
|
128
|
+
'file1-1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef.jpg',
|
129
|
+
'file1-1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef.jpg.gz',
|
130
|
+
'dir1/dir2/file2-1234567890abcdef1234567890abcdef.jpg',
|
131
|
+
'dir1/dir2/file2-1234567890abcdef1234567890abcdef.jpg.gz',
|
132
|
+
'dir1/dir2/file2-1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef.jpg',
|
133
|
+
'dir1/dir2/file2-1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef.jpg.gz',
|
134
|
+
'file3.abcdef.jpg',
|
135
|
+
'file3.abc1def2.jpg',
|
136
|
+
'dir3/file3.abc123.jpg',
|
137
|
+
'dir3/file3.abcdf123.jpg'
|
121
138
|
expect(file).to include(:cache_control, :expires)
|
122
139
|
else
|
123
140
|
fail
|
@@ -160,9 +177,12 @@ describe AssetSync::Storage do
|
|
160
177
|
# 1. Remove constant(s) to avoid warning messages
|
161
178
|
# 2. Remove loaded file(s)
|
162
179
|
Object.send(:remove_const, :MIME) if defined?(MIME)
|
163
|
-
|
164
|
-
$".
|
180
|
+
|
181
|
+
$".grep(/mime\//).each do |file_path|
|
182
|
+
$".delete(file_path)
|
183
|
+
end
|
165
184
|
require 'mime/types'
|
185
|
+
|
166
186
|
@config = AssetSync::Config.new
|
167
187
|
end
|
168
188
|
|
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.1.0
|
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: 2017-05-19 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: fog-core
|
@@ -47,28 +47,28 @@ dependencies:
|
|
47
47
|
requirements:
|
48
48
|
- - ">="
|
49
49
|
- !ruby/object:Gem::Version
|
50
|
-
version:
|
50
|
+
version: 4.1.0
|
51
51
|
type: :runtime
|
52
52
|
prerelease: false
|
53
53
|
version_requirements: !ruby/object:Gem::Requirement
|
54
54
|
requirements:
|
55
55
|
- - ">="
|
56
56
|
- !ruby/object:Gem::Version
|
57
|
-
version:
|
57
|
+
version: 4.1.0
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: mime-types
|
60
60
|
requirement: !ruby/object:Gem::Requirement
|
61
61
|
requirements:
|
62
62
|
- - ">="
|
63
63
|
- !ruby/object:Gem::Version
|
64
|
-
version: '
|
64
|
+
version: '2.99'
|
65
65
|
type: :runtime
|
66
66
|
prerelease: false
|
67
67
|
version_requirements: !ruby/object:Gem::Requirement
|
68
68
|
requirements:
|
69
69
|
- - ">="
|
70
70
|
- !ruby/object:Gem::Version
|
71
|
-
version: '
|
71
|
+
version: '2.99'
|
72
72
|
- !ruby/object:Gem::Dependency
|
73
73
|
name: rspec
|
74
74
|
requirement: !ruby/object:Gem::Requirement
|
@@ -174,10 +174,10 @@ files:
|
|
174
174
|
- UPGRADING.md
|
175
175
|
- asset_sync.gemspec
|
176
176
|
- docs/heroku.md
|
177
|
-
- gemfiles/
|
178
|
-
- gemfiles/
|
179
|
-
- gemfiles/
|
180
|
-
- gemfiles/
|
177
|
+
- gemfiles/rails_4_1.gemfile
|
178
|
+
- gemfiles/rails_4_2.gemfile
|
179
|
+
- gemfiles/rails_5_0.gemfile
|
180
|
+
- gemfiles/rails_5_1.gemfile
|
181
181
|
- lib/asset_sync.rb
|
182
182
|
- lib/asset_sync/asset_sync.rb
|
183
183
|
- lib/asset_sync/config.rb
|
@@ -224,7 +224,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
224
224
|
version: '0'
|
225
225
|
requirements: []
|
226
226
|
rubyforge_project: asset_sync
|
227
|
-
rubygems_version: 2.
|
227
|
+
rubygems_version: 2.6.12
|
228
228
|
signing_key:
|
229
229
|
specification_version: 4
|
230
230
|
summary: Synchronises Assets in a Rails 3 application and Amazon S3/Cloudfront and
|
@@ -244,4 +244,3 @@ test_files:
|
|
244
244
|
- spec/unit/rackspace_spec.rb
|
245
245
|
- spec/unit/railsless_spec.rb
|
246
246
|
- spec/unit/storage_spec.rb
|
247
|
-
has_rdoc:
|
data/gemfiles/rails_3.1.gemfile
DELETED
@@ -1,10 +0,0 @@
|
|
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", "~> 3.1.0"
|
9
|
-
|
10
|
-
gemspec :path=>"../"
|
data/gemfiles/rails_3.2.gemfile
DELETED
@@ -1,10 +0,0 @@
|
|
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", "~> 3.2.0"
|
9
|
-
|
10
|
-
gemspec :path=>"../"
|
data/gemfiles/rails_4.0.gemfile
DELETED
@@ -1,10 +0,0 @@
|
|
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", "~> 4.0.0"
|
9
|
-
|
10
|
-
gemspec :path=>"../"
|
data/gemfiles/rails_4.1.gemfile
DELETED
@@ -1,10 +0,0 @@
|
|
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", "~> 4.1.0"
|
9
|
-
|
10
|
-
gemspec :path => "../"
|