asset_sync 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/CHANGELOG.md +41 -1
- data/Gemfile +1 -0
- data/README.md +55 -32
- data/asset_sync.gemspec +3 -0
- data/lib/asset_sync/asset_sync.rb +1 -1
- data/lib/asset_sync/config.rb +9 -6
- data/lib/asset_sync/engine.rb +3 -3
- data/lib/asset_sync/storage.rb +9 -6
- data/lib/asset_sync/version.rb +1 -1
- data/spec/dummy_app/Rakefile +1 -1
- data/spec/fixtures/aws_with_yml/config/asset_sync.yml +1 -0
- data/spec/unit/asset_sync_spec.rb +21 -0
- data/spec/unit/storage_spec.rb +20 -2
- metadata +18 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b2b9e6c9d6ade5d65f516ee31d195c7feafc932f
|
4
|
+
data.tar.gz: 0ad6e154aafdbed6b570b31c07b5b8b317a5b41e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b8ebe629fd1674e4d0834c472d5a376e100bc84230d06fa903a2034ab8b1fbfe7453986d6b495678465411bd52a853f8365053d892cf9432594236bacd1899cb
|
7
|
+
data.tar.gz: bacc8715e7117849d1f912882faff4519acb53431b4a3a4c858e6e9538f481027a7783e68a339b420210007dfc434af5dae7af44ff756836dfe15e51a4a7d8d5
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,41 @@
|
|
1
|
-
#
|
1
|
+
# Change Log
|
2
|
+
All notable changes to this project will be documented in this file.
|
3
|
+
This project adheres to [Semantic Versioning](http://semver.org/).
|
4
|
+
|
5
|
+
|
6
|
+
## [Unreleased]
|
7
|
+
|
8
|
+
### Added
|
9
|
+
|
10
|
+
- Nothing
|
11
|
+
|
12
|
+
### Changed
|
13
|
+
|
14
|
+
- Nothing
|
15
|
+
|
16
|
+
### Fixed
|
17
|
+
|
18
|
+
- Nothing
|
19
|
+
|
20
|
+
|
21
|
+
## [1.2.0] - 2016-08-17
|
22
|
+
|
23
|
+
### Added
|
24
|
+
|
25
|
+
- Support for `fog_path_style` config option (AWS only) (https://github.com/AssetSync/asset_sync/pull/302)
|
26
|
+
|
27
|
+
### Changed
|
28
|
+
|
29
|
+
- Set Expires and Cache-Control headers for .gz files (https://github.com/AssetSync/asset_sync/pull/329)
|
30
|
+
|
31
|
+
### Fixed
|
32
|
+
|
33
|
+
- Add missing runtime dependency declaration for `mime-types` to gemspec (https://github.com/AssetSync/asset_sync/pull/328)
|
34
|
+
- Update outdated error message for unknown AssetSync provider (https://github.com/AssetSync/asset_sync/pull/298)
|
35
|
+
- Allow hash digest in file name with over 32 chars (for sprockets 3+) (https://github.com/AssetSync/asset_sync/pull/315)
|
36
|
+
- Fix `config.log_silently?` (https://github.com/AssetSync/asset_sync/pull/324)
|
37
|
+
- Stop using deprecated Ruby API (https://github.com/AssetSync/asset_sync/pull/276)
|
38
|
+
|
2
39
|
|
3
40
|
## v1.1.0 / 2014-08-13
|
4
41
|
|
@@ -736,3 +773,6 @@ Changes:
|
|
736
773
|
* Improve documentation on ignored_files config option
|
737
774
|
* Merge branch 'sinatra'
|
738
775
|
|
776
|
+
|
777
|
+
[Unreleased]: https://github.com/AssetSync/asset_sync/compare/v1.2.0...HEAD
|
778
|
+
[1.2.0]: https://github.com/AssetSync/asset_sync/compare/v1.1.0...v1.2.0
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
[![Build Status](https://secure.travis-ci.org/rumblelabs/asset_sync.png)](http://travis-ci.org/rumblelabs/asset_sync)
|
2
|
-
[![Code Climate](https://codeclimate.com/
|
2
|
+
[![Code Climate](https://codeclimate.com/github/rumblelabs/asset_sync/badges/gpa.svg)](https://codeclimate.com/github/rumblelabs/asset_sync)
|
3
3
|
|
4
4
|
# Asset Sync
|
5
5
|
|
@@ -14,16 +14,6 @@ This was initially built and is intended to work on [Heroku](http://heroku.com)
|
|
14
14
|
|
15
15
|
If you are upgrading from a version of asset_sync **< 0.2.0** (i.e. 0.1.x). All of the references to config variables have changed to reference those used in **Fog**. Ensure to backup your `asset_sync.rb` or `asset_sync.yml` files and re-run the generator. You may also then need to update your ENV configuration variables (or you can change the ones that are referenced).
|
16
16
|
|
17
|
-
## Heroku Labs (BETA)
|
18
|
-
|
19
|
-
Previously there were [several issues](http://github.com/rumblelabs/asset_sync/blob/master/docs/heroku.md) with using asset_sync on Heroku as described in our [Heroku dev center article](http://devcenter.heroku.com/articles/cdn-asset-host-rails31).
|
20
|
-
|
21
|
-
Now to get everything working smoothly with using **ENV** variables to configure `asset_sync` we just need to enable the [user-env-compile](http://devcenter.heroku.com/articles/labs-user-env-compile) functionality. In short:
|
22
|
-
|
23
|
-
heroku labs:enable user-env-compile -a myapp
|
24
|
-
|
25
|
-
Hopefully this will make it's way into the platform as standard.
|
26
|
-
|
27
17
|
## Installation
|
28
18
|
|
29
19
|
Add the gem to your Gemfile
|
@@ -32,25 +22,6 @@ Add the gem to your Gemfile
|
|
32
22
|
gem 'asset_sync'
|
33
23
|
```
|
34
24
|
|
35
|
-
If you want, you can put it within your **:assets** group in your Gemfile.
|
36
|
-
|
37
|
-
``` ruby
|
38
|
-
group :assets do
|
39
|
-
gem 'sass-rails', '~> 3.2.3'
|
40
|
-
gem 'coffee-rails', '~> 3.2.1'
|
41
|
-
gem 'uglifier', '>= 1.0.3'
|
42
|
-
gem 'asset_sync'
|
43
|
-
end
|
44
|
-
```
|
45
|
-
|
46
|
-
This is good practice when pre-compiling your assets as it will reduce load time and server memory in production. The only caveat being, you may not be able to use a custom initializer, without perhaps wrapping it with.
|
47
|
-
|
48
|
-
``` ruby
|
49
|
-
if defined?(AssetSync)
|
50
|
-
...
|
51
|
-
end
|
52
|
-
```
|
53
|
-
|
54
25
|
### Optimized Fog loading
|
55
26
|
|
56
27
|
Since AssetSync doesn't know which parts of Fog you intend to use, it will just load the entire library.
|
@@ -59,7 +30,7 @@ you need to load those parts of Fog yourself *before* loading AssetSync:
|
|
59
30
|
|
60
31
|
In your Gemfile:
|
61
32
|
```ruby
|
62
|
-
gem "fog", "~>1.20", require "fog/aws/storage"
|
33
|
+
gem "fog", "~>1.20", require: "fog/aws/storage"
|
63
34
|
gem "asset_sync"
|
64
35
|
```
|
65
36
|
|
@@ -141,7 +112,8 @@ If you need more control over configuration you will want to use a **custom rail
|
|
141
112
|
|
142
113
|
Configuration using a **YAML** file (a common strategy for Capistrano deployments) is also supported.
|
143
114
|
|
144
|
-
The recommend way to configure **asset_sync** is by using **environment variables** however it's up to you, it will work fine if you hard code them too. The main reason is
|
115
|
+
The recommend way to configure **asset_sync** is by using **environment variables** however it's up to you, it will work fine if you hard code them too. The main reason why using environment variables is recommended is so your access keys are not checked into version control.
|
116
|
+
|
145
117
|
|
146
118
|
### Built-in Initializer (Environment Variables)
|
147
119
|
|
@@ -297,6 +269,7 @@ AssetSync.config.gzip_compression == ENV['ASSET_SYNC_GZIP_COMPRESSION']
|
|
297
269
|
#### Fog (Optional)
|
298
270
|
|
299
271
|
* **fog\_region**: the region your storage bucket is in e.g. *eu-west-1*
|
272
|
+
* **fog\_path\_style**: To use buckets with dot in names, check https://github.com/fog/fog/issues/2381#issuecomment-28088524
|
300
273
|
|
301
274
|
#### AWS
|
302
275
|
|
@@ -341,6 +314,44 @@ production:
|
|
341
314
|
fog_region: 'eu-west-1'
|
342
315
|
```
|
343
316
|
|
317
|
+
### Amazon (AWS) IAM Users
|
318
|
+
|
319
|
+
Amazon has switched to the more secure IAM User security policy model. When generating a user & policy for asset_sync you will need to ensure the policy has the following permissions.
|
320
|
+
You __must__ give the user permission to **s3:ListAllMyBuckets** as well as give permission to both the bucket, as well as the bucket's contents (/*). If not given all these permissions you'll see the error ```Expected(200) <=> Actual(403 Forbidden) ```
|
321
|
+
|
322
|
+
IAM User Policy Example (replace "bucket_name" with your bucket):
|
323
|
+
``` json
|
324
|
+
{
|
325
|
+
"Statement": [
|
326
|
+
{
|
327
|
+
"Action": [
|
328
|
+
"s3:ListAllMyBuckets"
|
329
|
+
],
|
330
|
+
"Effect": "Allow",
|
331
|
+
"Resource": "arn:aws:s3:::*"
|
332
|
+
},
|
333
|
+
{
|
334
|
+
"Action": "s3:*",
|
335
|
+
"Effect": "Allow",
|
336
|
+
"Resource": "arn:aws:s3:::bucket_name"
|
337
|
+
},
|
338
|
+
{
|
339
|
+
"Action": "s3:*",
|
340
|
+
"Effect": "Allow",
|
341
|
+
"Resource": "arn:aws:s3:::bucket_name/*"
|
342
|
+
}
|
343
|
+
]
|
344
|
+
}
|
345
|
+
```
|
346
|
+
|
347
|
+
If you want to use IAM roles you must set ```config.aws_iam_roles = true``` in your initializers.
|
348
|
+
```
|
349
|
+
AssetSync.configure do |config|
|
350
|
+
# ...
|
351
|
+
config.aws_iam_roles = true
|
352
|
+
end
|
353
|
+
```
|
354
|
+
|
344
355
|
|
345
356
|
## Automatic gzip compression
|
346
357
|
|
@@ -428,6 +439,18 @@ namespace :assets do
|
|
428
439
|
end
|
429
440
|
```
|
430
441
|
|
442
|
+
## Running the specs
|
443
|
+
|
444
|
+
Make sure you have a .env file with these details:-
|
445
|
+
|
446
|
+
AWS_ACCESS_KEY_ID=<yourkeyid>
|
447
|
+
AWS_SECRET_ACCESS_KEY=<yoursecretkey>
|
448
|
+
FOG_DIRECTORY=<yourbucket>
|
449
|
+
|
450
|
+
Make sure the bucket has read/write permissions. Then to run the tests:-
|
451
|
+
|
452
|
+
foreman run rake
|
453
|
+
|
431
454
|
## Todo
|
432
455
|
|
433
456
|
1. Add some before and after filters for deleting and uploading
|
data/asset_sync.gemspec
CHANGED
@@ -14,11 +14,14 @@ Gem::Specification.new do |s|
|
|
14
14
|
s.summary = %q{Synchronises Assets in a Rails 3 application and Amazon S3/Cloudfront and Rackspace Cloudfiles}
|
15
15
|
s.description = %q{After you run assets:precompile your compiled assets will be synchronised with your S3 bucket.}
|
16
16
|
|
17
|
+
s.license = 'MIT'
|
18
|
+
|
17
19
|
s.rubyforge_project = "asset_sync"
|
18
20
|
|
19
21
|
s.add_dependency('fog', ">= 1.8.0")
|
20
22
|
s.add_dependency('unf')
|
21
23
|
s.add_dependency('activemodel')
|
24
|
+
s.add_dependency('mime-types')
|
22
25
|
|
23
26
|
s.add_development_dependency "rspec"
|
24
27
|
s.add_development_dependency "bundler"
|
data/lib/asset_sync/config.rb
CHANGED
@@ -24,6 +24,7 @@ module AssetSync
|
|
24
24
|
attr_accessor :fog_provider # Currently Supported ['AWS', 'Rackspace']
|
25
25
|
attr_accessor :fog_directory # e.g. 'the-bucket-name'
|
26
26
|
attr_accessor :fog_region # e.g. 'eu-west-1'
|
27
|
+
attr_accessor :fog_path_style # e.g true
|
27
28
|
|
28
29
|
# Amazon AWS
|
29
30
|
attr_accessor :aws_access_key_id, :aws_secret_access_key, :aws_reduced_redundancy, :aws_iam_roles
|
@@ -78,7 +79,7 @@ module AssetSync
|
|
78
79
|
end
|
79
80
|
|
80
81
|
def aws?
|
81
|
-
fog_provider
|
82
|
+
fog_provider =~ /aws/i
|
82
83
|
end
|
83
84
|
|
84
85
|
def aws_rrs?
|
@@ -94,7 +95,7 @@ module AssetSync
|
|
94
95
|
end
|
95
96
|
|
96
97
|
def log_silently?
|
97
|
-
ENV['RAILS_GROUPS'] == 'assets' || self.log_silently
|
98
|
+
ENV['RAILS_GROUPS'] == 'assets' || !!self.log_silently
|
98
99
|
end
|
99
100
|
|
100
101
|
def enabled?
|
@@ -102,15 +103,15 @@ module AssetSync
|
|
102
103
|
end
|
103
104
|
|
104
105
|
def rackspace?
|
105
|
-
fog_provider
|
106
|
+
fog_provider =~ /rackspace/i
|
106
107
|
end
|
107
108
|
|
108
109
|
def google?
|
109
|
-
fog_provider
|
110
|
+
fog_provider =~ /google/i
|
110
111
|
end
|
111
112
|
|
112
113
|
def yml_exists?
|
113
|
-
defined?(Rails.root) ? File.
|
114
|
+
defined?(Rails.root) ? File.exist?(self.yml_path) : false
|
114
115
|
end
|
115
116
|
|
116
117
|
def yml
|
@@ -139,6 +140,7 @@ module AssetSync
|
|
139
140
|
self.fog_provider = yml["fog_provider"]
|
140
141
|
self.fog_directory = yml["fog_directory"]
|
141
142
|
self.fog_region = yml["fog_region"]
|
143
|
+
self.fog_path_style = yml["fog_path_style"]
|
142
144
|
self.aws_access_key_id = yml["aws_access_key_id"]
|
143
145
|
self.aws_secret_access_key = yml["aws_secret_access_key"]
|
144
146
|
self.aws_reduced_redundancy = yml["aws_reduced_redundancy"]
|
@@ -203,10 +205,11 @@ module AssetSync
|
|
203
205
|
:google_storage_access_key_id => google_storage_access_key_id
|
204
206
|
})
|
205
207
|
else
|
206
|
-
raise ArgumentError, "AssetSync Unknown provider: #{fog_provider} only AWS and
|
208
|
+
raise ArgumentError, "AssetSync Unknown provider: #{fog_provider} only AWS, Rackspace and Google are supported currently."
|
207
209
|
end
|
208
210
|
|
209
211
|
options.merge!({:region => fog_region}) if fog_region && !rackspace?
|
212
|
+
options.merge!({:path_style => fog_path_style}) if fog_path_style && aws?
|
210
213
|
return options
|
211
214
|
end
|
212
215
|
|
data/lib/asset_sync/engine.rb
CHANGED
@@ -7,10 +7,10 @@ module AssetSync
|
|
7
7
|
app_initializer = Rails.root.join('config', 'initializers', 'asset_sync.rb').to_s
|
8
8
|
app_yaml = Rails.root.join('config', 'asset_sync.yml').to_s
|
9
9
|
|
10
|
-
if File.
|
10
|
+
if File.exist?( app_initializer )
|
11
11
|
AssetSync.log "AssetSync: using #{app_initializer}"
|
12
12
|
load app_initializer
|
13
|
-
elsif !File.
|
13
|
+
elsif !File.exist?( app_initializer ) && !File.exist?( app_yaml )
|
14
14
|
AssetSync.log "AssetSync: using default configuration from built-in initializer"
|
15
15
|
AssetSync.configure do |config|
|
16
16
|
config.fog_provider = ENV['FOG_PROVIDER'] if ENV.has_key?('FOG_PROVIDER')
|
@@ -44,7 +44,7 @@ module AssetSync
|
|
44
44
|
|
45
45
|
end
|
46
46
|
|
47
|
-
if File.
|
47
|
+
if File.exist?( app_yaml )
|
48
48
|
AssetSync.log "AssetSync: YAML file found #{app_yaml} settings will be merged into the configuration"
|
49
49
|
end
|
50
50
|
end
|
data/lib/asset_sync/storage.rb
CHANGED
@@ -73,7 +73,7 @@ module AssetSync
|
|
73
73
|
log "Using: Rails 4.0 manifest access"
|
74
74
|
manifest = Sprockets::Manifest.new(ActionView::Base.assets_manifest.environment, ActionView::Base.assets_manifest.dir)
|
75
75
|
return manifest.assets.values.map { |f| File.join(self.config.assets_prefix, f) }
|
76
|
-
elsif File.
|
76
|
+
elsif File.exist?(self.config.manifest_path)
|
77
77
|
log "Using: Manifest #{self.config.manifest_path}"
|
78
78
|
yml = YAML.load(IO.read(self.config.manifest_path))
|
79
79
|
|
@@ -91,7 +91,8 @@ module AssetSync
|
|
91
91
|
end
|
92
92
|
log "Using: Directory Search of #{path}/#{self.config.assets_prefix}"
|
93
93
|
Dir.chdir(path) do
|
94
|
-
|
94
|
+
to_load = self.config.assets_prefix.present? ? "#{self.config.assets_prefix}/**/**" : '**/**'
|
95
|
+
Dir[to_load]
|
95
96
|
end
|
96
97
|
end
|
97
98
|
|
@@ -136,7 +137,9 @@ module AssetSync
|
|
136
137
|
:content_type => mime
|
137
138
|
}
|
138
139
|
|
139
|
-
|
140
|
+
uncompressed_filename = f.sub(/\.gz\z/, '')
|
141
|
+
basename = File.basename(uncompressed_filename, File.extname(uncompressed_filename))
|
142
|
+
if /-[0-9a-fA-F]{32,}$/.match(basename)
|
140
143
|
file.merge!({
|
141
144
|
:cache_control => "public, max-age=#{one_year}",
|
142
145
|
:expires => CGI.rfc1123_date(Time.now + one_year)
|
@@ -150,8 +153,8 @@ module AssetSync
|
|
150
153
|
log "Overwriting #{f} with custom headers #{files_with_custom_headers[f].to_s}"
|
151
154
|
elsif key = self.config.custom_headers.keys.detect {|k| f.match(Regexp.new(k))}
|
152
155
|
headers = {}
|
153
|
-
self.config.custom_headers[key].each do |
|
154
|
-
headers[
|
156
|
+
self.config.custom_headers[key].each do |k, value|
|
157
|
+
headers[k.to_sym] = value
|
155
158
|
end
|
156
159
|
file.merge! headers
|
157
160
|
log "Overwriting matching file #{f} with custom headers #{headers.to_s}"
|
@@ -166,7 +169,7 @@ module AssetSync
|
|
166
169
|
# as we will overwrite file.css with file.css.gz if it exists.
|
167
170
|
log "Ignoring: #{f}"
|
168
171
|
ignore = true
|
169
|
-
elsif config.gzip? && File.
|
172
|
+
elsif config.gzip? && File.exist?(gzipped)
|
170
173
|
original_size = File.size("#{path}/#{f}")
|
171
174
|
gzipped_size = File.size(gzipped)
|
172
175
|
|
data/lib/asset_sync/version.rb
CHANGED
data/spec/dummy_app/Rakefile
CHANGED
@@ -3,7 +3,7 @@ require 'rubygems'
|
|
3
3
|
ENV['RAILS_ROOT'] = File.dirname(__FILE__)
|
4
4
|
# Set up gems listed in the Gemfile.
|
5
5
|
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
|
6
|
-
require 'bundler/setup' if File.
|
6
|
+
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
|
7
7
|
# require 'rails/all'
|
8
8
|
require "action_controller/railtie"
|
9
9
|
require "sprockets/railtie"
|
@@ -12,6 +12,7 @@ describe AssetSync do
|
|
12
12
|
config.aws_secret_access_key = 'bbbb'
|
13
13
|
config.fog_directory = 'mybucket'
|
14
14
|
config.fog_region = 'eu-west-1'
|
15
|
+
config.fog_path_style = 'true'
|
15
16
|
config.existing_remote_files = "keep"
|
16
17
|
end
|
17
18
|
end
|
@@ -50,6 +51,10 @@ describe AssetSync do
|
|
50
51
|
expect(AssetSync.config.fog_region).to eq("eu-west-1")
|
51
52
|
end
|
52
53
|
|
54
|
+
it "should configure path_style" do
|
55
|
+
expect(AssetSync.config.fog_path_style).to be_truthy
|
56
|
+
end
|
57
|
+
|
53
58
|
it "should configure existing_remote_files" do
|
54
59
|
expect(AssetSync.config.existing_remote_files).to eq("keep")
|
55
60
|
end
|
@@ -65,6 +70,18 @@ describe AssetSync do
|
|
65
70
|
it "should default log_silently to true" do
|
66
71
|
expect(AssetSync.config.log_silently).to be_truthy
|
67
72
|
end
|
73
|
+
|
74
|
+
it "log_silently? should reflect the configuration" do
|
75
|
+
AssetSync.config.log_silently = false
|
76
|
+
expect(AssetSync.config.log_silently?).to eq(false)
|
77
|
+
end
|
78
|
+
|
79
|
+
it "log_silently? should always be true if ENV['RAILS_GROUPS'] == 'assets'" do
|
80
|
+
AssetSync.config.log_silently = false
|
81
|
+
# make sure ENV is actually being checked ...
|
82
|
+
expect(ENV).to receive(:[]).with('RAILS_GROUPS').and_return('assets')
|
83
|
+
expect(AssetSync.config.log_silently?).to eq(true)
|
84
|
+
end
|
68
85
|
|
69
86
|
it "should default cdn_distribution_id to nil" do
|
70
87
|
expect(AssetSync.config.cdn_distribution_id).to be_nil
|
@@ -106,6 +123,10 @@ describe AssetSync do
|
|
106
123
|
expect(AssetSync.config.fog_region).to eq("eu-west-1")
|
107
124
|
end
|
108
125
|
|
126
|
+
it "should configure path_style" do
|
127
|
+
expect(AssetSync.config.fog_path_style).to be_truthy
|
128
|
+
end
|
129
|
+
|
109
130
|
it "should configure existing_remote_files" do
|
110
131
|
expect(AssetSync.config.existing_remote_files).to eq("keep")
|
111
132
|
end
|
data/spec/unit/storage_spec.rb
CHANGED
@@ -84,8 +84,20 @@ describe AssetSync::Storage do
|
|
84
84
|
|
85
85
|
|
86
86
|
it 'should correctly set expire date' do
|
87
|
-
local_files = [
|
88
|
-
|
87
|
+
local_files = [
|
88
|
+
'file1.jpg',
|
89
|
+
'file1-1234567890abcdef1234567890abcdef.jpg',
|
90
|
+
'file1-1234567890abcdef1234567890abcdef.jpg.gz',
|
91
|
+
'file1-1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef.jpg',
|
92
|
+
'file1-1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef.jpg.gz'
|
93
|
+
]
|
94
|
+
local_files += [
|
95
|
+
'dir1/dir2/file2.jpg',
|
96
|
+
'dir1/dir2/file2-1234567890abcdef1234567890abcdef.jpg',
|
97
|
+
'dir1/dir2/file2-1234567890abcdef1234567890abcdef.jpg.gz',
|
98
|
+
'dir1/dir2/file2-1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef.jpg',
|
99
|
+
'dir1/dir2/file2-1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef.jpg.gz'
|
100
|
+
]
|
89
101
|
remote_files = []
|
90
102
|
storage = AssetSync::Storage.new(@config)
|
91
103
|
allow(storage).to receive(:local_files).and_return(local_files)
|
@@ -99,7 +111,13 @@ describe AssetSync::Storage do
|
|
99
111
|
when 'dir1/dir2/file2.jpg'
|
100
112
|
!expect(file).not_to include(:cache_control, :expires)
|
101
113
|
when 'file1-1234567890abcdef1234567890abcdef.jpg'
|
114
|
+
when 'file1-1234567890abcdef1234567890abcdef.jpg.gz'
|
115
|
+
when 'file1-1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef.jpg'
|
116
|
+
when 'file1-1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef.jpg.gz'
|
102
117
|
when 'dir1/dir2/file2-1234567890abcdef1234567890abcdef.jpg'
|
118
|
+
when 'dir1/dir2/file2-1234567890abcdef1234567890abcdef.jpg.gz'
|
119
|
+
when 'dir1/dir2/file2-1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef.jpg'
|
120
|
+
when 'dir1/dir2/file2-1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef.jpg.gz'
|
103
121
|
expect(file).to include(:cache_control, :expires)
|
104
122
|
else
|
105
123
|
fail
|
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.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Simon Hamilton
|
@@ -55,6 +55,20 @@ dependencies:
|
|
55
55
|
- - ">="
|
56
56
|
- !ruby/object:Gem::Version
|
57
57
|
version: '0'
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: mime-types
|
60
|
+
requirement: !ruby/object:Gem::Requirement
|
61
|
+
requirements:
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '0'
|
65
|
+
type: :runtime
|
66
|
+
prerelease: false
|
67
|
+
version_requirements: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '0'
|
58
72
|
- !ruby/object:Gem::Dependency
|
59
73
|
name: rspec
|
60
74
|
requirement: !ruby/object:Gem::Requirement
|
@@ -176,7 +190,8 @@ files:
|
|
176
190
|
- spec/unit/railsless_spec.rb
|
177
191
|
- spec/unit/storage_spec.rb
|
178
192
|
homepage: https://github.com/rumblelabs/asset_sync
|
179
|
-
licenses:
|
193
|
+
licenses:
|
194
|
+
- MIT
|
180
195
|
metadata: {}
|
181
196
|
post_install_message:
|
182
197
|
rdoc_options: []
|
@@ -194,7 +209,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
194
209
|
version: '0'
|
195
210
|
requirements: []
|
196
211
|
rubyforge_project: asset_sync
|
197
|
-
rubygems_version: 2.
|
212
|
+
rubygems_version: 2.6.6
|
198
213
|
signing_key:
|
199
214
|
specification_version: 4
|
200
215
|
summary: Synchronises Assets in a Rails 3 application and Amazon S3/Cloudfront and
|