Ruby on rails 在deploy.rb中添加预编译的位置

Ruby on rails 在deploy.rb中添加预编译的位置,ruby-on-rails,capistrano,Ruby On Rails,Capistrano,在deploy.rb文件中,我将把预编译信息放在哪里。我需要改变什么才能让它工作?我可以让我的应用程序使用 RAILS_ENV=production rake assets:precompile 预编译信息 after "deploy:restart", "deploy:precompile" namespace :deploy do desc "Compile assets" task :precompile, :roles => :app do

在deploy.rb文件中,我将把预编译信息放在哪里。我需要改变什么才能让它工作?我可以让我的应用程序使用

RAILS_ENV=production rake assets:precompile
预编译信息

after "deploy:restart", "deploy:precompile"

    namespace :deploy do

      desc "Compile assets"
      task :precompile, :roles => :app do
        run "cd #{release_path} && rake RAILS_ENV=#{rails_env} assets:precompile"
      end

     end
我的deploy.rb

    # The name of your app
set :application, "sample_app"

# The directory on the EC2 node that will be deployed to
set :deploy_to, "/var/www/#{application}"

set :keep_releases, 3

# deploy with git
set :scm, :git
set :repository,  "git@github.com:username/sample_app.git"
set :git_shallow_clone, 1
set :branch, "master"
set :use_sudo, true

# gets ssh info
set :user, "ubuntu"
ssh_options[:keys] = ["/Users/User/Documents/ServerKeys/key.pem"]
ssh_options[:forward_agent] = true
default_run_options[:pty] = true

# The address of the remote host on EC2 (the Public DNS address)
set :location, "0.0.0.0"

# setup some Capistrano roles
role :app, location
role :web, location
role :db,  location, :primary => true

after 'deploy:update_code', 'deploy:symlink_db'

namespace :deploy do

desc "Restart Application"
task :restart, :roles => :app do
  run "touch #{deploy_to}/#{shared_dir}/tmp/restart.txt"
end

desc "Symlinks the database.yml"
task :symlink_db, :roles => :app do
  run "ln -nfs #{deploy_to}/shared/config/database.yml
  #{release_path}/config/database.yml"
end

end
Capistrano(v2.8.0及更高版本)包含了在部署中处理此问题的方法。将以下行添加到Capfile:

load 'deploy/assets'