Use RVM
RVM allows you to manage different versions of Ruby and Gems. You can install the ruby version using, for example
rvm install 1.9.2
Then you can use it using:
rvm use 1.9.2
Use specific gems for each project with a gemset.
If you want to continue posting names, you can configure gemsets; catalogs that will contain specific gems for a particular project.
rvm gemset create myproject
then you can use them like this:
rvm use 1.9.2@myproject
Automation
To automate the process of switching gems, pop .ruby-version and .ruby-gemset files to the project root directory. Download the Ruby version and the gemset name that you want to use inside them, and RVM select the correct gemset when you enter the project directory.
Install gems in your gemset
Install your gems in your gemset in the usual way using bundler if you use it:
bundle install
or just using the plain old:
gem install mygem
Gems will go in the right gemset.
Alternatives to RVM
You can also check rbenv, which does a similar job.
superluminary Mar 20 '12 at 12:25 2012-03-20 12:25
source share