rubygems / bundler

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

Problem specifying alternate library name with :git scheme #979

Closed minter closed 11 years ago

minter commented 13 years ago

I'm running into an odd situation, and I don't know if I'm missing something in my code, or if there's a bundler configuration option that I'm missing.

I have a fork of the thoughtbot paperclip gem located at https://github.com/minter/paperclip - the gemspec is called paperclip-cloudfiles.gemspec.

If I build and install the gem locally, and add the following line to my Gemfile, my Rails 3.0.3 sample app works fine:

gem 'paperclip-cloudfiles', '2.3.8', :require => 'paperclip' 

However, if I try to load the gem directly from git: gem 'paperclip-cloudfiles', :git => 'http://github.com/minter/paperclip.git', :require => 'paperclip'

The gem doesn't load properly (my app throws an error with "undefined method `has_attached_file' for #Class:0x1036fa410").

Looking through the docs at http://gembundler.com/git.html , I'm not seeing any mention of being able to pass :require when you load a gem from git. Is it possible that the :require option is being ignored, and thus loading the gem with a different name than the gemspec is failing because of it?

Or am I missing something else?

hedgehog commented 13 years ago

No you are not missing something else. This is definitely a bug, as at tag 1.1.pre.1 More confirmation that Bundler's specs are as useful in guarding against buggy behavior as Pixie Dust is guarding against pneumonia... but I digress.

Good news is I have a fix that works as far as I can tell. should be posting a pull request is the days ahead.

hedgehog commented 13 years ago

Would this qualify as working?

$ cat <<-EOT >Gemfile
source :rubygems
gem "paperclip-cloudfiles",:git => "http://github.com/minter/paperclip.git",:require => 'paperclip'
EOT

$ bundle install
<snip>

$ irb -rubygems
ruby-1.9.2-p0 :001 > require "bundler"
 => true 
ruby-1.9.2-p0 :002 > Bundler.setup
<snip>
ruby-1.9.2-p0 :003 > Paperclip.constants
 => [:VERSION, :Upfile, :Geometry, :Processor, :Tempfile, :Thumbnail, :Interpolations, :Style, :Attachment, :Storage, :CallbackCompatability, :CommandLine, :Railtie, :PaperclipError, :PaperclipCommandLineError, :StorageMethodNotFound, :CommandNotFoundError, :NotIdentifiedByImageMagickError, :InfiniteInterpolationError, :Glue, :ClassMethods, :InstanceMethods]
minter commented 13 years ago

That looks pretty solid to me!

hedgehog commented 13 years ago

Could you pull down and build the chef branch in my Bundler fork, to see if that breaks anything for you?

If you can, add any problems/comments here. Thanks

sathishinlinux commented 12 years ago

Help Need, When i Run the command bundle install it says the below error. what i do?

bundle install Updating https://github.com/minter/paperclip.git error: RPC failed; result=56, HTTP code = 0 fatal: The remote end hung up unexpectedly Git error: command git fetch --force --quiet --tags 'https://github.com/minter/paperclip.git' "refs/heads/*:refs/heads/*" in directory /home/sathish/.rvm/gems/ruby-1.9.2-p290/cache/bundler/git/paperclip-379b3e231abef29faa19aa0efb44f730e6a204ad has failed. If this error persists you could try removing the cache directory '/home/sathish/.rvm/gems/ruby-1.9.2-p290/cache/bundler/git/paperclip-379b3e231abef29faa19aa0efb44f730e6a204ad'

hedgehog commented 12 years ago

@sathishinlinux I'd be wary of using Bundler with remote Git repos, lots of bugs/issues. Your best bet might be to pull down a local copy and use :path. I have effectively abandoned my efforts to improve Bundler's git support - it was nigh impossible given the state of the spec suite and code base.

Sorry I couldn't be of more help.

mscottford commented 11 years ago

This still appears to be working https://gist.github.com/4583418.

indirect commented 11 years ago

I guess the fix made it in at some point. Awesome. :) Closing this ticket.