use*_*523 13 ruby ruby-on-rails heroku ruby-on-rails-3
我已禁用管道资产预编译.为此,我在config/application.rb和config/environments/development.rb中有以下行
config.assets.enabled = false
Run Code Online (Sandbox Code Playgroud)
我正在尝试使用Capistrano3在开发环境中部署.当我运行deploy命令时,我发现资产是预编译的.
$ 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).
Run Code Online (Sandbox Code Playgroud)
我还需要做些什么来避免资产预编译.它进一步给出了
小智 26
Capfile中有什么?
如果你有
require 'capistrano/rails'
Run Code Online (Sandbox Code Playgroud)
然后它会预先编译你的资产,因为capistrano/rails还包括bundler,rails/assets和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
如果您仍然需要捆绑器和迁移而不是资产,可以将它们单独包含在Capfile中,只需确保您不需要'capistrano/rails':
require 'capistrano/bundler'
require 'capistrano/rails/migrations'
Run Code Online (Sandbox Code Playgroud)
rus*_*sty 10
就我而言,我们的团队为我们所有的Rails应用程序使用一个共享的gem,并且该共享的gem需要“ capistrano / rails”(因此需要进行资产编译)。对于没有处理此问题的应用程序,我们要做的只是添加:
set :assets_roles, []
Run Code Online (Sandbox Code Playgroud)
在config/deploy.rb这使得Capistrano的护栏跳资产预编译。