rubygems / bundler

Manage your Ruby application's gem dependencies
https://bundler.io
MIT License
4.88k stars 2k forks source link

Could not find gem X in source at vendor/gems/X #823

Closed taryneast closed 13 years ago

taryneast commented 13 years ago

I'm upgrading our app to rails 3 - including starting to use bundler. We've got a modified version of the ruby-smpp gem in vendor/gems that we've been successfully using for years now - and I can't seem to get bundler to recognise it.

It's installed in vendor/gems/ruby-smpp-0.1.0

In Gemfile I've got: gem 'ruby-smpp', :path => 'vendor/gems/ruby-smpp-0.1.0'

When I run gem bundle (with or without :path => 'vendor/gems') I get:

Could not find gem 'ruby-smpp (>= 0, runtime)' in source at /vendor/gems/ruby-smpp-0.1.0. Source does not contain any versions of 'ruby-smpp (>= 0, runtime)'

When I tried just: gem 'ruby-smpp' it only loaded the real gem and not our modified version. I also tried gem 'ruby-smpp', '0.1.0' and gem '0.1.0', :path => 'vendor/gems' to no avail.

am i invoking the gem incorrectly? If so - how should I do it?

indirect commented 13 years ago

You should only put an entry into the Gemfile if you have a full gem located at that path, which includes the .gemspec file. The gemspec is required for Bundler to work.

On the other hand, it sounds like you've just been using the expanded gem by requiring it, so I'm not sure why you would need Bundler to manage that gem anyway.

taryneast commented 13 years ago

Just by way of explanation: the new rails seems to need me to declare it as a gem for me to require stuff inside of it... eg I can require 'smpp' but if I try to require 'smpp/server' in config/envinroment.rb then it goes boom unless I add the gem to my Gemfile.

taryneast commented 13 years ago

So indirect - Your answer provokes another question: how to I add a .gemspec to my gem directory or how do I otherwise work with it, (because requiring it no longer works)...

If I were doing this "fresh" I could "gem unpack"... but it's too late for that. "rake gems:refresh_specs" throws some other error about a missing Manifest.txt file...

indirect commented 13 years ago

If you want to require something, you should add its directory to the load path and then require it.

If you need more help, I suggest reading up on how Ruby handles requiring things, and managing the $LOAD_PATH variable.