asset_sync 0.2.1 → 0.2.2

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.
data/README.md CHANGED
@@ -41,7 +41,7 @@ Currently when heroku runs `rake assets:precompile` during deployment. It does n
41
41
  **Workaround:** you could just hardcode your AWS credentials in the initializer or yml
42
42
 
43
43
  AssetSync.configure do |config|
44
- config.aws_access_key_id_id = 'xxx'
44
+ config.aws_access_key_id = 'xxx'
45
45
  config.aws_secret_access_key = 'xxx'
46
46
  config.fog_directory = 'mybucket'
47
47
  end
@@ -110,6 +110,9 @@ The generator will create a Rails initializer at `config/initializers/asset_sync
110
110
  # Use the Rails generated 'manifest.yml' file to produce the list of files to
111
111
  # upload instead of searching the assets directory.
112
112
  # config.manifest = true
113
+ #
114
+ # Fail silently. Useful for environments such as Heroku
115
+ # config.fail_silently = true
113
116
  end
114
117
 
115
118
 
@@ -129,6 +132,8 @@ If you used the `--use-yml` flag, the generator will create a YAML file at `conf
129
132
  # existing_remote_files: delete
130
133
  # Automatically replace files with their equivalent gzip compressed version
131
134
  # gzip_compression: true
135
+ # Fail silently. Useful for environments such as Heroku
136
+ # fail_silently = true
132
137
 
133
138
  development:
134
139
  <<: *defaults
@@ -200,6 +205,11 @@ With the `gzip_compression` option enabled, when uploading your assets. If a fil
200
205
 
201
206
  If the compressed file is actually larger than the uncompressed file we will ignore this rule and upload the standard uncompressed version.
202
207
 
208
+ ## Heroku
209
+
210
+ With Rails 3.1 on the Heroku cedar stack, the deployment process automatically runs `rake assets:precompile`. If you are using **ENV** variable style configuration. Due to the methods with which Heroku compile slugs, there will be an error raised by asset_sync as the environment is not available. This causes heroku to install the `rails31_enable_runtime_asset_compilation` plugin which is not necessary when using **asset_sync** and also massively slows down the first incoming requests to your app.
211
+
212
+ To prevent this part of the deploy from failing (asset_sync raising a config error), but carry on as normal set `fail_silently` to true in your configuration and ensure to run `heroku run rake assets:precompile` after deploy.
203
213
 
204
214
  ## Rake Task
205
215
 
@@ -225,4 +235,4 @@ Have borrowed ideas from:
225
235
 
226
236
  ## License
227
237
 
