首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >不保留gemfile的capistrano3任务

不保留gemfile的capistrano3任务
EN

Stack Overflow用户
提问于 2015-01-03 11:01:27
回答 1查看 92关注 0票数 2

我正在尝试使用rvm1-capistrano将Capistrano更新为v3,但是在gemset中遇到了错误。

Capfile的相关部分:

代码语言:javascript
复制
require 'rvm1/capistrano3'
#require 'capistrano/bundler'
require 'capistrano/rails/assets'
require 'capistrano/rails/migrations'

我的deploy.rb看起来像这样:

代码语言:javascript
复制
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:预编译任务失败,并出现以下错误,因为该作业找不到正确的gemset:

代码语言:javascript
复制
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 (一个定制的引擎):

代码语言:javascript
复制
gem "customgem", :git => 'git@github.com:customgem/customget.git', :branch => '745-capistrano-3-upgrade'

我在远程服务器上手动运行了一个bundle install,所以我知道gemset实际上在远程服务器上。

我已经运行了cap customenv rvm1:check,并收到了以下输出:

代码语言:javascript
复制
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作业看起来确实有正确的设置。

有没有我没有设置的变量?

EN

回答 1

Stack Overflow用户

发布于 2016-11-20 11:15:58

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

此线程中的代码为我工作,通过添加此自定义上限任务:

代码语言:javascript
复制
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'
票数 -1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/27751312

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档