In Rails 3's "bundle install" of local gem (frozen gem), keep getting "Source does not contain any versions of ..."?
Asked Answered
H

2

6

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?

Hhour answered 21/3, 2011 at 18:3 Comment(2)
Not sure if this is the case, but perhaps it's the ~ reference to your home directory? Try an absolute path instead (eg. /Users/username/development/myproj..."Negligible
Is this a gem you created or public gem?Rickettsia
C
26

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'
Cwm answered 15/10, 2012 at 12:41 Comment(1)
This answer wasn't working for me. But then I re-cloned my local gem and it worked again. So maybe me gem directory was corrupt in some way.Showmanship
P
1

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.

Panhellenic answered 12/5, 2011 at 18:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.