網頁

2011年8月2日 星期二

切換rails rake 版本 (Switching rails rake version)


有些時候取得一些 rails 的程式,要執行  rake db:create  時會發生

You have already activated rake 0.9.x, but your Gemfile requires rake 0.x.x

這是會想要切換版本

$rake -V   # v大寫可以得到目前rake 的版本

想要改變rake 版本要直接修改rake設定檔 
執行編輯
vim ~/.rvm/gems/ruby-1.8.7-p334/bin/rake
修改裡面的 version  =  "0.X.X"   改成你想預設的版本

$ vim ~/.rvm/gems/ruby-1.8.7-p334/bin/rake

#!/home/tomcat/.rvm/rubies/ruby-1.8.7-p334/bin/ruby
#
# This file was generated by RubyGems.
#
# The application 'rake' is installed as part of a gem, and
# this file is here to facilitate running it.
#
require 'rubygems'
version = ">= 0"
if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then
  version = $1
  ARGV.shift
end
gem 'rake', version
load Gem.bin_path('rake', 'rake', version)

沒有留言:

張貼留言

LinkWithin

Related Posts with Thumbnails