我的问题与此相同:require 'bundler/capistrano' breaks capistrano
除非我使用正确的红宝石版本。
我在deploy.rb中添加了这一行:
require 'bundler/capistrano'
收到以下错误:
/Users/craigflannagan/.rvm/gems/ruby-1.9.2-head@foo/gems/capistrano-2.5.19/lib/capistrano/configuration/loading.rb:152:in `require': no such file to load -- bundler/capistrano (LoadError)
以下是信息:
Craig:/usr/local/src/hammer$ gem which bundler
/Users/craigflannagan/.rvm/gems/ruby-1.9.2-head@foo/gems/bundler-1.0.10/lib/bundler.rb
Craig:/usr/local/src/hammer$ gem which capistrano
/Users/craigflannagan/.rvm/gems/ruby-1.9.2-head@foo/gems/capistrano-2.5.19/lib/capistrano.rb
Craig:/usr/local/src/hammer$ ruby --version
ruby 1.9.2p174 (2011-01-28 revision 30696) [i386-darwin9.8.0]
Craig:/usr/local/src/hammer$ gem env
RubyGems Environment:
- RUBYGEMS VERSION: 1.5.2
- RUBY VERSION: 1.9.2 (2011-01-28 patchlevel 174) [i386-darwin9.8.0]
- INSTALLATION DIRECTORY: /Users/craigflannagan/.rvm/gems/ruby-1.9.2-head@foo
- RUBY EXECUTABLE: /Users/craigflannagan/.rvm/rubies/ruby-1.9.2-head/bin/ruby
- EXECUTABLE DIRECTORY: /Users/craigflannagan/.rvm/gems/ruby-1.9.2-head@foo/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86-darwin-9
- GEM PATHS:
- /Users/craigflannagan/.rvm/gems/ruby-1.9.2-head@foo
- /Users/craigflannagan/.rvm/gems/ruby-1.9.2-head@global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
ruby 1.9.2p174 (2011-01-28 revision 30696) [i386-darwin9.8.0]
Craig:/usr/local/src/hammer$ rvm info
ruby-1.9.2-head@foo:
system:
uname: "Darwin craig-a-flannagans-macbook-pro.local 9.8.0 Darwin Kernel Version 9.8.0: Wed Jul 15 16:55:01 PDT 2009; root:xnu-1228.15.4~1/RELEASE_I386 i386"
bash: "/bin/bash => GNU bash, version 3.2.17(1)-release (i386-apple-darwin9.0)"
zsh: "/bin/zsh => zsh 4.3.4 (i386-apple-darwin9.0)"
rvm:
version: "rvm 1.2.6 by Wayne E. Seguin (wayneeseguin@gmail.com) [http://rvm.beginrescueend.com/]"
ruby:
interpreter: "ruby"
version: "1.9.2p174"
date: "2011-01-28"
platform: "i386-darwin9.8.0"
patchlevel: "2011-01-28 revision 30696"
full_version: "ruby 1.9.2p174 (2011-01-28 revision 30696) [i386-darwin9.8.0]"
homes:
gem: "/Users/craigflannagan/.rvm/gems/ruby-1.9.2-head@foo"
ruby: "/Users/craigflannagan/.rvm/rubies/ruby-1.9.2-head"
binaries:
ruby: "/Users/craigflannagan/.rvm/rubies/ruby-1.9.2-head/bin/ruby"
irb: "/Users/craigflannagan/.rvm/rubies/ruby-1.9.2-head/bin/irb"
gem: "/Users/craigflannagan/.rvm/rubies/ruby-1.9.2-head/bin/gem"
rake: "/Users/craigflannagan/.rvm/gems/ruby-1.9.2-head@foo/bin/rake"
environment:
PATH: "/Users/craigflannagan/.rvm/gems/ruby-1.9.2- head@foo/bin:/Users/craigflannagan/.rvm/gems/ruby-1.9.2-head@global/bin:/Users/craigflannagan/.rvm/rubies/ruby-1.9.2-head/bin:/Users/craigflannagan/.rvm/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11/bin:/usr/local/git/bin"
GEM_HOME: "/Users/craigflannagan/.rvm/gems/ruby-1.9.2-head@foo"
GEM_PATH: "/Users/craigflannagan/.rvm/gems/ruby-1.9.2-head@foo:/Users/craigflannagan/.rvm/gems/ruby-1.9.2-head@global"
MY_RUBY_HOME: "/Users/craigflannagan/.rvm/rubies/ruby-1.9.2-head"
IRBRC: "/Users/craigflannagan/.rvm/rubies/ruby-1.9.2-head/.irbrc"
RUBYOPT: ""
gemset: "foo"
在其他项目中一直使用capistrano和bundler,但是设置capistrano receipe以及使用RVM相对较新。
提前感谢您在此处找出错误的任何帮助。
更新:
尝试了我在网上找到的随机解决方案http://www.mattvsworld.com/blog/2010/03/rails-3-bundler-capistrano/
如果我拿出来 要求'bundler / capistrano' 并将其放在deploy.rb:
的末尾namespace :bundler do
task :create_symlink, :roles => :app do
shared_dir = File.join(shared_path, 'bundle')
release_dir = File.join(current_release, '.bundle')
run("mkdir -p #{shared_dir} && ln -s #{shared_dir} #{release_dir}")
end
task :bundle_new_release, :roles => :app do
bundler.create_symlink
run "cd #{release_path} && bundle install --without test"
end
end
after 'deploy:update_code', 'bundler:bundle_new_release'
它的工作原理 - 部署完成所有工作,包括捆绑安装。任何想法为什么简化的“require'bundler / capistrano'”解决方案对我不起作用?
答案 0 :(得分:1)
我遇到了类似的问题,并通过从早先的1.0.0.rc.3将bundler更新到版本1.0.13来解决问题。