asset_sync 1.3.0 → 2.0.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 +9 -1
- data/README.md +6 -12
- data/UPGRADING.md +25 -0
- data/asset_sync.gemspec +3 -1
- data/lib/asset_sync.rb +0 -3
- data/lib/asset_sync/config.rb +12 -8
- data/lib/asset_sync/storage.rb +3 -1
- data/lib/asset_sync/version.rb +1 -1
- data/spec/integration/aws_integration_spec.rb +5 -4
- data/spec/unit/asset_sync_spec.rb +5 -5
- data/spec/unit/google_spec.rb +2 -2
- data/spec/unit/storage_spec.rb +7 -6
- metadata +20 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5201ed972f382f2871c2a1ac0b9a6815c09d405b
|
4
|
+
data.tar.gz: 623dd4f586d82eb6603b2b536a322679d16015d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94a34b39843e11ea819de2df23a48b71ee985edd709c77eb28a085e9c0be5d8c4307e4331ca77b2fa03cef8d3ba7136c700498719f06419383cc287c67f774b6
|
7
|
+
data.tar.gz: 667284efc400775f931a7164d251f087b6b61fdd8dbe2284eb8b50059ce3dd2593cf02c01ef714bd0bb4fb57f05203b25158476cfe49e00b163f6d36844bd459
|
data/CHANGELOG.md
CHANGED
@@ -18,6 +18,13 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
18
18
|
- Nothing
|
19
19
|
|
20
20
|
|
21
|
+
## [2.0.0] - 2016-12-21
|
22
|
+
|
23
|
+
### Changed
|
24
|
+
|
25
|
+
- [BREAKING] require “fog-core” instead of “fog” as runtime requirement
|
26
|
+
|
27
|
+
|
21
28
|
## [1.3.0] - 2016-11-30
|
22
29
|
|
23
30
|
### Changed
|
@@ -790,7 +797,8 @@ Changes:
|
|
790
797
|
* Merge branch 'sinatra'
|
791
798
|
|
792
799
|
|
793
|
-
[Unreleased]: https://github.com/AssetSync/asset_sync/compare/
|
800
|
+
[Unreleased]: https://github.com/AssetSync/asset_sync/compare/v2.0.0...HEAD
|
801
|
+
[2.0.0]: https://github.com/AssetSync/asset_sync/compare/v1.3.0...v2.0.0
|
794
802
|
[1.3.0]: https://github.com/AssetSync/asset_sync/compare/v1.2.1...v1.3.0
|
795
803
|
[1.2.1]: https://github.com/AssetSync/asset_sync/compare/v1.2.0...v1.2.1
|
796
804
|
[1.2.0]: https://github.com/AssetSync/asset_sync/compare/v1.1.0...v1.2.0
|
data/README.md
CHANGED
@@ -12,26 +12,20 @@ This was initially built and is intended to work on [Heroku](http://heroku.com)
|
|
12
12
|
|
13
13
|
## Upgrading?
|
14
14
|
|
15
|
-
|
15
|
+
Upgraded from 1.x? Read `UPGRADING.md`
|
16
16
|
|
17
17
|
## Installation
|
18
18
|
|
19
|
-
|
19
|
+
Since 2.x, Asset Sync depends on gem `fog-core` instead of `fog`.
|
20
|
+
This is due to `fog` is including many unused storage provider gems as its dependencies.
|
20
21
|
|
21
|
-
|
22
|
-
gem
|
23
|
-
```
|
24
|
-
|
25
|
-
### Optimized Fog loading
|
26
|
-
|
27
|
-
Since AssetSync doesn't know which parts of Fog you intend to use, it will just load the entire library.
|
28
|
-
If you prefer to load fewer classes into your application, which will reduce load time and memory use,
|
29
|
-
you need to load those parts of Fog yourself *before* loading AssetSync:
|
22
|
+
Asset Sync has no idea about what provider will be used,
|
23
|
+
so you are responsible for bundling the right gem for the provider to be used.
|
30
24
|
|
31
25
|
In your Gemfile:
|
32
26
|
```ruby
|
33
|
-
gem "fog", "~>1.20", require: "fog/aws/storage"
|
34
27
|
gem "asset_sync"
|
28
|
+
gem "fog-aws"
|
35
29
|
```
|
36
30
|
|
37
31
|
### Extended Installation (Faster sync with turbosprockets)
|
data/UPGRADING.md
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# Guide to upgrading from AssetSync 1.x to 2.x
|
2
|
+
|
3
|
+
Make sure that you're running the latest AssetSync 1.x release.
|
4
|
+
|
5
|
+
This upgrading guide touches on:
|
6
|
+
- Changed dependencies
|
7
|
+
|
8
|
+
|
9
|
+
## Changed dependencies
|
10
|
+
Asset Sync now depends on gem `fog-core` instead of `fog`.
|
11
|
+
This is due to `fog` is including many unused storage provider gems as its dependencies.
|
12
|
+
|
13
|
+
Asset Sync has no idea about what provider will be used,
|
14
|
+
so you are responsible for bundling the right gem for the provider to be used.
|
15
|
+
|
16
|
+
For example, when using AWS as fog provider:
|
17
|
+
```ruby
|
18
|
+
# Gemfile
|
19
|
+
gem "asset_sync"
|
20
|
+
gem "fog-aws"
|
21
|
+
```
|
22
|
+
|
23
|
+
If you don't install the required gem,
|
24
|
+
Fog will complain (by exception) about it when provider is set by Asset Sync.
|
25
|
+
|
data/asset_sync.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
|
|
18
18
|
|
19
19
|
s.rubyforge_project = "asset_sync"
|
20
20
|
|
21
|
-
s.add_dependency(
|
21
|
+
s.add_dependency("fog-core")
|
22
22
|
s.add_dependency('unf')
|
23
23
|
s.add_dependency('activemodel')
|
24
24
|
s.add_dependency('mime-types')
|
@@ -27,6 +27,8 @@ Gem::Specification.new do |s|
|
|
27
27
|
s.add_development_dependency "bundler"
|
28
28
|
s.add_development_dependency "jeweler"
|
29
29
|
|
30
|
+
s.add_development_dependency "fog-aws"
|
31
|
+
|
30
32
|
s.add_development_dependency "uglifier"
|
31
33
|
s.add_development_dependency "appraisal"
|
32
34
|
|
data/lib/asset_sync.rb
CHANGED
data/lib/asset_sync/config.rb
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
require "active_model"
|
2
|
+
require "erb"
|
3
|
+
require "yaml"
|
4
|
+
|
1
5
|
module AssetSync
|
2
6
|
class Config
|
3
7
|
include ActiveModel::Validations
|
@@ -61,12 +65,12 @@ module AssetSync
|
|
61
65
|
self.run_on_precompile = true
|
62
66
|
self.cdn_distribution_id = nil
|
63
67
|
self.invalidate = []
|
64
|
-
load_yml! if defined?(Rails) && yml_exists?
|
68
|
+
load_yml! if defined?(::Rails) && yml_exists?
|
65
69
|
end
|
66
70
|
|
67
71
|
def manifest_path
|
68
72
|
directory =
|
69
|
-
Rails.application.config.assets.manifest || default_manifest_directory
|
73
|
+
::Rails.application.config.assets.manifest || default_manifest_directory
|
70
74
|
File.join(directory, "manifest.yml")
|
71
75
|
end
|
72
76
|
|
@@ -111,24 +115,24 @@ module AssetSync
|
|
111
115
|
end
|
112
116
|
|
113
117
|
def yml_exists?
|
114
|
-
defined?(Rails.root) ? File.exist?(self.yml_path) : false
|
118
|
+
defined?(::Rails.root) ? File.exist?(self.yml_path) : false
|
115
119
|
end
|
116
120
|
|
117
121
|
def yml
|
118
|
-
@yml ||= YAML.load(ERB.new(IO.read(yml_path)).result)[Rails.env] || {}
|
122
|
+
@yml ||= ::YAML.load(::ERB.new(IO.read(yml_path)).result)[::Rails.env] || {}
|
119
123
|
end
|
120
124
|
|
121
125
|
def yml_path
|
122
|
-
Rails.root.join("config", "asset_sync.yml").to_s
|
126
|
+
::Rails.root.join("config", "asset_sync.yml").to_s
|
123
127
|
end
|
124
128
|
|
125
129
|
def assets_prefix
|
126
130
|
# Fix for Issue #38 when Rails.config.assets.prefix starts with a slash
|
127
|
-
self.prefix || Rails.application.config.assets.prefix.sub(/^\//, '')
|
131
|
+
self.prefix || ::Rails.application.config.assets.prefix.sub(/^\//, '')
|
128
132
|
end
|
129
133
|
|
130
134
|
def public_path
|
131
|
-
@public_path || Rails.public_path
|
135
|
+
@public_path || ::Rails.public_path
|
132
136
|
end
|
133
137
|
|
134
138
|
def load_yml!
|
@@ -212,7 +216,7 @@ module AssetSync
|
|
212
216
|
private
|
213
217
|
|
214
218
|
def default_manifest_directory
|
215
|
-
File.join(Rails.public_path, assets_prefix)
|
219
|
+
File.join(::Rails.public_path, assets_prefix)
|
216
220
|
end
|
217
221
|
end
|
218
222
|
end
|
data/lib/asset_sync/storage.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require "fog/core"
|
2
|
+
|
1
3
|
module AssetSync
|
2
4
|
class Storage
|
3
5
|
REGEXP_FINGERPRINTED_FILES = /^(.*)\/([^-]+)-[^\.]+\.([^\.]+)$/
|
@@ -61,7 +63,7 @@ module AssetSync
|
|
61
63
|
elsif File.exist?(self.config.manifest_path)
|
62
64
|
log "Using: Manifest #{self.config.manifest_path}"
|
63
65
|
yml = YAML.load(IO.read(self.config.manifest_path))
|
64
|
-
|
66
|
+
|
65
67
|
return yml.map do |original, compiled|
|
66
68
|
# Upload font originals and compiled
|
67
69
|
if original =~ /^.+(eot|svg|ttf|woff)$/
|
data/lib/asset_sync/version.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
+
require "fog/aws"
|
2
3
|
|
3
4
|
def bucket(name)
|
4
5
|
options = {
|
@@ -23,12 +24,12 @@ describe "AssetSync" do
|
|
23
24
|
@prefix = SecureRandom.hex(6)
|
24
25
|
end
|
25
26
|
|
26
|
-
let(:app_js_regex){
|
27
|
-
/#{@prefix}\/application-[a-zA-Z0-9]*.js$/
|
27
|
+
let(:app_js_regex){
|
28
|
+
/#{@prefix}\/application-[a-zA-Z0-9]*.js$/
|
28
29
|
}
|
29
30
|
|
30
|
-
let(:app_js_gz_regex){
|
31
|
-
/#{@prefix}\/application-[a-zA-Z0-9]*.js.gz$/
|
31
|
+
let(:app_js_gz_regex){
|
32
|
+
/#{@prefix}\/application-[a-zA-Z0-9]*.js.gz$/
|
32
33
|
}
|
33
34
|
|
34
35
|
let(:files){ bucket(@prefix).files }
|
@@ -148,7 +148,7 @@ describe AssetSync do
|
|
148
148
|
end
|
149
149
|
|
150
150
|
it "should be disabled" do
|
151
|
-
expect{ AssetSync.sync }.not_to raise_error
|
151
|
+
expect{ AssetSync.sync }.not_to raise_error
|
152
152
|
end
|
153
153
|
|
154
154
|
after(:each) do
|
@@ -162,7 +162,7 @@ describe AssetSync do
|
|
162
162
|
end
|
163
163
|
|
164
164
|
it "should be invalid" do
|
165
|
-
expect{ AssetSync.sync }.to raise_error()
|
165
|
+
expect{ AssetSync.sync }.to raise_error(::AssetSync::Config::Invalid)
|
166
166
|
end
|
167
167
|
end
|
168
168
|
|
@@ -175,7 +175,7 @@ describe AssetSync do
|
|
175
175
|
end
|
176
176
|
|
177
177
|
it "should do nothing, without complaining" do
|
178
|
-
expect{ AssetSync.sync }.not_to raise_error
|
178
|
+
expect{ AssetSync.sync }.not_to raise_error
|
179
179
|
end
|
180
180
|
end
|
181
181
|
|
@@ -189,7 +189,7 @@ describe AssetSync do
|
|
189
189
|
end
|
190
190
|
|
191
191
|
it "should not raise an invalid exception" do
|
192
|
-
expect{ AssetSync.sync }.not_to raise_error
|
192
|
+
expect{ AssetSync.sync }.not_to raise_error
|
193
193
|
end
|
194
194
|
|
195
195
|
it "should output a warning to stderr" do
|
@@ -208,7 +208,7 @@ describe AssetSync do
|
|
208
208
|
end
|
209
209
|
|
210
210
|
it "should not raise an invalid exception" do
|
211
|
-
expect{ AssetSync.sync }.not_to raise_error
|
211
|
+
expect{ AssetSync.sync }.not_to raise_error
|
212
212
|
end
|
213
213
|
end
|
214
214
|
|
data/spec/unit/google_spec.rb
CHANGED
@@ -86,7 +86,7 @@ describe AssetSync do
|
|
86
86
|
end
|
87
87
|
|
88
88
|
it "should be invalid" do
|
89
|
-
expect{ AssetSync.sync }.to raise_error()
|
89
|
+
expect{ AssetSync.sync }.to raise_error(::AssetSync::Config::Invalid)
|
90
90
|
end
|
91
91
|
end
|
92
92
|
|
@@ -100,7 +100,7 @@ describe AssetSync do
|
|
100
100
|
end
|
101
101
|
|
102
102
|
it "should not raise an invalid exception" do
|
103
|
-
expect{ AssetSync.sync }.not_to raise_error
|
103
|
+
expect{ AssetSync.sync }.not_to raise_error
|
104
104
|
end
|
105
105
|
end
|
106
106
|
|
data/spec/unit/storage_spec.rb
CHANGED
@@ -132,7 +132,7 @@ describe AssetSync::Storage do
|
|
132
132
|
storage.upload_files
|
133
133
|
end
|
134
134
|
|
135
|
-
it "
|
135
|
+
it "should invalidate files" do
|
136
136
|
@config.cdn_distribution_id = "1234"
|
137
137
|
@config.invalidate = ['local_image1.jpg']
|
138
138
|
@config.fog_provider = 'AWS'
|
@@ -154,7 +154,12 @@ describe AssetSync::Storage do
|
|
154
154
|
before(:each) do
|
155
155
|
# Object#remove_const does not remove the loaded
|
156
156
|
# file from the $" variable
|
157
|
-
#
|
157
|
+
#
|
158
|
+
# So we need do both
|
159
|
+
#
|
160
|
+
# 1. Remove constant(s) to avoid warning messages
|
161
|
+
# 2. Remove loaded file(s)
|
162
|
+
Object.send(:remove_const, :MIME) if defined?(MIME)
|
158
163
|
mime_types = $".grep(/mime\/types/).first
|
159
164
|
$".delete(mime_types)
|
160
165
|
require 'mime/types'
|
@@ -204,9 +209,5 @@ describe AssetSync::Storage do
|
|
204
209
|
end
|
205
210
|
storage.upload_file('assets/some_longer_path/local_image2.jpg')
|
206
211
|
end
|
207
|
-
|
208
|
-
after(:each) do
|
209
|
-
#Object.send(:remove_const, :MIME) if defined?(MIME)
|
210
|
-
end
|
211
212
|
end
|
212
213
|
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:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Simon Hamilton
|
@@ -14,19 +14,19 @@ cert_chain: []
|
|
14
14
|
date: 2013-08-26 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
|
-
name: fog
|
17
|
+
name: fog-core
|
18
18
|
requirement: !ruby/object:Gem::Requirement
|
19
19
|
requirements:
|
20
20
|
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version:
|
22
|
+
version: '0'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
29
|
+
version: '0'
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: unf
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -111,6 +111,20 @@ dependencies:
|
|
111
111
|
- - ">="
|
112
112
|
- !ruby/object:Gem::Version
|
113
113
|
version: '0'
|
114
|
+
- !ruby/object:Gem::Dependency
|
115
|
+
name: fog-aws
|
116
|
+
requirement: !ruby/object:Gem::Requirement
|
117
|
+
requirements:
|
118
|
+
- - ">="
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: '0'
|
121
|
+
type: :development
|
122
|
+
prerelease: false
|
123
|
+
version_requirements: !ruby/object:Gem::Requirement
|
124
|
+
requirements:
|
125
|
+
- - ">="
|
126
|
+
- !ruby/object:Gem::Version
|
127
|
+
version: '0'
|
114
128
|
- !ruby/object:Gem::Dependency
|
115
129
|
name: uglifier
|
116
130
|
requirement: !ruby/object:Gem::Requirement
|
@@ -157,6 +171,7 @@ files:
|
|
157
171
|
- Gemfile
|
158
172
|
- README.md
|
159
173
|
- Rakefile
|
174
|
+
- UPGRADING.md
|
160
175
|
- asset_sync.gemspec
|
161
176
|
- docs/heroku.md
|
162
177
|
- gemfiles/rails_3.1.gemfile
|
@@ -209,7 +224,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
209
224
|
version: '0'
|
210
225
|
requirements: []
|
211
226
|
rubyforge_project: asset_sync
|
212
|
-
rubygems_version: 2.
|
227
|
+
rubygems_version: 2.5.2
|
213
228
|
signing_key:
|
214
229
|
specification_version: 4
|
215
230
|
summary: Synchronises Assets in a Rails 3 application and Amazon S3/Cloudfront and
|