228
- MIT License. Copyright 2011 Rumble Labs Ltd. [rumblelabs.com](http://rumblelabs.com)
238
+ MIT License. Copyright 2011 Rumble Labs Ltd. [rumblelabs.com](http://rumblelabs.com)
data/asset_sync.gemspec CHANGED
@@ -6,7 +6,7 @@ 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 = "2011-11-21"
9
+ s.date = "2011-11-29"
10
10
  s.platform = Gem::Platform::RUBY
11
11
  s.authors = ["Simon Hamilton", "David Rice", "Phil McClure"]
12
12
  s.email = ["shamilton@rumblelabs.com", "me@davidjrice.co.uk", "pmcclure@rumblelabs.com"]
@@ -21,8 +21,12 @@ module AssetSync
21
21
  end
22
22
 
23
23
  def sync
24
- raise Config::Invalid.new(config.errors.full_messages.join(', ')) unless config && config.valid?
25
- self.storage.sync
24
+ if config.fail_silently?
25
+ puts config.errors.full_messages.join(', ') unless config && config.valid?
26
+ else
27
+ raise Config::Invalid.new(config.errors.full_messages.join(', ')) unless config && config.valid?
28
+ end
29
+ self.storage.sync if config && config.valid?
26
30
  end
27
31
 
28
32
  end
@@ -8,6 +8,7 @@ module AssetSync
8
8
  attr_accessor :existing_remote_files # What to do with your existing remote files? (keep or delete)
9
9
  attr_accessor :gzip_compression
10
10
  attr_accessor :manifest
11
+ attr_accessor :fail_silently
11
12
 
12
13
  # FOG configuration
13
14
  attr_accessor :fog_provider # Currently Supported ['AWS', 'Rackspace']
@@ -35,6 +36,7 @@ module AssetSync
35
36
  self.existing_remote_files = 'keep'
36
37
  self.gzip_compression = false
37
38
  self.manifest = false
39
+ self.fail_silently = false
38
40
  load_yml! if yml_exists?
39
41
  end
40
42
 
@@ -54,6 +56,10 @@ module AssetSync
54
56
  def aws?
55
57
  fog_provider == 'AWS'
56
58
  end
59
+
60
+ def fail_silently?
61
+ fail_silently == true
62
+ end
57
63
 
58
64
  def rackspace?
59
65
  fog_provider == 'Rackspace'
@@ -82,7 +88,8 @@ module AssetSync
82
88
  self.existing_remote_files = yml["existing_remote_files"] if yml.has_key?("existing_remote_files")
83
89
  self.gzip_compression = yml["gzip_compression"] if yml.has_key?("gzip_compression")
84
90
  self.manifest = yml["manifest"] if yml.has_key?("manifest")
85
-
91
+ self.fail_silently = yml["fail_silently"] if yml.has_key?("fail_silently")
92
+
86
93
  # TODO deprecate the other old style config settings. FML.
87
94
  self.aws_access_key_id = yml["aws_access_key"] if yml.has_key?("aws_access_key")
88
95
  self.aws_secret_access_key = yml["aws_access_secret"] if yml.has_key?("aws_access_secret")
@@ -1,3 +1,3 @@
1
1
  module AssetSync
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
@@ -22,4 +22,7 @@ AssetSync.configure do |config|
22
22
  # Use the Rails generated 'manifest.yml' file to produce the list of files to
23
23
  # upload instead of searching the assets directory.
24
24
  # config.manifest = true
25
+ #
26
+ # Fail silently. Useful for environments such as Heroku
27
+ # config.fail_silently = true
25
28
  end
@@ -16,6 +16,8 @@ defaults: &defaults
16
16
  # existing_remote_files: delete
17
17
  # Automatically replace files with their equivalent gzip compressed version
18
18
  # gzip_compression = true
19
+ # Fail silently. Useful for environments such as Heroku
20
+ # fail_silently = true
19
21
 
20
22
  development:
21
23
  <<: *defaults
@@ -106,6 +106,22 @@ describe AssetSync, 'with no configuration' do
106
106
 
107
107
  end
108
108
 
109
+ describe AssetSync, 'with fail_silent configuration' do
110
+
111
+ before(:all) do
112
+ Rails.root = 'without_yml'
113
+ AssetSync.config = AssetSync::Config.new
114
+ AssetSync.configure do |config|
115
+ config.fail_silently = true
116
+ end
117
+ end
118
+
119
+ it "should not raise an invalid exception" do
120
+ lambda{ AssetSync.sync }.should_not raise_error(AssetSync::Config::Invalid)
121
+ end
122
+
123
+ end
124
+
109
125
  describe AssetSync, 'with gzip_compression enabled' do
110
126
 
111
127
  before(:all) do
metadata CHANGED
@@ -1,13 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asset_sync
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 2
8
- - 1
9
- segments_generated: true
10
- version: 0.2.1
4
+ prerelease:
5
+ version: 0.2.2
11
6
  platform: ruby
12
7
  authors:
13
8
  - Simon Hamilton
@@ -17,78 +12,62 @@ autorequire:
17
12
  bindir: bin
18
13
  cert_chain: []
19
14
 
20
- date: 2011-11-21 00:00:00 +00:00
21
- default_executable:
15
+ date: 2011-11-29 00:00:00 Z
22
16
  dependencies:
23
17
  - !ruby/object:Gem::Dependency
24
18
  name: fog
19
+ prerelease: false
25
20
  requirement: &id001 !ruby/object:Gem::Requirement
26
21
  none: false
27
22
  requirements:
28
23
  - - ">="
29
24
  - !ruby/object:Gem::Version
30
- segments:
31
- - 0
32
- segments_generated: true
33
25
  version: "0"
34
26
  type: :runtime
35
- prerelease: false
36
27
  version_requirements: *id001
37
28
  - !ruby/object:Gem::Dependency
38
29
  name: activemodel
30
+ prerelease: false
39
31
  requirement: &id002 !ruby/object:Gem::Requirement
40
32
  none: false
41
33
  requirements:
42
34
  - - ">="
43
35
  - !ruby/object:Gem::Version
44
- segments:
45
- - 0
46
- segments_generated: true
47
36
  version: "0"
48
37
  type: :runtime
49
- prerelease: false
50
38
  version_requirements: *id002
51
39
  - !ruby/object:Gem::Dependency
52
40
  name: rspec
41
+ prerelease: false
53
42
  requirement: &id003 !ruby/object:Gem::Requirement
54
43
  none: false
55
44
  requirements:
56
45
  - - ">="
57
46
  - !ruby/object:Gem::Version
58
- segments:
59
- - 0
60
- segments_generated: true
61
47
  version: "0"
62
48
  type: :development
63
- prerelease: false
64
49
  version_requirements: *id003
65
50
  - !ruby/object:Gem::Dependency
66
51
  name: bundler
52
+ prerelease: false
67
53
  requirement: &id004 !ruby/object:Gem::Requirement
68
54
  none: false
69
55
  requirements:
70
56
  - - ">="
71
57
  - !ruby/object:Gem::Version
72
- segments:
73
- - 0
74
- segments_generated: true
75
58
  version: "0"
76
59
  type: :development
77
- prerelease: false
78
60
  version_requirements: *id004
79
61
  - !ruby/object:Gem::Dependency
80
62
  name: jeweler
63
+ prerelease: false
81
64
  requirement: &id005 !ruby/object:Gem::Requirement
82
65
  none: false
83
66
  requirements:
84
67
  - - ">="
85
68
  - !ruby/object:Gem::Version
86
- segments:
87
- - 0
88
- segments_generated: true
89
69
  version: "0"
90
70
  type: :development
91
- prerelease: false
92
71
  version_requirements: *id005
93
72
  description: After you run assets:precompile your compiled assets will be synchronised with your S3 bucket.
94
73
  email:
@@ -123,7 +102,6 @@ files:
123
102
  - spec/rackspace_spec.rb
124
103
  - spec/rackspace_with_yml/config/asset_sync.yml
125
104
  - spec/spec_helper.rb
126
- has_rdoc: true
127
105
  homepage: https://github.com/rumblelabs/asset_sync
128
106
  licenses: []
129
107
 
@@ -137,25 +115,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
137
115
  requirements:
138
116
  - - ">="
139
117
  - !ruby/object:Gem::Version
140
- hash: -2083511004484004665
141
- segments:
142
- - 0
143
- segments_generated: true
144
118
  version: "0"
145
119
  required_rubygems_version: !ruby/object:Gem::Requirement
146
120
  none: false
147
121
  requirements:
148
122
  - - ">="
149
123
  - !ruby/object:Gem::Version
150
- hash: -2083511004484004665
151
- segments:
152
- - 0
153
- segments_generated: true
154
124
  version: "0"
155
125
  requirements: []
156
126
 
157
127
  rubyforge_project: asset_sync
158
- rubygems_version: 1.3.7
128
+ rubygems_version: 1.8.10
159
129
  signing_key:
160
130
  specification_version: 3
161
131
  summary: Synchronises Assets in a Rails 3 application and Amazon S3/Cloudfront and Rackspace Cloudfiles