2011-07-14 14 views
7

Mam aplikację Rails, którą wdrażałem w Capistrano. Po zainstalowaniu na serwerze RVM ponieważ chciałem użyć nowszej wersji Ruby i dodaje to do mojego pliku deploy.rb (na różnych instrukcji znalazłem):Nie mogę wdrożyć aplikacji Railsowej z Capistrano i RVM

$:.unshift(File.expand_path('./lib', ENV['rvm_path'])) 
require 'rvm/capistrano' 
set :rvm_ruby_string, '1.9.2' 
set :rvm_type, :user 

Kiedy biegnę, cap deploy, tak się dzieje:

[staging.example.com] executing command 
** [out :: staging.example.com] /usr/local/lib/site_ruby/1.8/rubygems.rb:779:in `report_activate_error': Could not find RubyGem bundler (>= 0) (
** [out :: staging.example.com] Gem::LoadError) 
** [out :: staging.example.com] from /usr/local/lib/site_ruby/1.8/rubygems.rb:214:in `activate' 
** [out :: staging.example.com] from /usr/local/lib/site_ruby/1.8/rubygems.rb:1082:in `gem' 
** [out :: staging.example.com] from /usr/bin/bundle:18 
    command finished in 801ms 
*** [deploy:update_code] rolling back 
    * executing "rm -rf /home/example/staging.example.com/releases/20110714180125; true" 
    servers: ["staging.example.com"] 
    [staging.example.com] executing command 
    command finished in 895ms 
    failed: "rvm_path=$HOME/.rvm/ /usr/local/bin/rvm-shell '1.9.2' -c 'bundle install --gemfile /home/example/staging.example.com/releases/20110714180125/Gemfile --path /home/example/staging.example.com/shared/bundle --deployment --quiet --without development production'" on staging.example.com 

Dlaczego capistrano używa Ruby 1.8? Moja ścieżka jest oczywiście również pomieszana.

Oto wyjście rvm info na staging.example.com:

ruby-1.9.2-p180: 

system: 
    uname:  "Linux staging 2.6.39.1-linode34 #1 SMP Tue Jun 21 10:29:24 EDT 2011 i686 GNU/Linux" 
    bash:  "/bin/bash => GNU bash, version 4.1.5(1)-release (i486-pc-linux-gnu)" 
    zsh:   " => not installed" 

rvm: 
    version:  "rvm 1.6.22 by Wayne E. Seguin ([email protected]) [https://rvm.beginrescueend.com/]" 

ruby: 
    interpreter: "ruby" 
    version:  "1.9.2p180" 
    date:   "2011-02-18" 
    platform:  "i686-linux" 
    patchlevel: "2011-02-18 revision 30909" 
    full_version: "ruby 1.9.2p180 (2011-02-18 revision 30909) [i686-linux]" 

homes: 
    gem:   "/home/example/.rvm/gems/ruby-1.9.2-p180" 
    ruby:   "/home/example/.rvm/rubies/ruby-1.9.2-p180" 

binaries: 
    ruby:   "/home/example/.rvm/bin/ruby" 
    irb:   "/home/example/.rvm/bin/irb" 
    gem:   "/home/example/.rvm/bin/gem" 
    rake:   "/home/example/.rvm/bin/rake" 

environment: 
    PATH:   "/home/example/.rvm/bin:/home/example/.rvm/gems/ruby-1.9.2-p180/bin:/home/example/.rvm/gems/[email protected]/bin:/home/example/.rvm/rubies/ruby-1.9.2-p180/bin:/home/example/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/ruby/bin" 
    GEM_HOME:  "/home/example/.rvm/gems/ruby-1.9.2-p180" 
    GEM_PATH:  "/home/example/.rvm/gems/ruby-1.9.2-p180:/home/example/.rvm/gems/[email protected]" 
    MY_RUBY_HOME: "/home/example/.rvm/rubies/ruby-1.9.2-p180" 
    IRBRC:  "/home/example/.rvm/rubies/ruby-1.9.2-p180/.irbrc" 
    RUBYOPT:  "" 
    gemset:  "" 
+1

Czy korzystasz z pliku .rvmrc Twój projekt? Jeśli tak, to czy wskazuje na właściwy rubin i klejnot? –

+0

Oto, co jest w moim .rvmrc: 'rvm_gemset_create_on_use_flag = 1 rvm_trust_rvmrcs_flag = 1' Nie wiem, jak zrobić to, co sugerujesz. – Devin

+0

Przepraszam za spóźnioną odpowiedź. Plik .rvmrc służy do określenia, który ruby ​​i gemset chcesz użyć w tym projekcie. Zwykle tworzę kopalni w następujący sposób:> echo "rvm [email protected]"> .rvmrc Teraz, kiedy wejdę do tego katalogu, rvm automatycznie przełączy się na wersję Ruby 1.9.2 i zmieni mój gemset na myproject. –

Odpowiedz

2
 
failed: "rvm_path=$HOME/.rvm/ /usr/local/bin/rvm-shell '1.9.2' -c 'bundle install --gemfile /home/example/staging.example.com/releases/20110714180125/Gemfile --path /home/example/staging.example.com/shared/bundle --deployment --quiet --without development production' 

Upewnij się, że zainstalowany Bundler i właściwą drogę podczas jazdy bundle install w serwerze. Jeśli nie jest zainstalowany, uruchom instalację gem install bundler.

1

Jeśli masz zainstalowany Bundler, to zrobić:

Zmiana ta linia ->set :rvm_ruby_string, '1.9.2'

do tego ->set :rvm_ruby_string, 'ruby-1.9.2-p180'

to działa na mnie.

znać swoje RUBYS wersje ->rvm list

3

Właściwie najnowsze dokumenty dotyczące RVM-capistrano stronie dokumentacji stwierdził, że musi to być coś takiego:

# RVM bootstrap: change to your Ruby and GemSet 
require 'rvm/capistrano' 
set :rvm_ruby_string, ENV['GEM_HOME'].gsub(/.*\//,"") 
set :rvm_type, :user 
Powiązane problemy