Reputation: 5800
I have a local gem and a rails app that uses the local gem.
Is there a way to specify a specific version of the gem?
I know that 'rake install' generates *.gem in /pkg directory of the gem. But I don't know how to use it.
Here's how I use it now:
In Gemfile:
gem 'mygem', path: '~/shared/mygem'
Thanks.
Sam
Edit:
I think my question is almost a duplicate of How to tell the Gem File to use a specific local copy of a gem.
I just need to know how to specify a specific version of a local gem.
Upvotes: 0
Views: 1749
Reputation: 51
To specify versions, or more specifically, a range of versions, you use operators like you would in ruby code.
The operators should be:
>=
, <=
, =
, or ~>
Ranges allow that it may not be possible to match the exact version number (especially true for Windows-specific gem builds).
The pessimistic operator (~>
) is often considered the best choice, as it stays within the same dot-range as the build you are using (1.0.4 would never reach 1.1.0, but could use anything between).
An example of the gemfile syntax:
gem 'sinatra', '~> 1.4.4'
or
gem 'uglifier', '= 1.3.0'
Upvotes: 0
Reputation: 375
In Gemfile:
gem 'mygem', path: '~/shared/mygem', branch: 'branch name'
Or use ref: 'commit number' if your version is in a specific commit
Upvotes: 1