13

I have disabled pipeline assets precompile. For that I have the following line in my config/application.rb & config/environments/development.rb

config.assets.enabled = false

I am trying to deploy in development environment with Capistrano3. When I run deploy command I find assets are precompiled.

$cap development deploy --trace

DEBUG [8b4a938e] Command: cd /home/ec2-user/capistrano-3/a/releases/20140122054901 && ( RAILS_ENV=development ~/.rvm/bin/rvm 2.0.0-p353 do bundle exec rake assets:precompile )
DEBUG [8b4a938e]    /home/ec2-user/.rvm/rubies/ruby-2.0.0-p353/bin/ruby /home/ec2-user/capistrano-3/ano_dev/shared/bundle/ruby/2.0.0/bin/rake assets:precompile:all RAILS_ENV=development RAILS_GROUPS=assets
DEBUG [8b4a938e]    
INFO [8b4a938e] Finished in 8.812 seconds with exit status 0 (successful).

What else I need to do to avoid assets pre compilation. It further gives

user3205523
  • 283
  • 3
  • 8

2 Answers2

27

What's in your Capfile?

If you have

require 'capistrano/rails'

then it will precompile your assets because capistrano/rails also includes bundler, rails/assets and rails/migrations.

https://github.com/capistrano/rails/blob/master/lib/capistrano/rails.rb https://github.com/capistrano/rails/blob/master/lib/capistrano/tasks/assets.rake

If you still want bundler and migrations but not assets, you can include them individually in your Capfile, just make sure you don't still require 'capistrano/rails':

require 'capistrano/bundler'
require 'capistrano/rails/migrations'
joshlatte
  • 311
  • 3
  • 4
  • 2
    for my condition, some how i didnt see export RAILS_ENV=staging for my staging deployment. instead of this, i use capistrano/rails and setting set :assets_roles, [] works – James Tan May 23 '16 at 18:13
15

For my case, our team uses a shared gem for all of our Rails apps, and the shared gem requires 'capistrano/rails' (thus bringing in the assets compilation). For the app that did not handle this, all we did was add:

set :assets_roles, []

in config/deploy.rb and this makes capistrano-rails skip asset precompilation.

rusty
  • 2,771
  • 1
  • 24
  • 23