Stable Bundler API for for navigating other Gemfile dependencies #509

nicksieger opened this Issue Jul 27, 2010 · 7 comments


None yet

5 participants


In Warbler, I want to be able to navigate another project's dependencies. Right now, I have code which does:

    require 'bundler'
    gemfile ="Gemfile").expand_path
    root = gemfile.dirname
    lockfile = root.join('Gemfile.lock')
    definition =, lockfile, nil)
    env =, definition)
    env.requested_specs.each {|spec| @gems << spec }

Yehuda says this is fine, but may not stay that way. Going forward, if we could have a recommended API that does not cache instances in Bundler.load/Bundler.definition etc. so this kind of inspection would be possible, that would be great.


I think, although I am not sure, that Bundler.load.specs provides this. Is that what you need?


Sort of. I need to replicate the same behavior as Bundler.load.requested_specs, but without the Bundler::Runtime instance caching that Bundler.load does.

ahamid commented Jan 26, 2011

As an aside, and before opening a separate feature request, is it crazy to hope that if such an API exists, that it would be possible to re-invoke Bundler while already running in a Bundler context? For example, in the case of a plugin architecture, to load additional dependencies which may be described in a separate Gemfile than the top-level application Gemfile.


@ahamid, what you're describing is just Rubygems without Bundler. The thing that Bundler does that Rubygems doesn't do is guarantee that all your gems are already present and able to load without dependency conflicts -- which is impossible in the scenario you describe, and exactly why Bundler was written in the first place. :)

ahamid commented Jan 26, 2011

Thanks indirect. The nice thing about Bundler is that the --deployment flag allows you to statically resolve and package required gems with your distribution. So perhaps there is a way to accomplish what I describe with static bundling combined the use of the rubygems API at runtime.


Related to this, and similar to what @ahamid describes, is RVM's RVM.use! and RVM.gemset_use!.
Given that rbenv defers to Bundler for Gemset management, it will useful to have a Bundler counterpart to the RVM API methods just cited, say:

 Bundle.require(:othergroup, :gemfile => '/path/to/other/Gemfile')

Pending that is there a recommended Bundler workaround?

ixti commented Jul 7, 2013

I don't think it's an issue. Thus should be closed.
/cc @indirect

@ixti ixti closed this Jul 8, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment