Git sourced gems are not built then installed as advertised #1502

Closed
mrzor opened this Issue Oct 26, 2011 · 9 comments

3 participants

@mrzor

Issue

I'm running into an issue with git sourced gems. Basically, if the gem specifies any binary, they won't work through rubygems, despite a wrapper being installed in gems/bin directory.

This probably has something to do with the following :

source "http://rubygems.org"
gem "my_tool_in_a_gem", :git => "git@github.com:whatever/tool.git"

bundle exec my_tool works properly and makes up for a workaround.

gem list -l | grep my_tool gives nothing. As far as rubygems is concerned, the gem is not there, despite the generic (rubygems generated) wrapper being available in gems/bin directory.

Not as advertised

Gemfile.5 manpage:

To install a gem located in a git repository, bundler changes to the directory containing the gemspec, runs gem build name.gemspec and then installs the resulting gem. The gem build command, which comes standard with Rubygems, evaluates the .gemspec in the context of the directory in which it is located.

Probable cause

I'm fairly confident the gemspec is valid, i.e. gem build my_tool.spec; gem install my_took.gem works properly.

I'm running bundler 1.0.21, and this comment in source.rb appears to state what I'm having is intended behavior. Master branch as of today seems identical.

Please reconsider the committed position on this issue : imo, building the whole gem and installing it is worth the extra mile.

@indirect
Bundler member
@indirect
Bundler member

(The gem build process is invoked, but git gems are "installed" into the bundle, not into rubygems. If there is a rewording that would make that clearer, I would be happy to change it.)

@indirect indirect closed this Oct 26, 2011
@mrzor

runs gem build name.gemspec and then installs the resulting gem.

This is, imo, what should be reworded. I read this as bundler installs the resulting gem into rubygems whereas, what you're saying is the resulting gem is made available in the bundle, i.e. through Bundler.setup or bundle exec

Also, why is there any gems/bin wrapper generation in the first place ? The generated wrapper (something like require rubygems; require my_tool) can't possibly work.

@indirect
Bundler member
@agnellvj

So I have this exact problem, what is the solution? I need to install a gem via an forked git repo.

@mrzor

bundle exec tool works properly and makes up for a workaround. (as per first post)

@indirect
Bundler member

Just to make things perfectly clear: Bundler does not install gems from git. Ever. Bundler does let you use gems from git, if you run bundle exec foo where foo is the name of an executable that ships with that gem. If you need to install a gem from git, don't use Bundler. Check out the repository, build the gem, and install it with gem install foo.gem. Thanks!

@agnellvj

So essentially I now have to manage my own dependencies because it isn't a pre-built gem? What's the point of bundler now?

The assumption here is that I am using a command line utility, I am not. Also that I am using this on a rails project, again I am not.

http://yehudakatz.com/2010/09/30/bundler-as-simple-as-what-you-did-before/

@indirect
Bundler member

What? Read the Bundler docs at http://gembundler.com for details, but here's the short version: You list the gems you need in your Gemfile, run bundle install, and then run require 'bundler/setup' inside your Ruby code. That's it. Bundler doesn't install git gems, it just lets you use them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment