Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Can we get a :system option for :git gems? #880

Closed
jasonadamyoung opened this Issue · 5 comments

4 participants

@jasonadamyoung

(or optionally: Need Bundler::Source::Git#load_spec_files to respect Bundler.install_path even with require_sudo? :-)

I just upgraded my first Rails2 app to Rails3 this weekend and had my first dive-in with Bundler - so bear with me a bit. I'm also approaching this with a sysadmin/project manager hat first, and I might be missing something completely.

I'm running into the same issue as reported here: http://www.ruby-forum.com/topic/213962#947322 - and I'm not really sure if the :dest option mentioned in #396 - or plans alluded to in #596 and #577 about :git/:path improvements for 1.1 are going to cover my use case.

Here's my use case. I've got certain gems like will_paginate that the rubygems.org gem isn't ready for Rails3 yet - which no matter, the bundler :git option works great, just throw in a

gem 'will_paginate', :git => 'git://github.com/mislav/will_paginate.git', :branch => "rails3"

And I'm good to go. All my devs can get it on their local machines, straight from the source. And in theory, the sysadmin only has to do a bundle install as root (or sudo) off the same Gemfile, and install it along with the other system gems.

In practice, this doesn't work out. Bundler happily installs the gem in the central "#{Gem.dir}/bundler/gems", but because the apache/passenger user is a mere mortal, along with the rest of the devs, I'm getting Bundle::GitError raised, because it's trying to enumerate the spec files in Bundler.user_bundle_path.join(Bundler.ruby_scope) instead of the central Bundler.install_path

Not exactly what I was expecting, I was expecting that git installed gems would act like the system gems after they were installed, a sysadmin could work off the some Gemfile, but still control the installed Gems. I understand, to a certain extent, the logic behind sticking the installed gems in bundler/gems. It'd be nice to override that behavior.

I hoped that using an app-defined BUNDLE_PATH would work (a "#{Rails.root}/.bundle/config" symlinked off to something defined statically in the shared path). That actually works out okay, although the path ends up being "#{Gem.dir}/#{Bundler.ruby_scope}" due to the path setup in Bundler::Settings. That was definitely unexpected. (If I can't get something like /etc/bundler/config - the per app one could work - but it'd be nice if you set it to be Gem.dir - it wouldn't get Bundler.ruby_scope appended).

Here's what I'd like considered, if possible.

Perhaps a :system flag for :git gems (or even all gems) - it would force the gem to be installed with the rest of the system gems ala bundle install --system - this would work on most dev machines just fine, and sysadmins could do it on servers. That way it shows up in gem list as expected.

It'd be nice if the :system flag was present to then just enumerate it like the rest of the gems at runtime and not bother with the load_spec_files - at least for the "check" runtime. I understand doing it for install and other "write" commands.

Failing that, maybe if BUNDLE_PATH could be BUNDLE_PATH without the ruby_scope appended, that might give me a fallback.

Failing all that, I can go back to running my own gem server for the system and devs (which we largely do now), and just build what gems I need, but I love the :git option convenience.

@cookbooks

You might find this fork useful:

https://github.com/hedgehog/bundler/tree/chef

I haven't added an :install_path switch to Bundler's git but that would be useful to me too.
At the moment that fork should respect bundle --install-path and export BUNDLE_INSTALL_PATH; bundle ....
See the install_path_spec.rb for some specs.

Still a WIP so patches and suggestions welcome.

@hedgehog

I've got the Bundler spec suite running, plus the added features and modulo false positive specs that I eliminated.
Not sure if the install-path control (and removal of git hash decoration) provided by this pull request does what you need?

@jasonadamyoung

sorry, I apologize, I've checked out the changes - and maybe but I'm not sure I grok everything just reading through the changes. I'm going to have to sit down, build it, and try it out, and I have not had/made that time yet (I got around my specific issue with will_paginate by doing a gem install --pre). I'd love to do that soon, but I'm not sure when I will. I appreciate you guys commenting in here while you work on it for the other issues.

@hedgehog

I closed that pull request. I should be making another off the 1.1.pre.1 tag... keep an eye on the pull queue.

@radar
Collaborator

I believe this problem is solved with the --deployment option for Bundler, covered here.

@radar radar closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.