ruby-on-rails – Capistrano和Bundler问题 – 捆绑:未找到

前端之家收集整理的这篇文章主要介绍了ruby-on-rails – Capistrano和Bundler问题 – 捆绑:未找到前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
尝试使用捆绑/安装选项部署我的应用程序时,我一直收到以下错误
Failed: "sh -c 'cd /home/deploy/swamp/releases/20110903003336 
    && bundle install --gemfile /home/deploy/swamp/releases/20110903003336/Gemfile 
    --path /home/deploy/swamp/shared/bundle --deployment --quiet 
    --without development test'" on 12.345.678.98

**更新 – 看起来我错过了一个错误

[err :: 12.345.678.98] sh: bundle: not found

我在deploy.rb中试过这个:

require "bundler/capistrano"

我试过这个:

namespace :bundler do
  task :create_symlink,:roles => :app do
    shared_dir = File.join(shared_path,'bundle')
    release_dir = File.join(current_release,'.bundle')
    run("mkdir -p #{shared_dir} && ln -s #{shared_dir} #{release_dir}")
  end
  task :bundle_new_release,:roles => :app do
    bundler.create_symlink
    run "cd #{release_path} && bundle install --without test"
  end
end
after 'deploy:update_code','bundler:bundle_new_release'

我还将我的包移到了供应商路径:

bundle install --path vendor/bundle

我不认为这是一个权限问题,因为我可以直接在服务器上使用deploy和bundle install手动登录没问题.这是整个deploy.rb文件

require "bundler/capistrano"


 set :application,"swamp"
 set :domain,"12.345.678.98"
 set :repository,"git@github.com:***/**.git"
 set :deploy_to,"/home/deploy/#{application}"
 set :rails_env,'production'
 set :branch,"master"

 role :app,domain
 role :web,domain
 role :db,domain,:primary => true

 set :deploy_via,:remote_cache

 set :scm,:git
 set :user,"deploy"
 set :runner,"deploy"
 ssh_options[:port] = ****
 set :use_sudo,false

 after "deploy","deploy:cleanup"

namespace :deploy do

    desc "Restarting mod_rails with restart.txt"
    task :restart,:roles => :app,:except => { :no_release => true } do
        run "touch #{current_path}/tmp/restart.txt"
    end

    [:start,:stop].each do |t|
        desc "#{t} task is a no-op with mod_rails"
        task t,:roles => :domain do ; end
    end
end

task :after_update_code do  
 run "ln -nfs #{deploy_to}/shared/config/database.yml #{release_path}/config/database.yml"
end

解决方法

我在这里找到了解决方案:

http://www.pastbedti.me/2011/06/change-path-environment-with-rails-and-capistrano/

In you config/deploy.rb add the following snippet

set :default_environment,{
      'PATH' => "/opt/ruby-enterprise/bin/:$PATH"
    }

然后我不得不将gemfile.lock和gemfile添加到存储库和BAM!

猜你在找的Ruby相关文章