1

Rails 3.2.2在我的開發環境和我的服務器上都能正常工作。爲什麼不在我的服務器上捆綁安裝railties 3.2.3?

我試圖通過改變升級到3.2.3:

gem 'rails', '3.2.2' 

gem 'rails', '3.2.3' 

然後運行:

bundle update 
bundle 

一切順利,直到我嘗試部署到我的服務器。在部署,我得到這個消息:

An error occured while installing railties (3.2.3), and Bundler cannot continue. 
Make sure that `gem install railties -v '3.2.3'` succeeds before bundling. 

我已經登錄到服務器並運行創業板安裝railties -v「3.2.3」命令和它的作品沒有任何問題。但部署總是以相同的方式失敗。

我試着刪除緩存目錄,如here所示,但我不知道我是否正確地做到了這一點。我在服務器和我的開發環境中使用rvm。

有人能幫我指出一個方向嗎?

這是我的deploy.rb文件:

require "bundler/capistrano" 

$:.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 :application, "teamsite" 
set :repository, "[email protected]:user/teamsite.git" 
set :deploy_to, "/home/website.com/rails/application/" 
set :user, "website.com" 
set :scm, :git 
set :use_sudo, false 
default_run_options[:pty] = true 
set :branch, "master" 
set :scm_verbose, true 
set :deploy_via, :remote_cache 
ssh_options[:forward_agent] = true 

task :staging do 
    role :web, "staging.website.com" 
    role :app, "staging.website.com" 
    role :db, "staging.website.com", :primary => true 
end 

namespace :deploy do 
    task :start do ; end 
    task :stop do ; end 
    task :restart, :roles => :app, :except => { :no_release => true } do 
    run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}" 
    end 

    namespace :assets do 
    task :precompile, :roles => :web, :except => { :no_release => true } do 
     from = source.next_revision(current_revision) 
     if capture("cd #{latest_release} && #{source.local.log(from)} vendor/assets/ app/assets/ | wc -l").to_i > 0 
     run %Q{cd #{latest_release} && #{rake} RAILS_ENV=#{rails_env} #{asset_env} assets:precompile} 
     else 
     logger.info "Skipping asset pre-compilation because there were no asset changes" 
     end 
    end 
    end 
end 

namespace :customs do 
    task :create_symlink, :roles => :app do 
    run <<-CMD 
     ln -nfs #{shared_path}/files #{release_path}/files 
    CMD 

    run <<-CMD 
     ln -nfs #{shared_path}/drawings #{release_path}/drawings 
    CMD 

    run <<-CMD 
     ln -nfs #{shared_path}/photos #{release_path}/photos 
    CMD 
    end 
end 

after "deploy:create_symlink","customs:create_symlink" 
after "deploy", "deploy:cleanup" 

更新

我能夠最終被部署到不同的用戶解決這個問題。但問題仍然存在:我如何清除舊用戶的寶石緩存?

+0

請把你的腳本 – mpapis 2012-04-13 17:48:20

回答

3

你可以使用

gem pristine --all --no-extensions 

重新安裝從頭開始你的所有寶石。如果您在主機上使用乘客,則需要查找該gem高速緩存目錄的真實位置。看看.bashrc中的GEM_PATH值,Dreamhost上我的是:

export GEM_PATH="$GEM_HOME:/usr/lib/ruby/gems/1.8" 

或者,如果您使用的服務器上RVM,這條道路是可能的當前版本RVM使用。

相關問題