ruby-on-rails – 无法让bundle exec在生产中工作

前端之家收集整理的这篇文章主要介绍了ruby-on-rails – 无法让bundle exec在生产中工作前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我已经将我的宝石安装在生产中:
cd /app/releases/current && bundle install --gemfile /app/releases/current/Gemfile --path /app/shared/bundle --deployment --quiet --without development test

我无法绑定exec任何我的宝石(除了耙子和宝石):

$bundle exec whenever
bundler: command not found: whenever
Install missing gem executables with `bundle install`

宝石正确安装在/ app / shared / bundle中:

$cd /app/shared
$find . -name whenever
./bundle/ruby/1.9.1/gems/whenever-0.6.8/bin/whenever
./bundle/ruby/1.9.1/gems/whenever-0.6.8/lib/whenever

我的(生成)软件包配置(在/app/current/.bundle/config中)是:

---
BUNDLE_FROZEN: "1"
BUNDLE_PATH: /app/shared/bundle
BUNDLE_DISABLE_SHARED_GEMS: "1"
BUNDLE_WITHOUT: development:test

我正在运行ruby 1.9.2p290,手动安装到/usr/local / bin.

我必须使用–binstubs选项捆绑安装我的宝石吗?为什么不绑定exec要搜索存储的BUNDLE_PATH?

解决方法

使用Capistrano和Rails,并使用deploy.rb作为deployer文件.

我意识到,改变出现的顺序需要“每当/ capistrano”真的很重要.我把它放在几乎最后一行:

在deploy.rb中:

#first lines:
set :rvm_ruby_string,"1.9.3"
set :rvm_type,:user
set :whenever_command,"bundle exec whenever"

# others...

# last lines
require 'rvm/capistrano'
require 'bundler/capistrano'
require "whenever/capistrano"

after "deploy:update_code","customs:config"
after "deploy:create_symlink","deploy:create_symlink"
after "deploy","deploy:cleanup"

load 'deploy/assets'
# end
原文链接:https://www.f2er.com/ruby/274018.html

猜你在找的Ruby相关文章