capistrano-rbenv:为什么忽略 rbenv_ruby?

capistrano-rbenv: Why is it ignoring rbenv_ruby?

好的。所以我正在尝试使用 capistrano 部署新版本的应用程序。我正在使用 rbenv,并安装了 1.8.7(对于旧应用程序)和 2.4.1(对于新应用程序)。我的 Capfile 包括:

require "capistrano/rbenv"

和我的 deploy.rb:

set :rbenv_type, :user
set :rbenv_ruby, "2.4.1"

namespace :deploy do
  desc "Show ruby version"
  task :ruby_version do
    on roles(:all) do |h|
      execute "ruby --version"
      execute "rbenv versions"
    end
  end
end

运行 cap production deploy:ruby_version 产量:

00:00 deploy:ruby_version
      01 ruby --version
      01 ruby 1.8.7 (2012-06-29 patchlevel 370) [x86_64-linux]
    ✔ 01 deploy@example.com 0.390s
      02 rbenv versions
      02   system
      02 * 1.8.7-p370 (set by /home/deploy/.rbenv/version)
      02   2.4.1
    ✔ 02 deploy@example.com 0.371s

我尝试了很多方法——set :default_env, {"RBENV_VERSION => "2.4.1"},删除 /home/deploy/.rbenv/version(这让我使用 system ruby)——但似乎没有什么能让 rbenv_ruby 覆盖其他设置。

rbenv_ruby 设置为不存在的版本会引发错误,因此它似乎在做 某事。

我快疯了。我做错了什么?

好的。而不是

execute "rbenv versions"

我想要:

execute :rbenv, "versions"

两者看起来很像,但完全不一样:

http://capistranorb.com/documentation/getting-started/tasks/

tl;dr: execute(:bundle, :install) and execute('bundle install') don’t behave identically!

siiiiiiiiiiiiiiiigh