Given any Ruby on Rails project folder, can you tell it was Rails 2.3.5 and Ruby 1.8.7 that was used for the project?
So that if you have a Ruby Version Manager, then yo开发者_运维问答u can switch to that mode first before altering the project files. (probably best)
You can set an .rvmrc file in your project directory, so that you will automatically change to a particular ruby and gemset when you enter the directory. Check out the rvmrc docs for details.
This method doesn't infer versions from the project files, though. If you really wanted to infer Rails version you could put a little script in your .rvmrc file:
RAILS_VERSION=`ruby -e "require 'config/environment'; puts RAILS_GEM_VERSION"`
精彩评论