Reputation: 151126
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?
Upvotes: 6
Views: 6362
Reputation: 528
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'
Upvotes: 26
Reputation: 3490
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.
Upvotes: 1