2

rvm1-capistrano を使用して Capistrano を v3 に更新しようとしていますが、gemset でエラーが発生します。

Capfile の関連セクション:

require 'rvm1/capistrano3'
#require 'capistrano/bundler'
require 'capistrano/rails/assets'
require 'capistrano/rails/migrations'

私の deploy.rb は次のようになります。

set :rvm_type, :user
set :rvm_ruby_version, 'ruby-2.1.5'
set :rvm_ruby_gemset, 'ruby-2.1.5@json-webservice'
set :branch, ENV["BRANCH_NAME"] || ENV["TAG_NAME"] || "master"
set :pty, true

その他の設定は、host、repo_url などです。rake assets:precompile タスクは、ジョブが適切な gemset を見つけられないため、次のエラーで失敗します。

DEBUG[bc474425] Command: cd /home/user/www/server-test/releases/20150103023617 && ( RAILS_ENV=stevedev /home/usr/www/mdm-server-test/rvm1scripts/rvm-auto.sh . rake assets:precompile )
DEBUG[bc474425]     git@github.com:customgem/customgem.git (at 745-capistrano-3-upgrade) is not yet checked out. Run `bundle install` first.

Gemfile は、メイン セクションで gem (カスタム ビルドされたエンジン) を指定します。

gem "customgem", :git => 'git@github.com:customgem/customget.git', :branch => '745-capistrano-3-upgrade'

リモートサーバーで手動で実行したbundle installので、gemset が実際にはリモートサーバー上にあることがわかりました。

実行cap customenv rvm1:checkして、次の出力を受け取りました。

DEBUG[bad87e27] Finished in 1.862 seconds with exit status 0 (successful).
ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-linux]

したがって、capistrano ジョブには適切な設定があるようです。

未設定のままにした変数はありますか?

4

1 に答える 1

-1

https://github.com/rvm/rvm1-capistrano3/issues/6#issuecomment-29296421

このスレッドのコードは、このカスタムキャップタスクを追加することでうまくいきました:

set :bundle_without, %w{development test}.join(' ')
set :bundle_roles, :all
namespace :bundler do
  desc "Install gems with bundler."
  task :install do
    on roles fetch(:bundle_roles) do
      within release_path do
        execute :bundle, "install", "--without #{fetch(:bundle_without)}"
      end
    end
  end
end
before 'deploy:updated', 'bundler:install'
于 2016-11-20T03:15:57.540 に答える