RVM and Capistrano

http://card323.blog.163.com/blog/static/52937484201081523536190/?latestBlog

very useful link

ibm developer workers

good article

http://www.ibm.com/developerworks/cn/linux/l-migrate2cloud-1/

http://www.ibm.com/developerworks/cn/linux/l-migrate2cloud-2/

将您的 Linux 应用程序迁移到 Amazon 云,第 3 部分: 实现可扩展性

http://www.ibm.com/developerworks/cn/linux/l-migrate2cloud-3/index.html?ca=drs-

http://www.ibm.com/developerworks/cn/linux/l-migrate2cloud-3/index.html?ca=drs-

将您的 Linux 应用程序迁移到 Amazon 云,第 4 部分: 征服管理挑战

http://www.ibm.com/developerworks/cn/linux/l-migrate2cloud-4/index.html?ca=drs-

 

RVM and Capistrano

Posted on October 13, 2010 by mrrk

I’ve been working on managing my apps with Capistrano. I ran into what should have been a small problem getting Capistrano to work happily with RVM. This is a quick post about how I fixed the following exception:

$ cap deploy:update
/Users/mark/.rvm/gems/ruby-1.9.2-preview3/gems/capistrano-2.5.19/lib/capistrano/configuration/loading.rb:152:in `require': no such file to load -- rvm/capistrano (LoadError)
... from /Users/mark/.rvm/gems/ruby-1.9.2-preview3/gems/capistrano-2.5.19/lib/capistrano/configuration/loading.rb:152:in `require'
... from ./config/deploy.rb:13:in `load'
... from /Users/mark/.rvm/gems/ruby-1.9.2-preview3/gems/capistrano-2.5.19/lib/capistrano/configuration/loading.rb:93:in `instance_eval'
... from /Users/mark/.rvm/gems/ruby-1.9.2-preview3/gems/capistrano-2.5.19/lib/capistrano/configuration/loading.rb:93:in `load'
... from /Users/mark/.rvm/gems/ruby-1.9.2-preview3/gems/capistrano-2.5.19/lib/capistrano/configuration/loading.rb:172:in `load_from_file'

The first – incredibly obvious – thing I got wrong was to somehow think that the stacktrace was to do with the server. It isn’t of course. Even a cursory look at those paths shows that they’re OS X paths! Anyway… I could find anything similar on google so I figured that I’d posted this in case it’s helpful.

So, from the RVM documentation you get RVM to play nice with Capistrano by adding these lines:

$:.unshift(File.expand_path('./lib', ENV['rvm_path'])) # Add RVM's lib directory to the load path.
require "rvm/capistrano" # Load RVM's capistrano plugin.
set :rvm_ruby_string, 'ree@rails3' # Or whatever env you want it to run in.

It was the middle line that was throwing the exception and I wasted a bunch of time trying to work out why it couldn’t find the path on the server. Which was semi-reasonable (if it had been looking at the server) because the files were, indeed, present.

So, eventually, I realised that – fool that I am – I’d been looking in the wrong place and I noticed that the file was not present on my workstation. I updated RVM as per instructions and – voilà! – it works now.

原文地址:https://www.cnblogs.com/lexus/p/1910909.html