Commit b33ee8c6 authored by Maxwell Salzberg's avatar Maxwell Salzberg
Browse files

add asset sync gem

parent e156947d
......@@ -119,6 +119,7 @@ group :assets do
gem 'handlebars_assets'
gem 'uglifier'
gem "asset_sync"
end
gem 'jquery-rails'
......
......@@ -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)
......
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
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
......@@ -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!"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment