【问题标题】:capistrano3 tasks not retaining gemfilecapistrano3 任务不保留 gemfile
【发布时间】:2015-01-03 03:01:27
【问题描述】:

我正在尝试使用 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

任何其他设置是主机、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 作业似乎确实具有正确的设置。

有没有我未设置的变量?

【问题讨论】:

    标签: ruby-on-rails-3 jenkins capistrano3 rvm-capistrano


    【解决方案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'
    

    【讨论】:

      猜你喜欢
      • 2015-03-24
      • 2016-05-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-02-13
      • 2016-10-26
      • 2017-09-09
      相关资源
      最近更新 更多