asset_sync 0.5.0 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +5 -0
- data/.travis.yml +5 -1
- data/CHANGELOG.md +707 -0
- data/README.md +31 -3
- data/Rakefile +15 -2
- data/asset_sync.gemspec +5 -1
- data/lib/asset_sync/engine.rb +42 -32
- data/lib/asset_sync/storage.rb +4 -4
- data/lib/asset_sync/version.rb +1 -1
- data/lib/generators/asset_sync/templates/asset_sync.yml +3 -0
- data/spec/dummy_app/Rakefile +29 -0
- data/spec/dummy_app/app/assets/javascripts/application.js +1 -0
- data/spec/{aws_with_yml → fixtures/aws_with_yml}/config/asset_sync.yml +0 -0
- data/spec/{google_with_yml → fixtures/google_with_yml}/config/asset_sync.yml +0 -0
- data/spec/{rackspace_with_yml → fixtures/rackspace_with_yml}/config/asset_sync.yml +0 -0
- data/spec/integration/aws_integration_spec.rb +49 -0
- data/spec/spec_helper.rb +1 -1
- data/spec/{asset_sync_spec.rb → unit/asset_sync_spec.rb} +1 -1
- data/spec/{google_spec.rb → unit/google_spec.rb} +1 -1
- data/spec/{rackspace_spec.rb → unit/rackspace_spec.rb} +1 -1
- data/spec/{railsless_spec.rb → unit/railsless_spec.rb} +1 -1
- data/spec/{storage_spec.rb → unit/storage_spec.rb} +1 -2
- metadata +75 -20
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -10,6 +10,10 @@ rvm:
|
|
10
10
|
- ruby-head
|
11
11
|
- jruby-head
|
12
12
|
- ree
|
13
|
+
env:
|
14
|
+
- ["FOG_DIRECTORY=asset-sync-travis","FOG_PROVIDER=AWS", {secure: "dy8Fqlg3b1ZMK1BY5z6NMQLbzAVd7GWVYY0MeCQALz76zRac0z8MyU8hkv6h\nozFry7DSdbGehGT9foOnkWTwzGzf1rzdd5cmWrUPk1wDTRgMM9SrwodPj1TU\nzsq2EFx0a79vADQN8JXkpLC1YD6kEb9aWkTxrIT9KBgw+J5H32o="}, {secure: "Hmx7D7/p2LlA2ya/xBIz21s/8MLIQCjvfYB7RWBNlWk1PfqRLAz8wX6TUVWy\nfAFktMjLnpRLRYO7AgQS4jcfQ/k0HYK9IXzqXzeI00TNm0Vwp0TCXhawiOFT\nSvUMhs2/1vRfjN0HOJ75XlWRhJzV/G5rOMiafAZLsVzN/0iiB8g="}]
|
13
15
|
matrix:
|
14
16
|
allow_failures:
|
15
|
-
- rvm: ruby-head
|
17
|
+
- rvm: ruby-head
|
18
|
+
- rvm: jruby-head
|
19
|
+
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,707 @@
|
|
1
|
+
# RELEASE HISTORY
|
2
|
+
|
3
|
+
## v0.5.1 / 2012-10-22
|
4
|
+
|
5
|
+
Version 0.5.1 (David Rice <me@davidjrice.co.uk>)
|
6
|
+
|
7
|
+
Changes:
|
8
|
+
|
9
|
+
* 5 Nominal Changes
|
10
|
+
|
11
|
+
* Add a CHANGELOG.md (as generated by vclog -r -f markdown
|
12
|
+
* Improve documentation on ignored_files config option
|
13
|
+
* Allow failure of specs against ruby-head and jruby-head
|
14
|
+
* Merge pull request #115 from demirhanaydin/patch-1
|
15
|
+
* Merge support for always providing mime_type #93 from patdeegan/master
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
## v0.5.0 / 2012-08-23
|
20
|
+
|
21
|
+
Version 0.5.0 (David Rice <me@davidjrice.co.uk>)
|
22
|
+
|
23
|
+
Changes:
|
24
|
+
|
25
|
+
* 8 Nominal Changes
|
26
|
+
|
27
|
+
* Merge branch 'sinatra' of github.com:rumblelabs/asset_sync into sinatra
|
28
|
+
* Version 0.5.0, sinatra / rack support
|
29
|
+
* Some refactoring to further remove dependency on Rails, add spec for railsless configuration
|
30
|
+
* Update readme.
|
31
|
+
* Add public_path and prefix config options so asset_sync can be used outside Rails.
|
32
|
+
* Some refactoring to further remove dependency on Rails, add spec for railsless configuration
|
33
|
+
* Merge branch 'ejholmes/sinatra' into sinatra
|
34
|
+
* Version 0.4.3, removed dependency on Rails Time additions
|
35
|
+
|
36
|
+
|
37
|
+
## v0.4.3 / 2012-08-19
|
38
|
+
|
39
|
+
Version 0.4.3 (David Rice <me@davidjrice.co.uk>)
|
40
|
+
|
41
|
+
Changes:
|
42
|
+
|
43
|
+
* 21 Nominal Changes
|
44
|
+
|
45
|
+
* Refactor cache control and expiry hearder definition to use same value of one year
|
46
|
+
* Merge pull request #94 from karlfreeman/time
|
47
|
+
|
48
|
+
Remove Rails time dependency
|
49
|
+
* Allow failures in ruby-head
|
50
|
+
* Merge pull request #88 from potomak/patch-1
|
51
|
+
|
52
|
+
Fix defined? syntax
|
53
|
+
* Merge pull request #95 from bbhoss/patch-1
|
54
|
+
|
55
|
+
Fix syntax error in documentation
|
56
|
+
* Describe using S3 HTTPS better
|
57
|
+
* Fix syntax error
|
58
|
+
* remove Rails time dependency
|
59
|
+
* Update readme.
|
60
|
+
* Add public_path and prefix config options so asset_sync can be used outside Rails.
|
61
|
+
* Fix defined? syntax
|
62
|
+
* Force build on travis
|
63
|
+
* Get specs running under jruby and travis /cc @headius :)
|
64
|
+
* Ignore ds_store
|
65
|
+
* Add jruby-openssl gem to get tests passing on jruby
|
66
|
+
* test all the things
|
67
|
+
* Add travis config for rbx
|
68
|
+
* Merge branch 'master' of github.com:rumblelabs/asset_sync
|
69
|
+
* Update README for installing on heroku, labs is no-longer a plugin
|
70
|
+
* Merge pull request #75 from mscottford/master
|
71
|
+
|
72
|
+
Update asset_host configuration in README to not rely on request object
|
73
|
+
* Version 0.4.2, allow configuration of an array of strings or regex for files to ignore uploading. #euruko
|
74
|
+
|
75
|
+
|
76
|
+
## v0.4.2 / 2012-06-02
|
77
|
+
|
78
|
+
Version 0.4.2 (David Rice <me@davidjrice.co.uk>)
|
79
|
+
|
80
|
+
Changes:
|
81
|
+
|
82
|
+
* 7 Nominal Changes
|
83
|
+
|
84
|
+
* Remove errant puts from spec
|
85
|
+
* Merge
|
86
|
+
* Add option to configure ignored_files through YAML config file
|
87
|
+
* Removes errant end in the asset_host config example.
|
88
|
+
* Updates README to suggest a different asset_host configuration
|
89
|
+
|
90
|
+
The previous version will fail in some cases because a request is not always available during asset compilation.
|
91
|
+
* Fix Fog warnings when running specs.
|
92
|
+
* Version 0.4.1, allow programatic disabling of AssetSync.config.enabled
|
93
|
+
|
94
|
+
|
95
|
+
## v0.4.1 / 2012-05-04
|
96
|
+
|
97
|
+
Version 0.4.1 (David Rice <me@davidjrice.co.uk>)
|
98
|
+
|
99
|
+
Changes:
|
100
|
+
|
101
|
+
* 10 Nominal Changes
|
102
|
+
|
103
|
+
* Update docs
|
104
|
+
* Don't default to disabled if ASSET_SYNC_ENABLED env var is not specified.
|
105
|
+
* Add option to ignore files
|
106
|
+
* Add support for ASSET_SYNC_ENABLED with env vars.
|
107
|
+
* Oops, should have used the accessor
|
108
|
+
* Add support for enabled in the yaml config.
|
109
|
+
* Add specs for AssetSync.enabled? configured through the initializer.
|
110
|
+
* Make it possible to turn off AssetSync...
|
111
|
+
|
112
|
+
Useful when precompiling to export to a hybrid mobile app such as PhoneGap.
|
113
|
+
Would fix issue #66.
|
114
|
+
* How many times will I forget to update the release date? many
|
115
|
+
* Version 0.4.0, google storage support. Allow force upload of all or selected files. Travis CI enabled
|
116
|
+
|
117
|
+
|
118
|
+
## v0.4.0 / 2012-04-26
|
119
|
+
|
120
|
+
Version 0.4.0 (David Rice <me@davidjrice.co.uk>)
|
121
|
+
|
122
|
+
Changes:
|
123
|
+
|
124
|
+
* 22 Nominal Changes
|
125
|
+
|
126
|
+
* Add google storage options to built in initializer to allow config via ENV vars
|
127
|
+
* Add google storage configuration to README
|
128
|
+
* fix case on google provider in generator
|
129
|
+
* added google storage tests
|
130
|
+
* added google storage generators
|
131
|
+
* add attr_accessor for google keys
|
132
|
+
* add support for fog gems google storage option
|
133
|
+
* Oh, travisci will build an orgs repos if you configure the webhookd. Use rumblelabs/asset_sync as build status
|
134
|
+
* Merge branch 'master' into levent/feature/overwrite_specific_remote_files
|
135
|
+
* Use my travis-ci build in README
|
136
|
+
* Merge pull request #69 from levent/integrate_travis
|
137
|
+
|
138
|
+
Integrate Travis CI
|
139
|
+
* Merge branch 'integrate_travis' into feature/overwrite_specific_remote_files
|
140
|
+
* Specs for uploading assets
|
141
|
+
* Travis build logo
|
142
|
+
* Setting up for Travis
|
143
|
+
* Updated README
|
144
|
+
* always_upload config option added
|
145
|
+
* gitignore *.swp (for vim)
|
146
|
+
* Add ability to ignore remote files
|
147
|
+
* Correct name of specs
|
148
|
+
* Allows specifying an array of assets to always upload to remote
|
149
|
+
* Version 0.3.2, set content encoding header for .gz files
|
150
|
+
|
151
|
+
|
152
|
+
## v0.3.2 / 2012-04-18
|
153
|
+
|
154
|
+
Version 0.3.2 (David Rice <me@davidjrice.co.uk>)
|
155
|
+
|
156
|
+
Changes:
|
157
|
+
|
158
|
+
* 11 Nominal Changes
|
159
|
+
|
160
|
+
* Remove trailing comma
|
161
|
+
* Merge pull request #57 from nathanhumbert/master
|
162
|
+
|
163
|
+
Set Content-Encoding for gzip files when config.gzip? is not true
|
164
|
+
* Merge pull request #59 from kamui/master
|
165
|
+
|
166
|
+
Use Rails.public_path and Pathname#join for path concat and string interpolation
|
167
|
+
* Merge pull request #55 from manuelmeurer/patch-1
|
168
|
+
|
169
|
+
Remove comments taken from another gem
|
170
|
+
* Dir.chdir to path first to avoid a map call and path string slicing
|
171
|
+
* add Rails.public_path stub and make Rails.root return Pathname class to match Rails behavior
|
172
|
+
* Rails.root returns a Pathname, use Pathname#join instead of File.join and string interpolation
|
173
|
+
* use Rails.public_path instead of concat Rails.root and 'public'
|
174
|
+
* Set Content-Encoding for gzip files when config.gzip? is not true
|
175
|
+
|
176
|
+
This allows a S3 bucket served via CloudFront to properly handle the
|
177
|
+
Accept-Encoding request header.
|
178
|
+
* Remove comments taken from another gem
|
179
|
+
* Merge branch 'master' of github.com:rumblelabs/asset_sync
|
180
|
+
|
181
|
+
|
182
|
+
## v0.3.1 / 2012-03-07
|
183
|
+
|
184
|
+
Version 0.3.1 (David Rice <me@davidjrice.co.uk>)
|
185
|
+
|
186
|
+
Changes:
|
187
|
+
|
188
|
+
* 6 Nominal Changes
|
189
|
+
|
190
|
+
* Version 0.3.1, improve logging of asset_sync configuration and sync events
|
191
|
+
* Remove some debugging stuffs
|
192
|
+
* Improve logging during asset_sync progress.
|
193
|
+
* Separate log and warn message, should not mess up heroku precompile thread as it watches STDERR for output.
|
194
|
+
* Improve logging, only log to STDERR if RAILS_GROUPS=assets.
|
195
|
+
* Version 0.3.0, all configuration can be managed via env variables, improve docs on configuration
|
196
|
+
|
197
|
+
|
198
|
+
## v0.3.0 / 2012-03-07
|
199
|
+
|
200
|
+
Version 0.3.0 (David Rice <me@davidjrice.co.uk>)
|
201
|
+
|
202
|
+
Changes:
|
203
|
+
|
204
|
+
* 10 Nominal Changes
|
205
|
+
|
206
|
+
* Merge pull request #50 from hampei/master
|
207
|
+
|
208
|
+
made gzip_compression settable via ENV
|
209
|
+
* namespaced the ENV gzip option: ASSET_SYNC_GZIP_COMPRESSION. added option to readme
|
210
|
+
* made gzip_compression settable via ENV
|
211
|
+
* Typo
|
212
|
+
* Improve documentation
|
213
|
+
* Version 0.2.12, fix the asset_sync rake task enhancement in Rails 3.2 (still supporting earlier releases)
|
214
|
+
* Turns out this was an issue with Rails handling of the config.assets.digest parameter
|
215
|
+
* When running rake assets:precompile this config variable is modified by Rails
|
216
|
+
* So it therefore cannot be depended on to test wether to enhance the nondigest task or not
|
217
|
+
* The solution is to always enhance assets:precompile:nondigest if it exists.
|
218
|
+
|
219
|
+
|
220
|
+
## v0.2.9 / 2012-01-30
|
221
|
+
|
222
|
+
Version 0.2.9 (David Rice <me@davidjrice.co.uk>)
|
223
|
+
|
224
|
+
Changes:
|
225
|
+
|
226
|
+
* 3 Nominal Changes
|
227
|
+
|
228
|
+
* Merge pull request #42 from genuitytech/master
|
229
|
+
|
230
|
+
Now correctly setting config.fog_region.
|
231
|
+
* Now correctly setting config.fog_region.
|
232
|
+
* Version 0.2.8, improve http headers. Add far future expires and cache control, public.
|
233
|
+
|
234
|
+
|
235
|
+
## v0.2.8 / 2012-01-27
|
236
|
+
|
237
|
+
Version 0.2.8 (David Rice <me@davidjrice.co.uk>)
|
238
|
+
|
239
|
+
Changes:
|
240
|
+
|
241
|
+
* 2 Nominal Changes
|
242
|
+
|
243
|
+
* Add far future expires header
|
244
|
+
* Version 0.2.7, Rails 3.2 compatibility, default Rake task improved
|
245
|
+
|
246
|
+
|
247
|
+
## v0.2.7 / 2012-01-25
|
248
|
+
|
249
|
+
Version 0.2.7 (David Rice <me@davidjrice.co.uk>)
|
250
|
+
|
251
|
+
Changes:
|
252
|
+
|
253
|
+
* 2 Nominal Changes
|
254
|
+
|
255
|
+
* Merge branch 'rails-3-2'
|
256
|
+
* Version 0.2.6, Rails 3.2 compatibility, default Rake task improved
|
257
|
+
|
258
|
+
|
259
|
+
## v0.2.6 / 2012-01-25
|
260
|
+
|
261
|
+
Version 0.2.6 (David Rice <me@davidjrice.co.uk>)
|
262
|
+
|
263
|
+
Changes:
|
264
|
+
|
265
|
+
* 3 Nominal Changes
|
266
|
+
|
267
|
+
* Doc
|
268
|
+
* Add Rails 3.2 compatible rake task
|
269
|
+
* Fix issue #38 for when Rails.config.assets.prefix starts with a slash.
|
270
|
+
|
271
|
+
|
272
|
+
## v0.2.5 / 2012-01-10
|
273
|
+
|
274
|
+
Version 0.2.5 (David Rice <me@davidjrice.co.uk>)
|
275
|
+
|
276
|
+
Changes:
|
277
|
+
|
278
|
+
* 1 Nominal Changes
|
279
|
+
|
280
|
+
* Version 0.2.4, Support for Rails.config.assets.prefix
|
281
|
+
|
282
|
+
|
283
|
+
## v0.2.4 / 2012-01-06
|
284
|
+
|
285
|
+
Version 0.2.4 (David Rice <me@davidjrice.co.uk>)
|
286
|
+
|
287
|
+
Changes:
|
288
|
+
|
289
|
+
* 5 Nominal Changes
|
290
|
+
|
291
|
+
* Merge pull request #35 from siliconsalad/config_assets_prefix
|
292
|
+
|
293
|
+
Rails.config.assets.prefix used for sync
|
294
|
+
* added test with Rails.config.assets.prefix set
|
295
|
+
* Rails.config.assets.prefix used for sync (instead of hardcoded 'assets' value)
|
296
|
+
* specs now use shared context to mock Rails and fixed pending tests that were failing
|
297
|
+
* Version 0.2.3, Rackspace London support
|
298
|
+
|
299
|
+
|
300
|
+
## v0.2.3 / 2011-12-06
|
301
|
+
|
302
|
+
Version 0.2.3 (David Rice <me@davidjrice.co.uk>)
|
303
|
+
|
304
|
+
Changes:
|
305
|
+
|
306
|
+
* 3 Nominal Changes
|
307
|
+
|
308
|
+
* Merge pull request #28 from robink/master
|
309
|
+
|
310
|
+
Rackspace London support
|
311
|
+
* Only merge racksace_auth_url to fog config if defined
|
312
|
+
* Bump date for release
|
313
|
+
|
314
|
+
|
315
|
+
## v0.2.2 / 2011-11-29
|
316
|
+
|
317
|
+
Version 0.2.2 (David Rice <me@davidjrice.co.uk>)
|
318
|
+
|
319
|
+
Changes:
|
320
|
+
|
321
|
+
* 10 Nominal Changes
|
322
|
+
|
323
|
+
* Version 0.2.2: add fail_silently config option to avoid heroku installing the rails31_enable_runtime_asset_compilation, fixes issues #24, #29
|
324
|
+
* Further explanation of fail_silently option
|
325
|
+
* Merge pull request #29 from neilmiddleton/master
|
326
|
+
|
327
|
+
Allow precompile to fail quietly on heroku
|
328
|
+
* Update README, and generator templates
|
329
|
+
* Changes as discussed in PR#29
|
330
|
+
* Disable pre-compilation on Heroku.
|
331
|
+
* Updated README and generators
|
332
|
+
* Added support for specifying rackspace_auth_url (then the possibility to use Rackspace London)
|
333
|
+
* Fixed typo in readme
|
334
|
+
* Updated version and release date
|
335
|
+
|
336
|
+
|
337
|
+
## v0.2.12 / 2012-03-04
|
338
|
+
|
339
|
+
Version 0.2.12 (David Rice <me@davidjrice.co.uk>)
|
340
|
+
|
341
|
+
Changes:
|
342
|
+
|
343
|
+
* 1 Nominal Changes
|
344
|
+
|
345
|
+
* Version 0.2.11, minor fix to YAML loading and improved docs
|
346
|
+
|
347
|
+
|
348
|
+
## v0.2.11 / 2012-03-04
|
349
|
+
|
350
|
+
Version 0.2.11 (David Rice <me@davidjrice.co.uk>)
|
351
|
+
|
352
|
+
Changes:
|
353
|
+
|
354
|
+
* 7 Nominal Changes
|
355
|
+
|
356
|
+
* Merge pull request #48 from samsoffes/patch-1
|
357
|
+
|
358
|
+
Fix Heroku Labs plugin URL and add code coloring to readme.
|
359
|
+
* Fix Heroku Labs plugin URL and add code coloring to readme.
|
360
|
+
* Merge pull request #47 from dbalatero/dont_read_yml_file_every_time
|
361
|
+
|
362
|
+
Cache the YML config to avoid multiple file reads.
|
363
|
+
* Cache the YML config to avoid multiple file reads.
|
364
|
+
* Fix documentation typos
|
365
|
+
* Move old known issues about heroku ENV variables to a docs folder, write new content referencing the recommended use of user_env_compile
|
366
|
+
* Version 0.2.10, fix handling of non standard Rails.config.assets.manifest path
|
367
|
+
|
368
|
+
|
369
|
+
## v0.2.10 / 2012-02-16
|
370
|
+
|
371
|
+
Version 0.2.10 (David Rice <me@davidjrice.co.uk>)
|
372
|
+
|
373
|
+
Changes:
|
374
|
+
|
375
|
+
* 5 Nominal Changes
|
376
|
+
|
377
|
+
* Add an AssetSync.log method for outputing sync config failure so we can stub it out easily in tests
|
378
|
+
* Merge pull request #44 from dbalatero/fix_nonstandard_manifest_location
|
379
|
+
|
380
|
+
Fixes asset_sync to correctly read manifest.yml files.
|
381
|
+
* Fixes asset_sync to correctly read manifest.yml files.
|
382
|
+
|
383
|
+
Rails.config.assets.manifest only points to the directory that contains
|
384
|
+
the manifest.yml file:
|
385
|
+
|
386
|
+
https://github.com/rails/rails/blob/226783d1e8891a38d4a61017952528970dba903d/actionpack/lib/sprockets/railtie.rb#L36
|
387
|
+
* Add hack, seems required for some applications on push to Heroku, not for others
|
388
|
+
* Version 0.2.9 fix bug in internal initializer
|
389
|
+
|
390
|
+
|
391
|
+
## v0.2.1 / 2011-11-21
|
392
|
+
|
393
|
+
Version 0.2.1 (Phil <phil.mcclure@gmail.com>)
|
394
|
+
|
395
|
+
Changes:
|
396
|
+
|
397
|
+
* 4 Nominal Changes
|
398
|
+
|
399
|
+
* Only configure with ENV vars if initializer and yml file do not exist
|
400
|
+
* Typo in yaml, underscore need not be escaped here
|
401
|
+
* Fix readme
|
402
|
+
* Version 0.2.0
|
403
|
+
|
404
|
+
|
405
|
+
## v0.2.0 / 2011-11-15
|
406
|
+
|
407
|
+
Version 0.2.0 (David Rice <me@davidjrice.co.uk>)
|
408
|
+
|
409
|
+
Changes:
|
410
|
+
|
411
|
+
* 15 Nominal Changes
|
412
|
+
|
413
|
+
* Add upgrade notice to README
|
414
|
+
* Use fog directory
|
415
|
+
* Merge
|
416
|
+
* Fix readme
|
417
|
+
* Tidy readme
|
418
|
+
* Get AWS or Rackspace generators working correctly
|
419
|
+
* Remove generated rake task, no need
|
420
|
+
* Improve generators to generate AWS or Rackspace compatible initializer or yml
|
421
|
+
* Prepare 0.2.0 for release
|
422
|
+
* Convert readme and generators to new config options
|
423
|
+
* Fix fog_options
|
424
|
+
* Fix typo
|
425
|
+
* Fix bug
|
426
|
+
* Working on migrating the exposed config variables to reflect fog, add in a start on rackspace support. Write more specs, tidy up and document config
|
427
|
+
* Add specs for manifest config
|
428
|
+
|
429
|
+
|
430
|
+
## v0.1.9 / 2011-11-06
|
431
|
+
|
432
|
+
Version 0.1.9 (David Rice <me@davidjrice.co.uk>)
|
433
|
+
|
434
|
+
Changes:
|
435
|
+
|
436
|
+
* 37 Nominal Changes
|
437
|
+
|
438
|
+
* Document gzip compression
|
439
|
+
* Add note about gzip_compression
|
440
|
+
* Add spec to test config defaults gzip_compression to false
|
441
|
+
* Add gzip compression info to generated asset_sync.rb or .yml. Fix .yml example with new config settings
|
442
|
+
* Update gemspec
|
443
|
+
* Update docs to note that rake task is no longer generated within the app.
|
444
|
+
* Add todo
|
445
|
+
* Add % symbol for clarity
|
446
|
+
* Output % savings when uploading gzipped files. Only use gzipped files if the compressed version is actually smaller than the original.
|
447
|
+
* Tidy readme
|
448
|
+
* Get AWS or Rackspace generators working correctly
|
449
|
+
* Remove generated rake task, no need
|
450
|
+
* Improve generators to generate AWS or Rackspace compatible initializer or yml
|
451
|
+
* Prepare 0.2.0 for release
|
452
|
+
* Convert readme and generators to new config options
|
453
|
+
* Fix fog_options
|
454
|
+
* Fix bug
|
455
|
+
* Fix typo
|
456
|
+
* Working on migrating the exposed config variables to reflect fog, add in a start on rackspace support. Write more specs, tidy up and document config
|
457
|
+
* Add spec for gzip? config method
|
458
|
+
* Reorder logic to execute quicker if gzip? compression disabled and ignore .gz uploads correctly
|
459
|
+
* Ignore .gz assets if we are in gzip_compression mode
|
460
|
+
* Do not set a Vary: Accept-Encoding header, S3 does not support at all
|
461
|
+
* Try setting vary header a different way
|
462
|
+
* Set http header Vary: Accept-Encoding when storing gzipped assets to S3
|
463
|
+
* Add todo
|
464
|
+
* Refactor to computed path
|
465
|
+
* Add path
|
466
|
+
* Instead of overwriting the original file when processing the .gz, overwrite the original if a gz file exists to avoid any issues with whichever order files are processed in
|
467
|
+
* Bump version (no release just yet)
|
468
|
+
* Only handle gzip files specially if we have configured gzip_compression
|
469
|
+
* Overwrite original files with gzipped equivalent, improve logging to show GZIP in action, make it a configurable option, config.gzip_compression that defaults to false
|
470
|
+
* Upload GZIP compressed assets nicely to S3 with correct content type and encoding.
|
471
|
+
* Refactor upload method to make enhancing nicer
|
472
|
+
* Merge pull request #12 from bobbrez/master
|
473
|
+
|
474
|
+
Minor correction to README for generated YAML file path.
|
475
|
+
* Correcting location of generated yml in README
|
476
|
+
* Comment out unnecessary logic for now
|
477
|
+
|
478
|
+
|
479
|
+
## v0.1.8 / 2011-10-17
|
480
|
+
|
481
|
+
Version 0.1.8 (David Rice <me@davidjrice.co.uk>)
|
482
|
+
|
483
|
+
Changes:
|
484
|
+
|
485
|
+
* 4 Nominal Changes
|
486
|
+
|
487
|
+
* Don't log any debugging info v0.1.8 should add a debug mode in future
|
488
|
+
* Fix specs, only require asset_sync engine and railtie if Rails is initialized
|
489
|
+
* Improve docs
|
490
|
+
* Tidy up for release of Rails 3.1.1 support.
|
491
|
+
|
492
|
+
|
493
|
+
## v0.1.7 / 2011-10-15
|
494
|
+
|
495
|
+
Version 0.1.7 (David Rice <me@davidjrice.co.uk>)
|
496
|
+
|
497
|
+
Changes:
|
498
|
+
|
499
|
+
* 6 Nominal Changes
|
500
|
+
|
501
|
+
* Merge pull request #7 from hone/6_rails3.1.1
|
502
|
+
|
503
|
+
Rails 3.1.1 Compatability
|
504
|
+
* rails 3.1.1 support
|
505
|
+
* fix typo
|
506
|
+
* Update the generated yml config with a staging environment, use defaults more. Engine within asset sync doesn't appear to be ran even with :group => :assets in the definition. Add railtie to allow setting config.asset_sync configuration within a rails application.rb, this and moving the initializer style of config seems to work for Rails 3.1.1, also so does purely relying on the YAML config
|
507
|
+
* New version of asset_sync to work around Rails 3.1.1 issues. Test if config/initializers/asset_sync.rb exists and load that, otherwise provide a default initializer that is configurable with environment variables. Then merge in settings if config/asset_sync.yml is found. Add the asset_sync.rake in to lib/tasks so it is autoloaded and don't bother generating it anymore
|
508
|
+
* Bugfix
|
509
|
+
|
510
|
+
|
511
|
+
## v0.1.6 / 2011-09-26
|
512
|
+
|
513
|
+
Version 0.1.6 (David Rice <me@davidjrice.co.uk>)
|
514
|
+
|
515
|
+
Changes:
|
516
|
+
|
517
|
+
* 1 Nominal Changes
|
518
|
+
|
519
|
+
* Fix gemfile
|
520
|
+
|
521
|
+
|
522
|
+
## v0.1.5 / 2011-09-26
|
523
|
+
|
524
|
+
Version 0.1.5 (David Rice <me@davidjrice.co.uk>)
|
525
|
+
|
526
|
+
Changes:
|
527
|
+
|
528
|
+
* 5 Nominal Changes
|
529
|
+
|
530
|
+
* Should raise storage error if AWS S3 bucket is not found. Version 0.1.5
|
531
|
+
* explain further
|
532
|
+
* Merge branch 'master' of github.com:rumblelabs/asset_sync
|
533
|
+
* List known issues with heroku and possible work arounds
|
534
|
+
* Should raise error with no configuration
|
535
|
+
|
536
|
+
|
537
|
+
## v0.1.4 / 2011-08-30
|
538
|
+
|
539
|
+
Version 0.1.4 (David Rice <me@davidjrice.co.uk>)
|
540
|
+
|
541
|
+
Changes:
|
542
|
+
|
543
|
+
* 2 Nominal Changes
|
544
|
+
|
545
|
+
* Require dependancy of active_model, add config validation, better specs, version 0.1.4
|
546
|
+
* Tidied up read me with a DRYer use of AWS_BUCKET for asset_host.
|
547
|
+
|
548
|
+
|
549
|
+
## v0.1.3 / 2011-08-27
|
550
|
+
|
551
|
+
Version 0.1.3 (Simon Hamilton <shamilton@rumblelabs.com>)
|
552
|
+
|
553
|
+
Changes:
|
554
|
+
|
555
|
+
* 1 Nominal Changes
|
556
|
+
|
557
|
+
* Bump version for release
|
558
|
+
|
559
|
+
|
560
|
+
## v0.1.2 / 2011-08-25
|
561
|
+
|
562
|
+
Version 0.1.2 (Simon Hamilton <shamilton@rumblelabs.com>)
|
563
|
+
|
564
|
+
Changes:
|
565
|
+
|
566
|
+
* 2 Nominal Changes
|
567
|
+
|
568
|
+
* Removed public from cache control. May be causing a problem with uploads
|
569
|
+
* Bump version for release
|
570
|
+
|
571
|
+
|
572
|
+
## v0.1.10 / 2011-11-15
|
573
|
+
|
574
|
+
Version 0.1.10 (David Rice <me@davidjrice.co.uk>)
|
575
|
+
|
576
|
+
Changes:
|
577
|
+
|
578
|
+
* 7 Nominal Changes
|
579
|
+
|
580
|
+
* Improve manifest configuration by making it a boolean option only, it will automatically use the configured manifest path if different from the default. Add documentation to readme about the new option and upgrade generated configs.
|
581
|
+
* Merge pull request #20 from agworld/e26f5ca36dee1c2196653268ed6bb38c0226e4d2
|
582
|
+
|
583
|
+
Fixes issues #16, #17, #18 and #19
|
584
|
+
* fixes https://github.com/rumblelabs/asset_sync/issues/19
|
585
|
+
* Implements https://github.com/rumblelabs/asset_sync/issues/17
|
586
|
+
* fixes https://github.com/rumblelabs/asset_sync/issues/18
|
587
|
+
* fixes https://github.com/rumblelabs/asset_sync/issues/16
|
588
|
+
* Merge branch 'gzip-compression'
|
589
|
+
|
590
|
+
|
591
|
+
## v0.1.1 / 2011-08-24
|
592
|
+
|
593
|
+
Version 0.1.1 (Simon Hamilton <shamilton@rumblelabs.com>)
|
594
|
+
|
595
|
+
Changes:
|
596
|
+
|
597
|
+
* 5 Nominal Changes
|
598
|
+
|
599
|
+
* Merge pull request #4 from jsmestad/patch-1
|
600
|
+
|
601
|
+
[BUGFIX] Add support for 'existing_remote_files' configuration in YAML fi
|
602
|
+
* Verbose output about the delete process.
|
603
|
+
* Condense logic on keep
|
604
|
+
* [BUGFIX] Add support for 'existing_remote_files' configuration in YAML file.
|
605
|
+
* Version 0.1.0 ready
|
606
|
+
|
607
|
+
|
608
|
+
## v0.1.0 / 2011-08-22
|
609
|
+
|
610
|
+
Version 0.1.0 (David Rice <me@davidjrice.co.uk>)
|
611
|
+
|
612
|
+
Changes:
|
613
|
+
|
614
|
+
* 1 Nominal Changes
|
615
|
+
|
616
|
+
* Merge 0.0.7 from master into new refactor branch
|
617
|
+
|
618
|
+
|
619
|
+
## v0.0.7 / 2011-08-22
|
620
|
+
|
621
|
+
Version 0.0.7 (David Rice <me@davidjrice.co.uk>)
|
622
|
+
|
623
|
+
Changes:
|
624
|
+
|
625
|
+
* 9 Nominal Changes
|
626
|
+
|
627
|
+
* Added Cache-control header (1 year, public) on uploaded files
|
628
|
+
* Update README to reflect new configuration styles
|
629
|
+
* Extract all file manipulation methods to a storage class, update generator templates, fix a few bugs.
|
630
|
+
* Config class working, specs added, still @wip
|
631
|
+
* Refactoring
|
632
|
+
* Get config working and loading yml or the initializer
|
633
|
+
* small additions
|
634
|
+
* @wip working on extracting out a configuration class and allow config via an initializer alone, also support yml file usage for when that is useful
|
635
|
+
* merge config changes
|
636
|
+
|
637
|
+
|
638
|
+
## v0.0.6 / 2011-08-06
|
639
|
+
|
640
|
+
Version 0.0.6 (Simon Hamilton <shamilton@rumblelabs.com>)
|
641
|
+
|
642
|
+
Changes:
|
643
|
+
|
644
|
+
* 1 Nominal Changes
|
645
|
+
|
646
|
+
* Include ERB template rendering of yml. v0.0.5
|
647
|
+
|
648
|
+
|
649
|
+
## v0.0.5 / 2011-08-05
|
650
|
+
|
651
|
+
Version 0.0.5 (David Rice <me@davidjrice.co.uk>)
|
652
|
+
|
653
|
+
Changes:
|
654
|
+
|
655
|
+
* 3 Nominal Changes
|
656
|
+
|
657
|
+
* now it parses the YAML file with ERB.
|
658
|
+
* Set gem date for release
|
659
|
+
* 0.0.4 Release
|
660
|
+
|
661
|
+
|
662
|
+
## v0.0.4 / 2011-08-05
|
663
|
+
|
664
|
+
Version 0.0.4 (David Rice <me@davidjrice.co.uk>)
|
665
|
+
|
666
|
+
|
667
|
+
## v0.0.3 / 2011-07-31
|
668
|
+
|
669
|
+
Version 0.0.3 (David Rice <me@davidjrice.co.uk>)
|
670
|
+
|
671
|
+
Changes:
|
672
|
+
|
673
|
+
* 1 Nominal Changes
|
674
|
+
|
675
|
+
* Added homepage to gemspec
|
676
|
+
|
677
|
+
|
678
|
+
## v0.0.2 / 2011-07-31
|
679
|
+
|
680
|
+
Version 0.0.2 (Simon Hamilton <shamilton@rumblelabs.com>)
|
681
|
+
|
682
|
+
Changes:
|
683
|
+
|
684
|
+
* 7 Nominal Changes
|
685
|
+
|
686
|
+
* Added a rails generator to install the rake task and the config. Just do "rails generate asset_sync:install"
|
687
|
+
* Updated readme
|
688
|
+
* Getting ready to release the gem
|
689
|
+
* Revert "remove version file"
|
690
|
+
|
691
|
+
This reverts commit 7ebd853947b8d5f3b6e81f96535dfce843f2c855.
|
692
|
+
* remove version file
|
693
|
+
* Initial commit
|
694
|
+
* Initial commit
|
695
|
+
|
696
|
+
|
697
|
+
## HEAD / 2012-08-27
|
698
|
+
|
699
|
+
Current Development (David Rice)
|
700
|
+
|
701
|
+
Changes:
|
702
|
+
|
703
|
+
* 2 Nominal Changes
|
704
|
+
|
705
|
+
* Improve documentation on ignored_files config option
|
706
|
+
* Merge branch 'sinatra'
|
707
|
+
|
data/README.md
CHANGED
@@ -17,9 +17,9 @@ If you are upgrading from a version of asset_sync **< 0.2.0** (i.e. 0.1.x). All
|
|
17
17
|
|
18
18
|
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 centre article](http://devcenter.heroku.com/articles/cdn-asset-host-rails31).
|
19
19
|
|
20
|
-
Now to get everything working smoothly with using **ENV** variables to configure `asset_sync` we just need to enable the [user
|
20
|
+
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:
|
21
21
|
|
22
|
-
heroku labs:enable
|
22
|
+
heroku labs:enable user-env-compile -a myapp
|
23
23
|
|
24
24
|
Hopefully this will make it's way into the platform as standard.
|
25
25
|
|
@@ -63,6 +63,15 @@ S3 as the asset host and ensure precompiling is enabled.
|
|
63
63
|
config.action_controller.asset_host = "//#{ENV['FOG_DIRECTORY']}.s3.amazonaws.com"
|
64
64
|
```
|
65
65
|
|
66
|
+
Or, to use Google Storage Cloud, configure as this.
|
67
|
+
|
68
|
+
``` ruby
|
69
|
+
#config/environments/production.rb
|
70
|
+
config.action_controller.asset_host = "//#{ENV['FOG_DIRECTORY']}.storage.googleapis.com"
|
71
|
+
```
|
72
|
+
|
73
|
+
|
74
|
+
|
66
75
|
On **HTTPS**: the exclusion of any protocol in the asset host declaration above will allow browsers to choose the transport mechanism on the fly. So if your application is available under both HTTP and HTTPS the assets will be served to match.
|
67
76
|
|
68
77
|
> The only caveat with this is that your S3 bucket name **must not contain any periods** so, mydomain.com.s3.amazonaws.com for example would not work under HTTPS as SSL certificates from Amazon would interpret our bucket name as **not** a subdomain of s3.amazonaws.com, but a multi level subdomain. To avoid this don't use a period in your subdomain or switch to the other style of S3 URL.
|
@@ -70,12 +79,21 @@ On **HTTPS**: the exclusion of any protocol in the asset host declaration above
|
|
70
79
|
``` ruby
|
71
80
|
config.action_controller.asset_host = "//s3.amazonaws.com/#{ENV['FOG_DIRECTORY']}"
|
72
81
|
```
|
82
|
+
Or
|
83
|
+
|
84
|
+
``` ruby
|
85
|
+
config.action_controller.asset_host = "//storage.googleapis.com/#{ENV['FOG_DIRECTORY']}"
|
86
|
+
```
|
73
87
|
|
74
88
|
Also, ensure the following are defined (in production.rb or application.rb)
|
75
89
|
|
76
90
|
* **config.assets.digest** is set to **true**.
|
77
91
|
* **config.assets.enabled** is set to **true**.
|
78
92
|
|
93
|
+
Additionally, if you depend on any configuration that is setup in your `initializers` you will need to ensure that
|
94
|
+
|
95
|
+
* **config.assets.initialize\_on\_precompile** is set to **true**
|
96
|
+
|
79
97
|
### AssetSync
|
80
98
|
|
81
99
|
**AssetSync** supports the following methods of configuration.
|
@@ -128,6 +146,14 @@ heroku config:add FOG_DIRECTORY=xxxx
|
|
128
146
|
heroku config:add FOG_PROVIDER=Rackspace
|
129
147
|
```
|
130
148
|
|
149
|
+
Google Storage Cloud configuration is supported as well
|
150
|
+
``` bash
|
151
|
+
heroku config:add FOG_PROVIDER=Google
|
152
|
+
heroku config:add GOOGLE_STORAGE_ACCESS_KEY_ID=xxxx
|
153
|
+
heroku config:add GOOGLE_STORAGE_SECRET_ACCESS_KEY=xxxx
|
154
|
+
heroku config:add FOG_DIRECTORY=xxxx
|
155
|
+
```
|
156
|
+
|
131
157
|
The Built-in Initializer also sets the AssetSync default for **existing_remote_files** to **keep**.
|
132
158
|
|
133
159
|
### Custom Rails Initializer (config/initializers/asset_sync.rb)
|
@@ -197,7 +223,7 @@ defaults: &defaults
|
|
197
223
|
# note: You will still need to expire them from the CDN's edge cache locations
|
198
224
|
# always_upload: ['application.js', 'application.css']
|
199
225
|
# Ignored files. Useful if there are some files that are created dynamically on the server and you don't want to upload on deploy.
|
200
|
-
# ignored_files: ['ignore_me.js',
|
226
|
+
# ignored_files: ['ignore_me.js', !ruby/regexp '/ignore_some/\d{32}\.css/']
|
201
227
|
|
202
228
|
development:
|
203
229
|
<<: *defaults
|
@@ -229,6 +255,8 @@ AssetSync.config.gzip_compression == ENV['ASSET_SYNC_GZIP_COMPRESSION']
|
|
229
255
|
* **gzip\_compression**: (`true, false`) when enabled, will automatically replace files that have a gzip compressed equivalent with the compressed version. **default:** `'false'`
|
230
256
|
* **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'`
|
231
257
|
* **enabled**: (`true, false`) when false, will disable asset sync. **default:** `'true'` (enabled)
|
258
|
+
* **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**: `[]`
|
259
|
+
|
232
260
|
|
233
261
|
#### Fog (Required)
|
234
262
|
* **fog\_provider**: your storage provider *AWS* (S3) or *Rackspace* (Cloud Files) or *Google* (Google Storage)
|
data/Rakefile
CHANGED
@@ -1,6 +1,19 @@
|
|
1
1
|
require 'bundler/gem_tasks'
|
2
2
|
require 'rspec/core/rake_task'
|
3
3
|
|
4
|
-
|
4
|
+
namespace :spec do
|
5
|
+
RSpec::Core::RakeTask.new(:unit) do |spec|
|
6
|
+
spec.pattern = 'spec/unit/*_spec.rb'
|
7
|
+
spec.rspec_opts = ['--backtrace']
|
8
|
+
end
|
9
|
+
RSpec::Core::RakeTask.new(:integration) do |spec|
|
10
|
+
spec.pattern = 'spec/integration/*_spec.rb'
|
11
|
+
spec.rspec_opts = ['--backtrace']
|
12
|
+
end
|
13
|
+
task :all do
|
14
|
+
Rake::Task['spec:unit'].execute
|
15
|
+
Rake::Task['spec:integration'].execute
|
16
|
+
end
|
17
|
+
end
|
5
18
|
|
6
|
-
task :default => :
|
19
|
+
task :default => 'spec:all'
|
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 = "
|
9
|
+
s.date = "2013-01-07"
|
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"]
|
@@ -22,6 +22,10 @@ Gem::Specification.new do |s|
|
|
22
22
|
s.add_development_dependency "rspec"
|
23
23
|
s.add_development_dependency "bundler"
|
24
24
|
s.add_development_dependency "jeweler"
|
25
|
+
|
26
|
+
s.add_development_dependency "rails"
|
27
|
+
s.add_development_dependency "uglifier"
|
28
|
+
s.add_development_dependency "asset_sync"
|
25
29
|
|
26
30
|
s.files = `git ls-files`.split("\n")
|
27
31
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
data/lib/asset_sync/engine.rb
CHANGED
@@ -1,42 +1,52 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
1
|
+
module AssetSync
|
2
|
+
class Engine < Rails::Engine
|
3
|
+
|
4
|
+
engine_name "asset_sync"
|
5
|
+
|
6
|
+
initializer "asset_sync config", :group => :all do |app|
|
7
|
+
app_initializer = Rails.root.join('config', 'initializers', 'asset_sync.rb').to_s
|
8
|
+
app_yaml = Rails.root.join('config', 'asset_sync.yml').to_s
|
9
|
+
|
10
|
+
if File.exists?( app_initializer )
|
11
|
+
AssetSync.log "AssetSync: using #{app_initializer}"
|
12
|
+
load app_initializer
|
13
|
+
elsif !File.exists?( app_initializer ) && !File.exists?( app_yaml )
|
14
|
+
AssetSync.log "AssetSync: using default configuration from built-in initializer"
|
15
|
+
AssetSync.configure do |config|
|
16
|
+
config.fog_provider = ENV['FOG_PROVIDER']
|
17
|
+
config.fog_directory = ENV['FOG_DIRECTORY']
|
18
|
+
config.fog_region = ENV['FOG_REGION']
|
19
|
+
|
20
|
+
config.aws_access_key_id = ENV['AWS_ACCESS_KEY_ID']
|
21
|
+
config.aws_secret_access_key = ENV['AWS_SECRET_ACCESS_KEY']
|
22
|
+
|
23
|
+
config.rackspace_username = ENV['RACKSPACE_USERNAME']
|
24
|
+
config.rackspace_api_key = ENV['RACKSPACE_API_KEY']
|
25
|
+
|
26
|
+
config.google_storage_access_key_id = ENV['GOOGLE_STORAGE_ACCESS_KEY_ID']
|
27
|
+
config.google_storage_secret_access_key = ENV['GOOGLE_STORAGE_SECRET_ACCESS_KEY']
|
28
|
+
|
29
|
+
if ENV.has_key? 'ASSET_SYNC_ENABLED'
|
30
|
+
config.enabled = ENV['ASSET_SYNC_ENABLED'] == 'true'
|
31
|
+
end
|
32
|
+
config.existing_remote_files = ENV['ASSET_SYNC_EXISTING_REMOTE_FILES'] || "keep"
|
33
|
+
config.gzip_compression = ENV['ASSET_SYNC_GZIP_COMPRESSION'] == 'true'
|
34
|
+
config.manifest = ENV['ASSET_SYNC_MANIFEST'] == 'true'
|
35
|
+
end
|
27
36
|
|
28
|
-
if ENV.has_key? '
|
29
|
-
config.
|
37
|
+
if ENV.has_key? 'ASSET_SYNC_PREFIX'
|
38
|
+
config.prefix = ENV['ASSET_SYNC_PREFIX']
|
30
39
|
end
|
31
40
|
config.existing_remote_files = ENV['ASSET_SYNC_EXISTING_REMOTE_FILES'] || "keep"
|
32
41
|
config.gzip_compression = ENV['ASSET_SYNC_GZIP_COMPRESSION'] == 'true'
|
33
42
|
config.manifest = ENV['ASSET_SYNC_MANIFEST'] == 'true'
|
43
|
+
|
34
44
|
end
|
35
|
-
end
|
36
45
|
|
37
|
-
|
38
|
-
|
46
|
+
if File.exists?( app_yaml )
|
47
|
+
AssetSync.log "AssetSync: YAML file found #{app_yaml} settings will be merged into the configuration"
|
48
|
+
end
|
39
49
|
end
|
40
|
-
end
|
41
50
|
|
51
|
+
end
|
42
52
|
end
|
data/lib/asset_sync/storage.rb
CHANGED
@@ -105,12 +105,15 @@ module AssetSync
|
|
105
105
|
def upload_file(f)
|
106
106
|
# TODO output files in debug logs as asset filename only.
|
107
107
|
one_year = 31557600
|
108
|
+
ext = File.extname(f)[1..-1]
|
109
|
+
mime = Mime::Type.lookup_by_extension(ext)
|
108
110
|
file = {
|
109
111
|
:key => f,
|
110
112
|
:body => File.open("#{path}/#{f}"),
|
111
113
|
:public => true,
|
112
114
|
:cache_control => "public, max-age=#{one_year}",
|
113
|
-
:expires => CGI.rfc1123_date(Time.now + one_year)
|
115
|
+
:expires => CGI.rfc1123_date(Time.now + one_year),
|
116
|
+
:content_type => mime
|
114
117
|
}
|
115
118
|
|
116
119
|
gzipped = "#{path}/#{f}.gz"
|
@@ -127,12 +130,9 @@ module AssetSync
|
|
127
130
|
|
128
131
|
if gzipped_size < original_size
|
129
132
|
percentage = ((gzipped_size.to_f/original_size.to_f)*100).round(2)
|
130
|
-
ext = File.extname( f )[1..-1]
|
131
|
-
mime = Mime::Type.lookup_by_extension( ext )
|
132
133
|
file.merge!({
|
133
134
|
:key => f,
|
134
135
|
:body => File.open(gzipped),
|
135
|
-
:content_type => mime,
|
136
136
|
:content_encoding => 'gzip'
|
137
137
|
})
|
138
138
|
log "Uploading: #{gzipped} in place of #{f} saving #{percentage}%"
|
data/lib/asset_sync/version.rb
CHANGED
@@ -27,12 +27,15 @@ defaults: &defaults
|
|
27
27
|
|
28
28
|
development:
|
29
29
|
<<: *defaults
|
30
|
+
enabled: false
|
30
31
|
|
31
32
|
test:
|
32
33
|
<<: *defaults
|
34
|
+
enabled: false
|
33
35
|
|
34
36
|
staging:
|
35
37
|
<<: *defaults
|
38
|
+
fog_directory: "<%= app_name %>-staging-assets"
|
36
39
|
|
37
40
|
production:
|
38
41
|
<<: *defaults
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
# require "rake"
|
3
|
+
ENV['RAILS_ROOT'] = File.dirname(__FILE__)
|
4
|
+
# Set up gems listed in the Gemfile.
|
5
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
|
6
|
+
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
|
7
|
+
# require 'rails/all'
|
8
|
+
require "action_controller/railtie"
|
9
|
+
require "sprockets/railtie"
|
10
|
+
if defined?(Bundler)
|
11
|
+
Bundler.require(*Rails.groups(:assets => %w(development test)))
|
12
|
+
end
|
13
|
+
module AssetSyncTest
|
14
|
+
class Application < Rails::Application
|
15
|
+
config.encoding = "utf-8"
|
16
|
+
config.filter_parameters += [:password]
|
17
|
+
config.assets.enabled = true
|
18
|
+
config.assets.version = '1.0'
|
19
|
+
config.secret_token = 'bf196b4383deefa4e0120a6ef1d9af1cc45f5c4ebd04405'
|
20
|
+
config.session_store :cookie_store, :key => '_asset_sync_test_session', :secret => 'xxxx'
|
21
|
+
config.active_support.deprecation = :log
|
22
|
+
config.assets.compress = true
|
23
|
+
config.assets.digest = true
|
24
|
+
config.assets.prefix = ENV['ASSET_SYNC_PREFIX']
|
25
|
+
end
|
26
|
+
end
|
27
|
+
AssetSyncTest::Application.initialize!
|
28
|
+
AssetSyncTest::Application.load_tasks
|
29
|
+
# Rake::Task['assets:precompile:all'].invoke
|
@@ -0,0 +1 @@
|
|
1
|
+
console.log("hello");
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
+
|
3
|
+
def bucket(name)
|
4
|
+
options = {
|
5
|
+
:provider => 'AWS',
|
6
|
+
:aws_access_key_id => ENV['AWS_ACCESS_KEY_ID'],
|
7
|
+
:aws_secret_access_key => ENV['AWS_SECRET_ACCESS_KEY']
|
8
|
+
}
|
9
|
+
|
10
|
+
connection = Fog::Storage.new(options)
|
11
|
+
connection.directories.get(ENV['FOG_DIRECTORY'], :prefix => name)
|
12
|
+
end
|
13
|
+
|
14
|
+
def execute(command)
|
15
|
+
app_path = File.expand_path("../../dummy_app", __FILE__)
|
16
|
+
Dir.chdir app_path
|
17
|
+
`#{command}`
|
18
|
+
end
|
19
|
+
|
20
|
+
describe "AssetSync" do
|
21
|
+
|
22
|
+
before(:each) do
|
23
|
+
@prefix = SecureRandom.hex(6)
|
24
|
+
end
|
25
|
+
|
26
|
+
after(:each) do
|
27
|
+
@directory = bucket(@prefix)
|
28
|
+
@directory.files.each do |f|
|
29
|
+
f.destroy
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
it "sync" do
|
34
|
+
execute "rake ASSET_SYNC_PREFIX=#{@prefix} assets:precompile"
|
35
|
+
bucket(@prefix).files.size.should == 5
|
36
|
+
end
|
37
|
+
|
38
|
+
it "sync with enabled=false" do
|
39
|
+
execute "rake ASSET_SYNC_PREFIX=#{@prefix} ASSET_SYNC_ENABLED=false assets:precompile"
|
40
|
+
bucket(@prefix).files.size.should == 0
|
41
|
+
end
|
42
|
+
|
43
|
+
it "sync with gzip_compression=true" do
|
44
|
+
execute "rake ASSET_SYNC_PREFIX=#{@prefix} ASSET_SYNC_GZIP_COMPRESSION=true assets:precompile"
|
45
|
+
bucket(@prefix).files.size.should == 3
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
|
data/spec/spec_helper.rb
CHANGED
@@ -50,5 +50,5 @@ shared_context "mock Rails without_yml" do
|
|
50
50
|
end
|
51
51
|
|
52
52
|
def set_rails_root(path)
|
53
|
-
Rails.stub(:root).and_return(Pathname.new(File.join(File.dirname(__FILE__), path)))
|
53
|
+
Rails.stub(:root).and_return(Pathname.new(File.join(File.dirname(__FILE__), 'fixtures', path)))
|
54
54
|
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: 0.5.
|
4
|
+
version: 0.5.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2013-01-07 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: fog
|
@@ -93,6 +93,54 @@ dependencies:
|
|
93
93
|
- - ! '>='
|
94
94
|
- !ruby/object:Gem::Version
|
95
95
|
version: '0'
|
96
|
+
- !ruby/object:Gem::Dependency
|
97
|
+
name: rails
|
98
|
+
requirement: !ruby/object:Gem::Requirement
|
99
|
+
none: false
|
100
|
+
requirements:
|
101
|
+
- - ! '>='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
none: false
|
108
|
+
requirements:
|
109
|
+
- - ! '>='
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
112
|
+
- !ruby/object:Gem::Dependency
|
113
|
+
name: uglifier
|
114
|
+
requirement: !ruby/object:Gem::Requirement
|
115
|
+
none: false
|
116
|
+
requirements:
|
117
|
+
- - ! '>='
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '0'
|
120
|
+
type: :development
|
121
|
+
prerelease: false
|
122
|
+
version_requirements: !ruby/object:Gem::Requirement
|
123
|
+
none: false
|
124
|
+
requirements:
|
125
|
+
- - ! '>='
|
126
|
+
- !ruby/object:Gem::Version
|
127
|
+
version: '0'
|
128
|
+
- !ruby/object:Gem::Dependency
|
129
|
+
name: asset_sync
|
130
|
+
requirement: !ruby/object:Gem::Requirement
|
131
|
+
none: false
|
132
|
+
requirements:
|
133
|
+
- - ! '>='
|
134
|
+
- !ruby/object:Gem::Version
|
135
|
+
version: '0'
|
136
|
+
type: :development
|
137
|
+
prerelease: false
|
138
|
+
version_requirements: !ruby/object:Gem::Requirement
|
139
|
+
none: false
|
140
|
+
requirements:
|
141
|
+
- - ! '>='
|
142
|
+
- !ruby/object:Gem::Version
|
143
|
+
version: '0'
|
96
144
|
description: After you run assets:precompile your compiled assets will be synchronised
|
97
145
|
with your S3 bucket.
|
98
146
|
email:
|
@@ -105,6 +153,7 @@ extra_rdoc_files: []
|
|
105
153
|
files:
|
106
154
|
- .gitignore
|
107
155
|
- .travis.yml
|
156
|
+
- CHANGELOG.md
|
108
157
|
- Gemfile
|
109
158
|
- README.md
|
110
159
|
- Rakefile
|
@@ -121,15 +170,18 @@ files:
|
|
121
170
|
- lib/generators/asset_sync/templates/asset_sync.rb
|
122
171
|
- lib/generators/asset_sync/templates/asset_sync.yml
|
123
172
|
- lib/tasks/asset_sync.rake
|
124
|
-
- spec/
|
125
|
-
- spec/
|
126
|
-
- spec/
|
127
|
-
- spec/google_with_yml/config/asset_sync.yml
|
128
|
-
- spec/
|
129
|
-
- spec/
|
130
|
-
- spec/railsless_spec.rb
|
173
|
+
- spec/dummy_app/Rakefile
|
174
|
+
- spec/dummy_app/app/assets/javascripts/application.js
|
175
|
+
- spec/fixtures/aws_with_yml/config/asset_sync.yml
|
176
|
+
- spec/fixtures/google_with_yml/config/asset_sync.yml
|
177
|
+
- spec/fixtures/rackspace_with_yml/config/asset_sync.yml
|
178
|
+
- spec/integration/aws_integration_spec.rb
|
131
179
|
- spec/spec_helper.rb
|
132
|
-
- spec/
|
180
|
+
- spec/unit/asset_sync_spec.rb
|
181
|
+
- spec/unit/google_spec.rb
|
182
|
+
- spec/unit/rackspace_spec.rb
|
183
|
+
- spec/unit/railsless_spec.rb
|
184
|
+
- spec/unit/storage_spec.rb
|
133
185
|
homepage: https://github.com/rumblelabs/asset_sync
|
134
186
|
licenses: []
|
135
187
|
post_install_message:
|
@@ -144,7 +196,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
144
196
|
version: '0'
|
145
197
|
segments:
|
146
198
|
- 0
|
147
|
-
hash:
|
199
|
+
hash: -3032835724923262885
|
148
200
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
149
201
|
none: false
|
150
202
|
requirements:
|
@@ -153,7 +205,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
153
205
|
version: '0'
|
154
206
|
segments:
|
155
207
|
- 0
|
156
|
-
hash:
|
208
|
+
hash: -3032835724923262885
|
157
209
|
requirements: []
|
158
210
|
rubyforge_project: asset_sync
|
159
211
|
rubygems_version: 1.8.24
|
@@ -162,12 +214,15 @@ specification_version: 3
|
|
162
214
|
summary: Synchronises Assets in a Rails 3 application and Amazon S3/Cloudfront and
|
163
215
|
Rackspace Cloudfiles
|
164
216
|
test_files:
|
165
|
-
- spec/
|
166
|
-
- spec/
|
167
|
-
- spec/
|
168
|
-
- spec/google_with_yml/config/asset_sync.yml
|
169
|
-
- spec/
|
170
|
-
- spec/
|
171
|
-
- spec/railsless_spec.rb
|
217
|
+
- spec/dummy_app/Rakefile
|
218
|
+
- spec/dummy_app/app/assets/javascripts/application.js
|
219
|
+
- spec/fixtures/aws_with_yml/config/asset_sync.yml
|
220
|
+
- spec/fixtures/google_with_yml/config/asset_sync.yml
|
221
|
+
- spec/fixtures/rackspace_with_yml/config/asset_sync.yml
|
222
|
+
- spec/integration/aws_integration_spec.rb
|
172
223
|
- spec/spec_helper.rb
|
173
|
-
- spec/
|
224
|
+
- spec/unit/asset_sync_spec.rb
|
225
|
+
- spec/unit/google_spec.rb
|
226
|
+
- spec/unit/rackspace_spec.rb
|
227
|
+
- spec/unit/railsless_spec.rb
|
228
|
+
- spec/unit/storage_spec.rb
|