Commit 9570ef8e0fe2c78032ef8407032d4ccfa2f8efbf
Exists in
master
and in
1 other branch
Merge pull request #187 from tim-vandecasteele/asset_compilation
Not all assets were compiled when deploying to production
Showing
2 changed files
with
14 additions
and
0 deletions
Show diff stats
config/deploy.example.rb
@@ -38,6 +38,7 @@ set(:current_branch) { `git branch`.match(/\* (\S+)\s/m)[1] || raise("Couldn't d | @@ -38,6 +38,7 @@ set(:current_branch) { `git branch`.match(/\* (\S+)\s/m)[1] || raise("Couldn't d | ||
38 | set :branch, defer { current_branch } | 38 | set :branch, defer { current_branch } |
39 | 39 | ||
40 | after 'deploy:update_code', 'errbit:symlink_configs' | 40 | after 'deploy:update_code', 'errbit:symlink_configs' |
41 | +before "deploy:create_symlink", "assets:compile" | ||
41 | 42 | ||
42 | namespace :deploy do | 43 | namespace :deploy do |
43 | task :start do ; end | 44 | task :start do ; end |
@@ -64,6 +65,16 @@ namespace :errbit do | @@ -64,6 +65,16 @@ namespace :errbit do | ||
64 | end | 65 | end |
65 | end | 66 | end |
66 | 67 | ||
68 | +namespace :assets do | ||
69 | + desc <<-DESC | ||
70 | + Compile assets. | ||
71 | + DESC | ||
72 | + task :compile, :roles => :app do | ||
73 | + run "cd #{latest_release} && bundle exec rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile" | ||
74 | + end | ||
75 | + | ||
76 | +end | ||
77 | + | ||
67 | namespace :db do | 78 | namespace :db do |
68 | desc "Create the indexes defined on your mongoid models" | 79 | desc "Create the indexes defined on your mongoid models" |
69 | task :create_mongoid_indexes do | 80 | task :create_mongoid_indexes do |
config/environments/production.rb
@@ -28,6 +28,9 @@ Errbit::Application.configure do | @@ -28,6 +28,9 @@ Errbit::Application.configure do | ||
28 | # Use a different cache store in production | 28 | # Use a different cache store in production |
29 | # config.cache_store = :mem_cache_store | 29 | # config.cache_store = :mem_cache_store |
30 | 30 | ||
31 | + # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added) | ||
32 | + config.assets.precompile += %w( apps.show.js ) | ||
33 | + | ||
31 | # Disable Rails's static asset server | 34 | # Disable Rails's static asset server |
32 | # In production, Apache or nginx will already do this | 35 | # In production, Apache or nginx will already do this |
33 | config.serve_static_assets = false | 36 | config.serve_static_assets = false |