asset_sync 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.travis.yml +9 -2
- data/Appraisals +4 -0
- data/CHANGELOG.md +31 -0
- data/README.md +14 -1
- data/asset_sync.gemspec +3 -3
- data/gemfiles/rails_4.1.gemfile +10 -0
- data/lib/asset_sync.rb +1 -1
- data/lib/asset_sync/config.rb +18 -7
- data/lib/asset_sync/multi_mime.rb +4 -2
- data/lib/asset_sync/version.rb +1 -1
- data/spec/integration/aws_integration_spec.rb +5 -6
- data/spec/spec_helper.rb +10 -11
- data/spec/unit/asset_sync_spec.rb +36 -39
- data/spec/unit/google_spec.rb +21 -21
- data/spec/unit/multi_mime_spec.rb +4 -5
- data/spec/unit/rackspace_spec.rb +16 -16
- data/spec/unit/railsless_spec.rb +14 -14
- data/spec/unit/storage_spec.rb +48 -48
- metadata +35 -55
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 629deff4029487b164c47ee0a479cf5111461a15
|
4
|
+
data.tar.gz: 06e62f086d0a574def1741993066f42cf11b96da
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d37ddb643b78c91cdb24f1c8cf0fe3fb25162ace2c934eb6488ef8baf9eba8d080d892cdf85846eb0892677d58b2aea7b7a7baf3b35717de2082710d06ee8f75
|
7
|
+
data.tar.gz: fcb7bfb3c0a9b67fb341fb4eb8c4ca18e16e106e8eea852c150186685f59d75e97765246c90c2779feb4b4a1ebd707df9edc457a0db3fcf973e9994d0efce2e5
|
data/.travis.yml
CHANGED
@@ -3,7 +3,7 @@ rvm:
|
|
3
3
|
- 1.9.2
|
4
4
|
- 1.9.3
|
5
5
|
- jruby-19mode
|
6
|
-
- rbx-
|
6
|
+
- rbx-2
|
7
7
|
- ruby-head
|
8
8
|
- jruby-head
|
9
9
|
gemfile:
|
@@ -23,12 +23,19 @@ matrix:
|
|
23
23
|
gemfile: gemfiles/rails_4.0.gemfile
|
24
24
|
- rvm: jruby-19mode
|
25
25
|
gemfile: gemfiles/rails_4.0.gemfile
|
26
|
-
- rvm: rbx-
|
26
|
+
- rvm: rbx-2
|
27
27
|
gemfile: gemfiles/rails_4.0.gemfile
|
28
28
|
- rvm: 2.0.0
|
29
29
|
gemfile: gemfiles/rails_3.2.gemfile
|
30
30
|
- rvm: 2.0.0
|
31
31
|
gemfile: gemfiles/rails_4.0.gemfile
|
32
|
+
- rvm: 2.1.2
|
33
|
+
gemfile: gemfiles/rails_4.1.gemfile
|
34
|
+
- rvm: 2.0.0
|
35
|
+
gemfile: gemfiles/rails_4.1.gemfile
|
36
|
+
- rvm: 2.1.2
|
37
|
+
gemfile: gemfiles/rails_4.1.gemfile
|
32
38
|
allow_failures:
|
39
|
+
- rvm: rbx-2
|
33
40
|
- rvm: ruby-head
|
34
41
|
- rvm: jruby-head
|
data/Appraisals
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,36 @@
|
|
1
1
|
# RELEASE HISTORY
|
2
2
|
|
3
|
+
## v1.1.0 / 2014-08-13
|
4
|
+
|
5
|
+
Version 1.1.0 (Toby Osbourn <tosbourn@rumblelabs.com>)
|
6
|
+
|
7
|
+
Changes:
|
8
|
+
|
9
|
+
* 1 Change
|
10
|
+
|
11
|
+
* Bumping master to 1.1.0 - preparing to update RubyGems
|
12
|
+
|
13
|
+
## v0.5.6 / 2014-08-12
|
14
|
+
|
15
|
+
Version 0.5.6 (Toby Osbourn <tosbourn@rumblelabs.com>)
|
16
|
+
|
17
|
+
Changes:
|
18
|
+
|
19
|
+
* 1 Change
|
20
|
+
|
21
|
+
* Merged in support for optimized fog loading
|
22
|
+
|
23
|
+
## v0.5.5 / 2014-08-12
|
24
|
+
|
25
|
+
Version 0.5.5 (Toby Osbourn <tosbourn@rumblelabs.com>)
|
26
|
+
|
27
|
+
Changes:
|
28
|
+
|
29
|
+
* 2 Nominal Changes
|
30
|
+
|
31
|
+
* Merged some spec changes to get Travis to pass the build correctly
|
32
|
+
* Support using AWS IAM Roles
|
33
|
+
|
3
34
|
## v0.5.1 / 2012-10-22
|
4
35
|
|
5
36
|
Version 0.5.1 (David Rice <me@davidjrice.co.uk>)
|
data/README.md
CHANGED
@@ -50,6 +50,19 @@ if defined?(AssetSync)
|
|
50
50
|
...
|
51
51
|
end
|
52
52
|
```
|
53
|
+
|
54
|
+
### Optimized Fog loading
|
55
|
+
|
56
|
+
Since AssetSync doesn't know which parts of Fog you intend to use, it will just load the entire library.
|
57
|
+
If you prefer to load fewer classes into your application, which will reduce load time and memory use,
|
58
|
+
you need to load those parts of Fog yourself *before* loading AssetSync:
|
59
|
+
|
60
|
+
In your Gemfile:
|
61
|
+
```ruby
|
62
|
+
gem "fog", "~>1.20", require "fog/aws/storage"
|
63
|
+
gem "asset_sync"
|
64
|
+
```
|
65
|
+
|
53
66
|
### Extended Installation (Faster sync with turbosprockets)
|
54
67
|
|
55
68
|
It's possible to improve **asset:precompile** time if you are using Rails 3.2.x
|
@@ -95,7 +108,7 @@ Or
|
|
95
108
|
``` ruby
|
96
109
|
config.action_controller.asset_host = "//storage.googleapis.com/#{ENV['FOG_DIRECTORY']}"
|
97
110
|
```
|
98
|
-
On **non default S3 bucket region**: If your bucket is set to a region that is not the default US Standard (us-east-1) you must use the first style of url ``//#{ENV['FOG_DIRECTORY']}.s3.amazonaws.com`` or amazon will return a 301 permanently moved when assets are requested. Note the caveat above about bucket names and periods.
|
111
|
+
On **non default S3 bucket region**: If your bucket is set to a region that is not the default US Standard (us-east-1) you must use the first style of url ``//#{ENV['FOG_DIRECTORY']}.s3.amazonaws.com`` or amazon will return a 301 permanently moved when assets are requested. Note the caveat above about bucket names and periods.
|
99
112
|
|
100
113
|
If you wish to have your assets sync to a sub-folder of your bucket instead of into the root add the following to your ``production.rb`` file
|
101
114
|
|
data/asset_sync.gemspec
CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |s|
|
|
8
8
|
s.version = AssetSync::VERSION
|
9
9
|
s.date = "2013-08-26"
|
10
10
|
s.platform = Gem::Platform::RUBY
|
11
|
-
s.authors = ["Simon Hamilton", "David Rice", "Phil McClure"]
|
12
|
-
s.email = ["shamilton@rumblelabs.com", "me@davidjrice.co.uk", "pmcclure@rumblelabs.com"]
|
11
|
+
s.authors = ["Simon Hamilton", "David Rice", "Phil McClure", "Toby Osbourn"]
|
12
|
+
s.email = ["shamilton@rumblelabs.com", "me@davidjrice.co.uk", "pmcclure@rumblelabs.com", "tosbourn@rumblelabs.com"]
|
13
13
|
s.homepage = "https://github.com/rumblelabs/asset_sync"
|
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.}
|
@@ -17,6 +17,7 @@ Gem::Specification.new do |s|
|
|
17
17
|
s.rubyforge_project = "asset_sync"
|
18
18
|
|
19
19
|
s.add_dependency('fog', ">= 1.8.0")
|
20
|
+
s.add_dependency('unf')
|
20
21
|
s.add_dependency('activemodel')
|
21
22
|
|
22
23
|
s.add_development_dependency "rspec"
|
@@ -24,7 +25,6 @@ Gem::Specification.new do |s|
|
|
24
25
|
s.add_development_dependency "jeweler"
|
25
26
|
|
26
27
|
s.add_development_dependency "uglifier"
|
27
|
-
s.add_development_dependency "asset_sync"
|
28
28
|
s.add_development_dependency "appraisal"
|
29
29
|
|
30
30
|
s.files = `git ls-files`.split("\n")
|
@@ -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 => "../"
|
data/lib/asset_sync.rb
CHANGED
data/lib/asset_sync/config.rb
CHANGED
@@ -26,7 +26,7 @@ module AssetSync
|
|
26
26
|
attr_accessor :fog_region # e.g. 'eu-west-1'
|
27
27
|
|
28
28
|
# Amazon AWS
|
29
|
-
attr_accessor :aws_access_key_id, :aws_secret_access_key, :aws_reduced_redundancy
|
29
|
+
attr_accessor :aws_access_key_id, :aws_secret_access_key, :aws_reduced_redundancy, :aws_iam_roles
|
30
30
|
|
31
31
|
# Rackspace
|
32
32
|
attr_accessor :rackspace_username, :rackspace_api_key, :rackspace_auth_url
|
@@ -39,8 +39,8 @@ module AssetSync
|
|
39
39
|
validates :fog_provider, :presence => true
|
40
40
|
validates :fog_directory, :presence => true
|
41
41
|
|
42
|
-
validates :aws_access_key_id, :presence => true, :if =>
|
43
|
-
validates :aws_secret_access_key, :presence => true, :if =>
|
42
|
+
validates :aws_access_key_id, :presence => true, :if => proc {aws? && !aws_iam?}
|
43
|
+
validates :aws_secret_access_key, :presence => true, :if => proc {aws? && !aws_iam?}
|
44
44
|
validates :rackspace_username, :presence => true, :if => :rackspace?
|
45
45
|
validates :rackspace_api_key, :presence => true, :if => :rackspace?
|
46
46
|
validates :google_storage_secret_access_key, :presence => true, :if => :google?
|
@@ -85,6 +85,10 @@ module AssetSync
|
|
85
85
|
aws_reduced_redundancy == true
|
86
86
|
end
|
87
87
|
|
88
|
+
def aws_iam?
|
89
|
+
aws_iam_roles == true
|
90
|
+
end
|
91
|
+
|
88
92
|
def fail_silently?
|
89
93
|
fail_silently || !enabled?
|
90
94
|
end
|
@@ -138,6 +142,7 @@ module AssetSync
|
|
138
142
|
self.aws_access_key_id = yml["aws_access_key_id"]
|
139
143
|
self.aws_secret_access_key = yml["aws_secret_access_key"]
|
140
144
|
self.aws_reduced_redundancy = yml["aws_reduced_redundancy"]
|
145
|
+
self.aws_iam_roles = yml["aws_iam_roles"]
|
141
146
|
self.rackspace_username = yml["rackspace_username"]
|
142
147
|
self.rackspace_auth_url = yml["rackspace_auth_url"] if yml.has_key?("rackspace_auth_url")
|
143
148
|
self.rackspace_api_key = yml["rackspace_api_key"]
|
@@ -173,10 +178,16 @@ module AssetSync
|
|
173
178
|
def fog_options
|
174
179
|
options = { :provider => fog_provider }
|
175
180
|
if aws?
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
181
|
+
if aws_iam?
|
182
|
+
options.merge!({
|
183
|
+
:use_iam_profile => true
|
184
|
+
})
|
185
|
+
else
|
186
|
+
options.merge!({
|
187
|
+
:aws_access_key_id => aws_access_key_id,
|
188
|
+
:aws_secret_access_key => aws_secret_access_key
|
189
|
+
})
|
190
|
+
end
|
180
191
|
elsif rackspace?
|
181
192
|
options.merge!({
|
182
193
|
:rackspace_username => rackspace_username,
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'mime/types'
|
2
|
+
|
1
3
|
module AssetSync
|
2
4
|
class MultiMime
|
3
5
|
|
@@ -9,10 +11,10 @@ module AssetSync
|
|
9
11
|
ext_with_dot = ".#{ext}"
|
10
12
|
Rack::Mime.mime_type(ext_with_dot)
|
11
13
|
else
|
12
|
-
MIME::Types.type_for(ext).first
|
14
|
+
::MIME::Types.type_for(ext).first
|
13
15
|
end
|
14
16
|
|
15
17
|
end
|
16
18
|
|
17
19
|
end
|
18
|
-
end
|
20
|
+
end
|
data/lib/asset_sync/version.rb
CHANGED
@@ -43,7 +43,6 @@ describe "AssetSync" do
|
|
43
43
|
|
44
44
|
it "sync" do
|
45
45
|
execute "rake ASSET_SYNC_PREFIX=#{@prefix} assets:precompile"
|
46
|
-
# bucket(@prefix).files.size.should == 5
|
47
46
|
|
48
47
|
files = bucket(@prefix).files
|
49
48
|
|
@@ -51,16 +50,16 @@ describe "AssetSync" do
|
|
51
50
|
app_js_gz_path = files.select{ |f| f.key =~ app_js_gz_regex }.first
|
52
51
|
|
53
52
|
app_js = files.get( app_js_path.key )
|
54
|
-
app_js.content_type.
|
53
|
+
expect(app_js.content_type).to eq("text/javascript")
|
55
54
|
|
56
55
|
app_js_gz = files.get( app_js_gz_path.key )
|
57
|
-
app_js_gz.content_type.
|
58
|
-
app_js_gz.content_encoding.
|
56
|
+
expect(app_js_gz.content_type).to eq("text/javascript")
|
57
|
+
expect(app_js_gz.content_encoding).to eq("gzip")
|
59
58
|
end
|
60
59
|
|
61
60
|
it "sync with enabled=false" do
|
62
61
|
execute "rake ASSET_SYNC_PREFIX=#{@prefix} ASSET_SYNC_ENABLED=false assets:precompile"
|
63
|
-
bucket(@prefix).files.size.
|
62
|
+
expect(bucket(@prefix).files.size).to eq(0)
|
64
63
|
end
|
65
64
|
|
66
65
|
it "sync with gzip_compression=true" do
|
@@ -69,7 +68,7 @@ describe "AssetSync" do
|
|
69
68
|
|
70
69
|
app_js_path = files.select{ |f| f.key =~ app_js_regex }.first
|
71
70
|
app_js = files.get( app_js_path.key )
|
72
|
-
app_js.content_type.
|
71
|
+
expect(app_js.content_type).to eq("text/javascript")
|
73
72
|
end
|
74
73
|
|
75
74
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -32,22 +32,21 @@ shared_context "mock without Rails" do
|
|
32
32
|
if defined? Rails
|
33
33
|
Object.send(:remove_const, :Rails)
|
34
34
|
end
|
35
|
-
AssetSync.
|
35
|
+
allow(AssetSync).to receive(:log)
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
39
|
|
40
40
|
shared_context "mock Rails" do
|
41
41
|
before(:each) do
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
Rails.
|
46
|
-
Rails.
|
47
|
-
Rails.application.
|
48
|
-
Rails.application.config.stub :assets => ActiveSupport::OrderedOptions.new
|
42
|
+
Object.send(:remove_const, :Rails) if defined? Rails
|
43
|
+
Rails = double 'Rails'
|
44
|
+
allow(Rails).to receive(:env).and_return('test')
|
45
|
+
allow(Rails).to receive_messages :application => double('application')
|
46
|
+
allow(Rails.application).to receive_messages :config => double('config')
|
47
|
+
allow(Rails.application.config).to receive_messages :assets => ActiveSupport::OrderedOptions.new
|
49
48
|
Rails.application.config.assets.prefix = '/assets'
|
50
|
-
AssetSync.
|
49
|
+
allow(AssetSync).to receive(:log)
|
51
50
|
end
|
52
51
|
end
|
53
52
|
|
@@ -56,10 +55,10 @@ shared_context "mock Rails without_yml" do
|
|
56
55
|
|
57
56
|
before(:each) do
|
58
57
|
set_rails_root('without_yml')
|
59
|
-
Rails.
|
58
|
+
allow(Rails).to receive(:public_path).and_return(Rails.root.join('public').to_s)
|
60
59
|
end
|
61
60
|
end
|
62
61
|
|
63
62
|
def set_rails_root(path)
|
64
|
-
Rails.
|
63
|
+
allow(Rails).to receive(:root).and_return(Pathname.new(File.join(File.dirname(__FILE__), 'fixtures', path)))
|
65
64
|
end
|
@@ -17,61 +17,61 @@ describe AssetSync do
|
|
17
17
|
end
|
18
18
|
|
19
19
|
it "should default to running on precompile" do
|
20
|
-
AssetSync.config.run_on_precompile.
|
20
|
+
expect(AssetSync.config.run_on_precompile).to be_truthy
|
21
21
|
end
|
22
22
|
|
23
23
|
it "should default AssetSync to enabled" do
|
24
|
-
AssetSync.config.enabled
|
25
|
-
AssetSync.enabled
|
24
|
+
expect(AssetSync.config.enabled?).to be_truthy
|
25
|
+
expect(AssetSync.enabled?).to be_truthy
|
26
26
|
end
|
27
27
|
|
28
28
|
it "should configure provider as AWS" do
|
29
|
-
AssetSync.config.fog_provider.
|
30
|
-
AssetSync.config.
|
29
|
+
expect(AssetSync.config.fog_provider).to eq('AWS')
|
30
|
+
expect(AssetSync.config).to be_aws
|
31
31
|
end
|
32
32
|
|
33
33
|
it "should should keep existing remote files" do
|
34
|
-
AssetSync.config.existing_remote_files
|
34
|
+
expect(AssetSync.config.existing_remote_files?).to eq(true)
|
35
35
|
end
|
36
36
|
|
37
37
|
it "should configure aws_access_key" do
|
38
|
-
AssetSync.config.aws_access_key_id.
|
38
|
+
expect(AssetSync.config.aws_access_key_id).to eq("aaaa")
|
39
39
|
end
|
40
40
|
|
41
41
|
it "should configure aws_secret_access_key" do
|
42
|
-
AssetSync.config.aws_secret_access_key.
|
42
|
+
expect(AssetSync.config.aws_secret_access_key).to eq("bbbb")
|
43
43
|
end
|
44
44
|
|
45
45
|
it "should configure aws_access_key" do
|
46
|
-
AssetSync.config.fog_directory.
|
46
|
+
expect(AssetSync.config.fog_directory).to eq("mybucket")
|
47
47
|
end
|
48
48
|
|
49
49
|
it "should configure fog_region" do
|
50
|
-
AssetSync.config.fog_region.
|
50
|
+
expect(AssetSync.config.fog_region).to eq("eu-west-1")
|
51
51
|
end
|
52
52
|
|
53
53
|
it "should configure existing_remote_files" do
|
54
|
-
AssetSync.config.existing_remote_files.
|
54
|
+
expect(AssetSync.config.existing_remote_files).to eq("keep")
|
55
55
|
end
|
56
56
|
|
57
57
|
it "should default gzip_compression to false" do
|
58
|
-
AssetSync.config.gzip_compression.
|
58
|
+
expect(AssetSync.config.gzip_compression).to be_falsey
|
59
59
|
end
|
60
60
|
|
61
61
|
it "should default manifest to false" do
|
62
|
-
AssetSync.config.manifest.
|
62
|
+
expect(AssetSync.config.manifest).to be_falsey
|
63
63
|
end
|
64
64
|
|
65
65
|
it "should default log_silently to true" do
|
66
|
-
AssetSync.config.log_silently.
|
66
|
+
expect(AssetSync.config.log_silently).to be_truthy
|
67
67
|
end
|
68
68
|
|
69
69
|
it "should default cdn_distribution_id to nil" do
|
70
|
-
AssetSync.config.cdn_distribution_id.
|
70
|
+
expect(AssetSync.config.cdn_distribution_id).to be_nil
|
71
71
|
end
|
72
72
|
|
73
73
|
it "should default invalidate to empty array" do
|
74
|
-
AssetSync.config.invalidate.
|
74
|
+
expect(AssetSync.config.invalidate).to eq([])
|
75
75
|
end
|
76
76
|
end
|
77
77
|
|
@@ -82,40 +82,40 @@ describe AssetSync do
|
|
82
82
|
end
|
83
83
|
|
84
84
|
it "should default AssetSync to enabled" do
|
85
|
-
AssetSync.config.enabled
|
86
|
-
AssetSync.enabled
|
85
|
+
expect(AssetSync.config.enabled?).to be_truthy
|
86
|
+
expect(AssetSync.enabled?).to be_truthy
|
87
87
|
end
|
88
88
|
|
89
89
|
it "should configure run_on_precompile" do
|
90
|
-
AssetSync.config.run_on_precompile.
|
90
|
+
expect(AssetSync.config.run_on_precompile).to be_falsey
|
91
91
|
end
|
92
92
|
|
93
93
|
it "should configure aws_access_key_id" do
|
94
|
-
AssetSync.config.aws_access_key_id.
|
94
|
+
expect(AssetSync.config.aws_access_key_id).to eq("xxxx")
|
95
95
|
end
|
96
96
|
|
97
97
|
it "should configure aws_secret_access_key" do
|
98
|
-
AssetSync.config.aws_secret_access_key.
|
98
|
+
expect(AssetSync.config.aws_secret_access_key).to eq("zzzz")
|
99
99
|
end
|
100
100
|
|
101
101
|
it "should configure fog_directory" do
|
102
|
-
AssetSync.config.fog_directory.
|
102
|
+
expect(AssetSync.config.fog_directory).to eq("rails_app_test")
|
103
103
|
end
|
104
104
|
|
105
105
|
it "should configure fog_region" do
|
106
|
-
AssetSync.config.fog_region.
|
106
|
+
expect(AssetSync.config.fog_region).to eq("eu-west-1")
|
107
107
|
end
|
108
108
|
|
109
109
|
it "should configure existing_remote_files" do
|
110
|
-
AssetSync.config.existing_remote_files.
|
110
|
+
expect(AssetSync.config.existing_remote_files).to eq("keep")
|
111
111
|
end
|
112
112
|
|
113
113
|
it "should default gzip_compression to false" do
|
114
|
-
AssetSync.config.gzip_compression.
|
114
|
+
expect(AssetSync.config.gzip_compression).to be_falsey
|
115
115
|
end
|
116
116
|
|
117
117
|
it "should default manifest to false" do
|
118
|
-
AssetSync.config.manifest.
|
118
|
+
expect(AssetSync.config.manifest).to be_falsey
|
119
119
|
end
|
120
120
|
end
|
121
121
|
|
@@ -160,7 +160,7 @@ describe AssetSync do
|
|
160
160
|
|
161
161
|
describe 'with fail_silent configuration' do
|
162
162
|
before(:each) do
|
163
|
-
AssetSync.
|
163
|
+
allow(AssetSync).to receive(:stderr).and_return(@stderr = StringIO.new)
|
164
164
|
AssetSync.config = AssetSync::Config.new
|
165
165
|
AssetSync.configure do |config|
|
166
166
|
config.fail_silently = true
|
@@ -173,13 +173,13 @@ describe AssetSync do
|
|
173
173
|
|
174
174
|
it "should output a warning to stderr" do
|
175
175
|
AssetSync.sync
|
176
|
-
@stderr.string.
|
176
|
+
expect(@stderr.string).to match(/can't be blank/)
|
177
177
|
end
|
178
178
|
end
|
179
179
|
|
180
180
|
describe 'with disabled config' do
|
181
181
|
before(:each) do
|
182
|
-
AssetSync.
|
182
|
+
allow(AssetSync).to receive(:stderr).and_return(@stderr = StringIO.new)
|
183
183
|
AssetSync.config = AssetSync::Config.new
|
184
184
|
AssetSync.configure do |config|
|
185
185
|
config.enabled = false
|
@@ -187,7 +187,7 @@ describe AssetSync do
|
|
187
187
|
end
|
188
188
|
|
189
189
|
it "should not raise an invalid exception" do
|
190
|
-
|
190
|
+
expect{ AssetSync.sync }.not_to raise_error()
|
191
191
|
end
|
192
192
|
end
|
193
193
|
|
@@ -198,7 +198,7 @@ describe AssetSync do
|
|
198
198
|
end
|
199
199
|
|
200
200
|
it "config.gzip? should be true" do
|
201
|
-
AssetSync.config.gzip
|
201
|
+
expect(AssetSync.config.gzip?).to be_truthy
|
202
202
|
end
|
203
203
|
end
|
204
204
|
|
@@ -209,21 +209,21 @@ describe AssetSync do
|
|
209
209
|
end
|
210
210
|
|
211
211
|
it "config.manifest should be true" do
|
212
|
-
AssetSync.config.manifest.
|
212
|
+
expect(AssetSync.config.manifest).to be_truthy
|
213
213
|
end
|
214
214
|
|
215
215
|
it "config.manifest_path should default to public/assets.." do
|
216
|
-
AssetSync.config.manifest_path.
|
216
|
+
expect(AssetSync.config.manifest_path).to match(/public\/assets\/manifest.yml/)
|
217
217
|
end
|
218
218
|
|
219
219
|
it "config.manifest_path should default to public/assets.." do
|
220
220
|
Rails.application.config.assets.manifest = "/var/assets"
|
221
|
-
AssetSync.config.manifest_path.
|
221
|
+
expect(AssetSync.config.manifest_path).to eq("/var/assets/manifest.yml")
|
222
222
|
end
|
223
223
|
|
224
224
|
it "config.manifest_path should default to public/custom_assets.." do
|
225
225
|
Rails.application.config.assets.prefix = 'custom_assets'
|
226
|
-
AssetSync.config.manifest_path.
|
226
|
+
expect(AssetSync.config.manifest_path).to match(/public\/custom_assets\/manifest.yml/)
|
227
227
|
end
|
228
228
|
end
|
229
229
|
|
@@ -235,14 +235,11 @@ describe AssetSync do
|
|
235
235
|
end
|
236
236
|
|
237
237
|
it "config should be invalid" do
|
238
|
-
AssetSync.config.valid
|
238
|
+
expect(AssetSync.config.valid?).to be_falsey
|
239
239
|
end
|
240
240
|
|
241
241
|
it "should raise a config invalid error" do
|
242
242
|
expect{ AssetSync.sync }.to raise_error()
|
243
243
|
end
|
244
|
-
|
245
|
-
|
246
244
|
end
|
247
|
-
|
248
245
|
end
|