diff --git a/Gemfile b/Gemfile index 18202f6b7..bbc443f0a 100644 --- a/Gemfile +++ b/Gemfile @@ -119,6 +119,7 @@ group :assets do gem 'handlebars_assets' gem 'uglifier' + gem "asset_sync" end gem 'jquery-rails' diff --git a/Gemfile.lock b/Gemfile.lock index 1dc88a104..1a5e08a01 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -90,6 +90,9 @@ GEM builder archive-tar-minitar (0.5.2) arel (2.2.3) + asset_sync (0.3.1) + activemodel + fog bcrypt-ruby (3.0.1) builder (3.0.0) capistrano (2.9.0) @@ -475,6 +478,7 @@ DEPENDENCIES acts_as_api addressable (= 2.2.4) airbrake + asset_sync bundler (~> 1.1.0) capistrano (~> 2.9.0) capistrano-ext (= 1.2.1) diff --git a/config/initializers/asset_sync.rb b/config/initializers/asset_sync.rb new file mode 100644 index 000000000..c4301135a --- /dev/null +++ b/config/initializers/asset_sync.rb @@ -0,0 +1,23 @@ +require File.join(File.dirname(__FILE__), '..', '..', 'app', 'models', 'app_config') +AssetSync.configure do |config| + config.fog_provider = 'AWS' + config.fog_directory = AppConfig[:s3_bucket] + config.aws_access_key_id = AppConfig[:s3_key] + config.aws_secret_access_key = AppConfig[:s3_secret] + + # Don't delete files from the store + # config.existing_remote_files = "keep" + # + # Increase upload performance by configuring your region + # config.fog_region = 'eu-west-1' + # + # Automatically replace files with their equivalent gzip compressed version + # config.gzip_compression = true + # + # Use the Rails generated 'manifest.yml' file to produce the list of files to + # upload instead of searching the assets directory. + # config.manifest = true + # + # Fail silently. Useful for environments such as Heroku + # config.fail_silently = true +end \ No newline at end of file diff --git a/lib/tasks/assets.rake b/lib/tasks/assets.rake deleted file mode 100644 index 444a583c8..000000000 --- a/lib/tasks/assets.rake +++ /dev/null @@ -1,23 +0,0 @@ -namespace :assets do - task :deploy do - puts "compiling sass..." - system 'sass --update public/stylesheets/sass:public/stylesheets' - - puts "packaging assets..." - Jammit.package! - - Rake::Task['assets:upload'].invoke - end - - task :upload => [:environment] do - s3_configuration = { - :bucket_name => AppConfig[:s3_bucket], - :access_key_id => AppConfig[:s3_key], - :secret_access_key => AppConfig[:s3_secret] - } - Jammit.upload_to_s3!(s3_configuration) - asset_host = "https://#{s3_configuration[:bucket_name]}.s3.amazonaws.com" - puts "NOTE: ENV['ASSET_HOST'] is now: #{asset_host}, but you may know your cdn url better than I" - puts "Please set this in your ENV hash in a production enviroment" - end -end \ No newline at end of file diff --git a/lib/tasks/resque.rake b/lib/tasks/resque.rake index 5365b6f35..773514d13 100644 --- a/lib/tasks/resque.rake +++ b/lib/tasks/resque.rake @@ -11,7 +11,7 @@ desc "Alias for resque:work (To run workers on Heroku)" task "jobs:work" => "resque:work" desc 'clear your failure queue in resque. good for crons.' -task 'resque:clear_failed' => [:environment]do +task 'resque:clear_failed' => [:environment] do puts "clearing resque failures" Resque::Failure.clear puts "complete!"