I am using a gem which is in vendor/gems/some-api-0.1.0
, copied over from another project, and added to Gemfile
:
gem 'some-api', :path => '~/development/myproj/vendor/gems/some-api-0.1.0'
but if I do the following, it will fail with the message:
$ bundle install
Fetching source index for http://rubygems.org/
Could not find gem 'some-api (>= 0)' in source at ~/development/myproj/vendor/gems/some-api-0.1.0.
Source does not contain any versions of 'some-api (>= 0)'
Searching on the net seem to suggest needing a gemspec? So I need to write up a .gemspec
some where, is that true? Can someone shred light of how it is done in this situation?
Select Tools | Bundler | Install from the main menu. Open the Gemfile, place the caret at any highlighted gem missing in the project SDK and press Alt+Enter . Select Install missing gems using 'bundler' and press Enter .
There are several ways to specify gem versions: Use a specific version: gem "name-of-gem", "1.0" . You can find specific versions on Rubygems.org (provided that's the source you”re using) by searching for your gem and looking at the “Versions” listed. Use a version operator: gem "name-of-gem", ">1.0" .
There are many other similar posts on stackoverflow, but just in case someone stumble across this post:
For some reason, when you are trying to use a gem from local source, you need to specify exactly which version of the gem you are using, e.g.
gem 'some-api', '0.2.0', :path => '~/development/myproj/vendor/gems/some-api-0.1.0'
Just claiming there is a gem in the :path doesn't mean there actually is a gem there. Gems have gemspec files describing the name of the gem, what files belong to the gem, and various other information.
If some-api-0.1.0
should contain a file named some-api.gemspec
in the :path directory, and it should contain information about the gem that bundler could use to require the gem out of the :path.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With