asset_sync 0.5.4 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -9,4 +9,7 @@ coverage/*
9
9
  spec/dummy_app/public/*
10
10
  spec/dummy_app/log/*
11
11
  spec/dummy_app/tmp/*
12
- .rbx
12
+ .rbx
13
+ gemfiles/*.lock
14
+ .rvmrc
15
+ .idea
@@ -1,19 +1,34 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 1.8.7
4
- - 1.9.2
5
- - 1.9.3
6
- - jruby-18mode
7
- - jruby-19mode
8
- - rbx-18mode
9
- - rbx-19mode
10
- - ruby-head
11
- - jruby-head
12
- - ree
3
+ - 1.9.2
4
+ - 1.9.3
5
+ - jruby-19mode
6
+ - rbx-19mode
7
+ - ruby-head
8
+ - jruby-head
9
+ gemfile:
10
+ - gemfiles/rails_3.1.gemfile
11
+ - gemfiles/rails_3.2.gemfile
12
+ before_install:
13
+ - gem install bundler
13
14
  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="}]
15
+ global:
16
+ - FOG_DIRECTORY=asset-sync-travis
17
+ - FOG_PROVIDER=AWS
18
+ - secure: "dy8Fqlg3b1ZMK1BY5z6NMQLbzAVd7GWVYY0MeCQALz76zRac0z8MyU8hkv6h\nozFry7DSdbGehGT9foOnkWTwzGzf1rzdd5cmWrUPk1wDTRgMM9SrwodPj1TU\nzsq2EFx0a79vADQN8JXkpLC1YD6kEb9aWkTxrIT9KBgw+J5H32o="
19
+ - secure: "Hmx7D7/p2LlA2ya/xBIz21s/8MLIQCjvfYB7RWBNlWk1PfqRLAz8wX6TUVWy\nfAFktMjLnpRLRYO7AgQS4jcfQ/k0HYK9IXzqXzeI00TNm0Vwp0TCXhawiOFT\nSvUMhs2/1vRfjN0HOJ75XlWRhJzV/G5rOMiafAZLsVzN/0iiB8g="
15
20
  matrix:
21
+ include:
22
+ - rvm: 1.9.3
23
+ gemfile: gemfiles/rails_4.0.gemfile
24
+ - rvm: jruby-19mode
25
+ gemfile: gemfiles/rails_4.0.gemfile
26
+ - rvm: rbx-19mode
27
+ gemfile: gemfiles/rails_4.0.gemfile
28
+ - rvm: 2.0.0
29
+ gemfile: gemfiles/rails_3.2.gemfile
30
+ - rvm: 2.0.0
31
+ gemfile: gemfiles/rails_4.0.gemfile
16
32
  allow_failures:
17
33
  - rvm: ruby-head
18
34
  - rvm: jruby-head
19
-
@@ -0,0 +1,11 @@
1
+ appraise "rails-3.1" do
2
+ gem "rails", "~> 3.1.0"
3
+ end
4
+
5
+ appraise "rails-3.2" do
6
+ gem "rails", "~> 3.2.0"
7
+ end
8
+
9
+ appraise "rails-4.0" do
10
+ gem "rails", "~> 4.0.0"
11
+ end
data/Gemfile CHANGED
@@ -1,5 +1,5 @@
1
- source :rubygems
1
+ source 'https://rubygems.org'
2
2
  gemspec
3
3
  gem 'rcov', :platforms => :mri_18, :group => [:development, :test]
4
- gem 'simplecov', :platforms => [:jruby, :mri_19, :ruby_19, :rbx], :group => [:development, :test], :require => false
5
- gem 'jruby-openssl', :platform => :jruby
4
+ gem 'simplecov', :platforms => [:jruby, :mri_19, :ruby_19, :mri_20, :rbx], :group => [:development, :test], :require => false
5
+ gem 'jruby-openssl', :platform => :jruby
data/README.md CHANGED
@@ -16,7 +16,7 @@ If you are upgrading from a version of asset_sync **< 0.2.0** (i.e. 0.1.x). All
16
16
 
17
17
  ## Heroku Labs (BETA)
18
18
 
19
- Previously there were [several issues](http://github.com/rumblelabs/asset_sync/blob/master/docs/heroku.md) with using asset_sync on Heroku as described in our [Heroku dev centre article](http://devcenter.heroku.com/articles/cdn-asset-host-rails31).
19
+ Previously there were [several issues](http://github.com/rumblelabs/asset_sync/blob/master/docs/heroku.md) with using asset_sync on Heroku as described in our [Heroku dev center article](http://devcenter.heroku.com/articles/cdn-asset-host-rails31).
20
20
 
21
21
  Now to get everything working smoothly with using **ENV** variables to configure `asset_sync` we just need to enable the [user-env-compile](http://devcenter.heroku.com/articles/labs-user-env-compile) functionality. In short:
22
22
 
@@ -29,7 +29,7 @@ Hopefully this will make it's way into the platform as standard.
29
29
  Add the gem to your Gemfile
30
30
 
31
31
  ``` ruby
32
- gem "asset_sync"
32
+ gem 'asset_sync'
33
33
  ```
34
34
 
35
35
  If you want, you can put it within your **:assets** group in your Gemfile.
@@ -39,7 +39,7 @@ group :assets do
39
39
  gem 'sass-rails', '~> 3.2.3'
40
40
  gem 'coffee-rails', '~> 3.2.1'
41
41
  gem 'uglifier', '>= 1.0.3'
42
- gem "asset_sync"
42
+ gem 'asset_sync'
43
43
  end
44
44
  ```
45
45
 
@@ -50,6 +50,16 @@ if defined?(AssetSync)
50
50
  ...
51
51
  end
52
52
  ```
53
+ ### Extended Installation (Faster sync with turbosprockets)
54
+
55
+ It's possible to improve **asset:precompile** time if you are using Rails 3.2.x
56
+ the main source of which being compilation of **non-digest** assets.
57
+
58
+ [turbo-sprockets-rails3](https://github.com/ndbroadbent/turbo-sprockets-rails3)
59
+ solves this by only compiling **digest** assets. Thus cutting compile time in half.
60
+
61
+ > NOTE: It will be **deprecated in Rails 4** as sprockets-rails has been extracted
62
+ out of Rails and will only compile **digest** assets by default.
53
63
 
54
64
  ## Configuration
55
65
 
@@ -78,13 +88,21 @@ On **HTTPS**: the exclusion of any protocol in the asset host declaration above
78
88
  > 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.
79
89
 
80
90
  ``` ruby
81
- config.action_controller.asset_host = "//s3.amazonaws.com/#{ENV['FOG_DIRECTORY']}"
91
+ config.action_controller.asset_host = "//s3.amazonaws.com/#{ENV['FOG_DIRECTORY']}"
82
92
  ```
83
93
  Or
84
94
 
85
95
  ``` ruby
86
- config.action_controller.asset_host = "//storage.googleapis.com/#{ENV['FOG_DIRECTORY']}"
96
+ config.action_controller.asset_host = "//storage.googleapis.com/#{ENV['FOG_DIRECTORY']}"
87
97
  ```
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.
99
+
100
+ 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
+
102
+ ```ruby
103
+ # store assets in a 'folder' instead of bucket root
104
+ config.assets.prefix = "/production/assets"
105
+ ````
88
106
 
89
107
  Also, ensure the following are defined (in production.rb or application.rb)
90
108
 
@@ -99,7 +117,7 @@ Additionally, if you depend on any configuration that is setup in your `initiali
99
117
 
100
118
  **AssetSync** supports the following methods of configuration.
101
119
 
102
- * [Built-in Initializer](/rumblelabs/asset_sync/blob/master/lib/asset_sync/engine.rb) (configured through environment variables)
120
+ * [Built-in Initializer](https://github.com/rumblelabs/asset_sync/blob/master/lib/asset_sync/engine.rb) (configured through environment variables)
103
121
  * Rails Initializer
104
122
  * A YAML config file
105
123
 
@@ -108,7 +126,7 @@ Using the **Built-in Initializer** is the default method and is supposed to be u
108
126
 
109
127
  If you need more control over configuration you will want to use a **custom rails initializer**.
110
128
 
111
- Configuration using a **YAML** file (a common strategy for Capistrano deployments) is also suppored.
129
+ Configuration using a **YAML** file (a common strategy for Capistrano deployments) is also supported.
112
130
 
113
131
  The recommend way to configure **asset_sync** is by using **environment variables** however it's up to you, it will work fine if you hard code them too. The main reason is that then your access keys are not checked into version control.
114
132
 
@@ -150,8 +168,8 @@ heroku config:add FOG_PROVIDER=Rackspace
150
168
  Google Storage Cloud configuration is supported as well
151
169
  ``` bash
152
170
  heroku config:add FOG_PROVIDER=Google
153
- heroku config:add GOOGLE_STORAGE_ACCESS_KEY_ID=xxxx
154
- heroku config:add GOOGLE_STORAGE_SECRET_ACCESS_KEY=xxxx
171
+ heroku config:add GOOGLE_STORAGE_ACCESS_KEY_ID=xxxx
172
+ heroku config:add GOOGLE_STORAGE_SECRET_ACCESS_KEY=xxxx
155
173
  heroku config:add FOG_DIRECTORY=xxxx
156
174
  ```
157
175
 
@@ -176,7 +194,7 @@ AssetSync.configure do |config|
176
194
  config.aws_secret_access_key = ENV['AWS_SECRET_ACCESS_KEY']
177
195
 
178
196
  # Don't delete files from the store
179
- # config.existing_remote_files = "keep"
197
+ # config.existing_remote_files = 'keep'
180
198
  #
181
199
  # Increase upload performance by configuring your region
182
200
  # config.fog_region = 'eu-west-1'
@@ -283,7 +301,7 @@ AssetSync.config.gzip_compression == ENV['ASSET_SYNC_GZIP_COMPRESSION']
283
301
 
284
302
  #### Rackspace (Optional)
285
303
 
286
- * **rackspace\_auth\_url**: Rackspace auth URL, for Rackspace London use: lon.auth.api.rackspacecloud.com
304
+ * **rackspace\_auth\_url**: Rackspace auth URL, for Rackspace London use: `https://lon.identity.api.rackspacecloud.com/v2.0`
287
305
 
288
306
  ## Amazon S3 Multiple Region Support
289
307
 
@@ -307,7 +325,7 @@ Or via YAML
307
325
  ``` yaml
308
326
  production:
309
327
  # ...
310
- aws_region: 'eu-west-1'
328
+ fog_region: 'eu-west-1'
311
329
  ```
312
330
 
313
331
 
@@ -329,21 +347,33 @@ With the new **user_env_compile** feature of Heroku (see above), this is no long
329
347
 
330
348
  ## Rake Task
331
349
 
332
- A rake task is included within the **asset_sync** gem to enhance the rails precompile task by automatically running after it.
350
+ A rake task is included within the **asset_sync** gem to perform the sync:
351
+
352
+ ``` ruby
353
+ namespace :assets do
354
+ desc "Synchronize assets to S3"
355
+ task :sync => :environment do
356
+ AssetSync.sync
357
+ end
358
+ end
359
+ ```
360
+
361
+ If `AssetSync.config.run_on_precompile` is `true` (default), then assets will be uploaded to S3 automatically after the `assets:precompile` rake task is invoked:
333
362
 
334
363
  ``` ruby
335
- # asset_sync/lib/tasks/asset_sync.rake
336
364
  if Rake::Task.task_defined?("assets:precompile:nondigest")
337
365
  Rake::Task["assets:precompile:nondigest"].enhance do
338
- AssetSync.sync
366
+ Rake::Task["assets:sync"].invoke if defined?(AssetSync) && AssetSync.config.run_on_precompile
339
367
  end
340
368
  else
341
369
  Rake::Task["assets:precompile"].enhance do
342
- AssetSync.sync
370
+ Rake::Task["assets:sync"].invoke if defined?(AssetSync) && AssetSync.config.run_on_precompile
343
371
  end
344
372
  end
345
373
  ```
346
374
 
375
+ You can disable this behavior by setting `AssetSync.config.run_on_precompile = false`.
376
+
347
377
  ## Sinatra/Rack Support
348
378
 
349
379
  You can use the gem with any Rack application, but you must specify two
@@ -355,8 +385,8 @@ AssetSync.configure do |config|
355
385
  config.fog_directory = ENV['FOG_DIRECTORY']
356
386
  config.aws_access_key_id = ENV['AWS_ACCESS_KEY_ID']
357
387
  config.aws_secret_access_key = ENV['AWS_SECRET_ACCESS_KEY']
358
- config.prefix = "assets"
359
- config.public_path = Pathname("./public")
388
+ config.prefix = 'assets'
389
+ config.public_path = Pathname('./public')
360
390
  end
361
391
  ```
362
392
 
@@ -365,10 +395,10 @@ task.
365
395
 
366
396
  ```ruby
367
397
  namespace :assets do
368
- desc "Precompile assets"
398
+ desc 'Precompile assets'
369
399
  task :precompile do
370
400
  target = Pathname('./public/assets')
371
- manifest = Sprockets::Manifest.new(sprockets, "./public/assets/manifest.json")
401
+ manifest = Sprockets::Manifest.new(sprockets, './public/assets/manifest.json')
372
402
 
373
403
  sprockets.each_logical_path do |logical_path|
374
404
  if (!File.extname(logical_path).in?(['.js', '.css']) || logical_path =~ /application\.(css|js)$/) && asset = sprockets.find_asset(logical_path)
data/Rakefile CHANGED
@@ -1,3 +1,10 @@
1
+ #!/usr/bin/env rake
2
+ begin
3
+ require 'bundler/setup'
4
+ require 'appraisal'
5
+ rescue LoadError
6
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
7
+ end
1
8
  require 'bundler/gem_tasks'
2
9
  require 'rspec/core/rake_task'
3
10
 
@@ -17,6 +24,7 @@ namespace :spec do
17
24
  spec.pattern = 'spec/integration/*_spec.rb'
18
25
  spec.rspec_opts = ['--backtrace']
19
26
  end
27
+ desc "run spec:unit and spec:integration tasks"
20
28
  task :all do
21
29
  Rake::Task['spec:unit'].execute
22
30
 
@@ -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 = "2013-01-16"
9
+ s.date = "2013-08-26"
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"]
@@ -16,16 +16,16 @@ Gem::Specification.new do |s|
16
16
 
17
17
  s.rubyforge_project = "asset_sync"
18
18
 
19
- s.add_dependency('fog')
19
+ s.add_dependency('fog', ">= 1.8.0")
20
20
  s.add_dependency('activemodel')
21
21
 
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"
25
+
27
26
  s.add_development_dependency "uglifier"
28
27
  s.add_development_dependency "asset_sync"
28
+ s.add_development_dependency "appraisal"
29
29
 
30
30
  s.files = `git ls-files`.split("\n")
31
31
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
@@ -15,7 +15,7 @@ When you see `rake assets:precompile` during deployment. Heroku is actually runn
15
15
 
16
16
  This means the *RAILS_ENV* you have set via *heroku:config* is not used.
17
17
 
18
- **Workaround:** you could have just one S3 bucket dedicated to assets and ensure to set keep the existing remote files
18
+ **Workaround:** you could have just one S3 bucket dedicated to assets and configure `AssetSync` to not delete existing files:
19
19
 
20
20
  AssetSync.configure do |config|
21
21
  ...
@@ -33,4 +33,4 @@ Currently when heroku runs `rake assets:precompile` during deployment. It does n
33
33
  config.aws_access_key_id = 'xxx'
34
34
  config.aws_secret_access_key = 'xxx'
35
35
  config.fog_directory = 'mybucket'
36
- end
36
+ end
@@ -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", "~> 3.1.0"
9
+
10
+ gemspec :path=>"../"
@@ -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", "~> 3.2.0"
9
+
10
+ gemspec :path=>"../"
@@ -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.0.0"
9
+
10
+ gemspec :path=>"../"
@@ -11,6 +11,10 @@ module AssetSync
11
11
  @config
12
12
  end
13
13
 
14
+ def reset_config!
15
+ remove_instance_variable :@config if defined?(@config)
16
+ end
17
+
14
18
  def configure(&proc)
15
19
  @config ||= Config.new
16
20
  yield @config
@@ -21,6 +25,18 @@ module AssetSync
21
25
  end
22
26
 
23
27
  def sync
28
+ with_config do
29
+ self.storage.sync
30
+ end
31
+ end
32
+
33
+ def clean
34
+ with_config do
35
+ self.storage.delete_extra_remote_files
36
+ end
37
+ end
38
+
39
+ def with_config(&block)
24
40
  return unless AssetSync.enabled?
25
41
 
26
42
  errors = config.valid? ? "" : config.errors.full_messages.join(', ')
@@ -32,7 +48,7 @@ module AssetSync
32
48
  raise Config::Invalid.new(errors)
33
49
  end
34
50
  else
35
- self.storage.sync
51
+ block.call
36
52
  end
37
53
  end
38
54
 
@@ -41,7 +57,7 @@ module AssetSync
41
57
  end
42
58
 
43
59
  def log(msg)
44
- stdout.puts msg if ENV["RAILS_GROUPS"] == "assets"
60
+ stdout.puts msg if config.log_silently?
45
61
  end
46
62
 
47
63
  def enabled?
@@ -9,11 +9,16 @@ module AssetSync
9
9
  attr_accessor :gzip_compression
10
10
  attr_accessor :manifest
11
11
  attr_accessor :fail_silently
12
+ attr_accessor :log_silently
12
13
  attr_accessor :always_upload
13
14
  attr_accessor :ignored_files
14
15
  attr_accessor :prefix
15
16
  attr_accessor :public_path
16
17
  attr_accessor :enabled
18
+ attr_accessor :custom_headers
19
+ attr_accessor :run_on_precompile
20
+ attr_accessor :invalidate
21
+ attr_accessor :cdn_distribution_id
17
22
 
18
23
  # FOG configuration
19
24
  attr_accessor :fog_provider # Currently Supported ['AWS', 'Rackspace']
@@ -21,7 +26,7 @@ module AssetSync
21
26
  attr_accessor :fog_region # e.g. 'eu-west-1'
22
27
 
23
28
  # Amazon AWS
24
- attr_accessor :aws_access_key_id, :aws_secret_access_key
29
+ attr_accessor :aws_access_key_id, :aws_secret_access_key, :aws_reduced_redundancy
25
30
 
26
31
  # Rackspace
27
32
  attr_accessor :rackspace_username, :rackspace_api_key, :rackspace_auth_url
@@ -47,9 +52,14 @@ module AssetSync
47
52
  self.gzip_compression = false
48
53
  self.manifest = false
49
54
  self.fail_silently = false
55
+ self.log_silently = true
50
56
  self.always_upload = []
51
57
  self.ignored_files = []
58
+ self.custom_headers = {}
52
59
  self.enabled = true
60
+ self.run_on_precompile = true
61
+ self.cdn_distribution_id = nil
62
+ self.invalidate = []
53
63
  load_yml! if defined?(Rails) && yml_exists?
54
64
  end
55
65
 
@@ -71,8 +81,16 @@ module AssetSync
71
81
  fog_provider == 'AWS'
72
82
  end
73
83
 
84
+ def aws_rrs?
85
+ aws_reduced_redundancy == true
86
+ end
87
+
74
88
  def fail_silently?
75
- fail_silently == true
89
+ fail_silently || !enabled?
90
+ end
91
+
92
+ def log_silently?
93
+ ENV['RAILS_GROUPS'] == 'assets' || self.log_silently == false
76
94
  end
77
95
 
78
96
  def enabled?
@@ -88,11 +106,15 @@ module AssetSync
88
106
  end
89
107
 
90
108
  def yml_exists?
91
- File.exists?(self.yml_path)
109
+ defined?(Rails.root) ? File.exists?(self.yml_path) : false
92
110
  end
93
111
 
94
112
  def yml
95
- @yml ||= YAML.load(ERB.new(IO.read(yml_path)).result)[Rails.env] rescue nil || {}
113
+ begin
114
+ @yml ||= YAML.load(ERB.new(IO.read(yml_path)).result)[Rails.env] rescue nil || {}
115
+ rescue Psych::SyntaxError
116
+ @yml = {}
117
+ end
96
118
  end
97
119
 
98
120
  def yml_path
@@ -109,15 +131,16 @@ module AssetSync
109
131
  end
110
132
 
111
133
  def load_yml!
112
- self.enabled = yml["enabled"] if yml.has_key?('enabled')
113
- self.fog_provider = yml["fog_provider"]
114
- self.fog_directory = yml["fog_directory"]
115
- self.fog_region = yml["fog_region"]
116
- self.aws_access_key_id = yml["aws_access_key_id"]
117
- self.aws_secret_access_key = yml["aws_secret_access_key"]
118
- self.rackspace_username = yml["rackspace_username"]
119
- self.rackspace_auth_url = yml["rackspace_auth_url"] if yml.has_key?("rackspace_auth_url")
120
- self.rackspace_api_key = yml["rackspace_api_key"]
134
+ self.enabled = yml["enabled"] if yml.has_key?('enabled')
135
+ self.fog_provider = yml["fog_provider"]
136
+ self.fog_directory = yml["fog_directory"]
137
+ self.fog_region = yml["fog_region"]
138
+ self.aws_access_key_id = yml["aws_access_key_id"]
139
+ self.aws_secret_access_key = yml["aws_secret_access_key"]
140
+ self.aws_reduced_redundancy = yml["aws_reduced_redundancy"]
141
+ self.rackspace_username = yml["rackspace_username"]
142
+ self.rackspace_auth_url = yml["rackspace_auth_url"] if yml.has_key?("rackspace_auth_url")
143
+ self.rackspace_api_key = yml["rackspace_api_key"]
121
144
  self.google_storage_secret_access_key = yml["google_storage_secret_access_key"]
122
145
  self.google_storage_access_key_id = yml["google_storage_access_key_id"]
123
146
  self.existing_remote_files = yml["existing_remote_files"] if yml.has_key?("existing_remote_files")
@@ -126,6 +149,10 @@ module AssetSync
126
149
  self.fail_silently = yml["fail_silently"] if yml.has_key?("fail_silently")
127
150
  self.always_upload = yml["always_upload"] if yml.has_key?("always_upload")
128
151
  self.ignored_files = yml["ignored_files"] if yml.has_key?("ignored_files")
152
+ self.custom_headers = yml["custom_headers"] if yml.has_key?("custom_headers")
153
+ self.run_on_precompile = yml["run_on_precompile"] if yml.has_key?("run_on_precompile")
154
+ self.invalidate = yml["invalidate"] if yml.has_key?("invalidate")
155
+ self.cdn_distribution_id = yml['cdn_distribution_id'] if yml.has_key?("cdn_distribution_id")
129
156
 
130
157
  # TODO deprecate the other old style config settings. FML.
131
158
  self.aws_access_key_id = yml["aws_access_key"] if yml.has_key?("aws_access_key")
@@ -138,6 +165,8 @@ module AssetSync
138
165
  self.aws_secret_access_key = yml["secret_access_key"] if yml.has_key?("secret_access_key")
139
166
  self.fog_directory = yml["bucket"] if yml.has_key?("bucket")
140
167
  self.fog_region = yml["region"] if yml.has_key?("region")
168
+
169
+ self.public_path = yml["public_path"] if yml.has_key?("public_path")
141
170
  end
142
171
 
143
172
 
@@ -153,6 +182,9 @@ module AssetSync
153
182
  :rackspace_username => rackspace_username,
154
183
  :rackspace_api_key => rackspace_api_key
155
184
  })
185
+ options.merge!({
186
+ :rackspace_region => fog_region
187
+ }) if fog_region
156
188
  options.merge!({ :rackspace_auth_url => rackspace_auth_url }) if rackspace_auth_url
157
189
  elsif google?
158
190
  options.merge!({
@@ -163,7 +195,7 @@ module AssetSync
163
195
  raise ArgumentError, "AssetSync Unknown provider: #{fog_provider} only AWS and Rackspace are supported currently."
164
196
  end
165
197
 
166
- options.merge!({:region => fog_region}) if fog_region
198
+ options.merge!({:region => fog_region}) if fog_region && !rackspace?
167
199
  return options
168
200
  end
169
201