Reputation: 24896
I have several versions of a Ruby gem installed on my machine. I'm using one version for development, but the other is used for production and deployment, so I need them both. Is there a simple way to specify which version of the gem should be used?
Since they are the same gem, their binary names conflict, and I have to physically remove one or the other from the gems directory and leave the other one that I want to keep active. But I'd like to be able to jump back and forth between development and production gems, and I am hoping there is a better way.
Edit: I guess I should have make it more clear. When I said development, I meant development of the gem, not the "Rails development environment." So what I'm doing is I forked a gem from Github, and I am using both my fork and the original gem from the commandline. Not as part of Rails.
Upvotes: 1
Views: 6859
Reputation: 4392
See the Rubygems manual. Pretty sure this is still valid in Rails 3.
For example:
require 'rubygems'
gem 'activerecord', '= 1.4.0'
Other valid operators (in lieu of =
) are >
, >=
, <
, <=
; I believe they also take the ~
modifier.
Update (2014-03-09): The original Rubygems manual page no longer exists due to a redesign; please refer to the Bundler documentation instead, under the GEMS > VERSION section.
Upvotes: 4