Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Bundler::GemfileNotFound: Could not locate Gemfile #6

Closed
radarek opened this Issue · 13 comments

2 participants

Radosław Bułat Sebastian Staudt
Radosław Bułat
>> require "metior"
=> true
>> Metior.simple_stats :git, '~/project/'
Bundler::GemfileNotFound: Could not locate Gemfile
    from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/shared_helpers.rb:22:in `default_gemfile'
    from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler.rb:195:in `default_gemfile'
    from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler.rb:165:in `root'
    from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler.rb:124:in `load'
    from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler.rb:115:in `setup'
    from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/metior-0.1.1/lib/metior/vcs.rb:67:in `init'
    from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/metior-0.1.1/lib/metior/vcs.rb:24:in `vcs'
    from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/metior-0.1.1/lib/metior.rb:29:in `repository'
    from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/metior-0.1.1/lib/metior.rb:40:in `simple_stats'
    from (irb):3
Sebastian Staudt
Owner

Argh... looks like a real show-stopper. Thanks for reporting.

Should be fixed real soon.

Sebastian Staudt koraktor closed this in c4f1380
Radosław Bułat

I wonder if it's ok that metior library depends on bundler? I mean if there could be some problem when my application use metior and bundler itself? It's kinda strange because AFAIK gem have to list all hist dependency in gemspec. So why bundler is needed?

Sebastian Staudt
Owner

To be honest, I thought about that myself. Right now, I decided that it's ok to depend on Bundler itself. But that's because I couldn't find a statement like "Don't depend on Bundler".

The main reason for using Bundler inside the code is because I want to require the right dependencies. Just having e.g. Octokit 0.6.3 as a dependency doesn't mean that require will load that version when relying on RubyGems. Using Bundler.setup and Bundler.require 'octokit' (or Bundler.require :github like Metior does) ensure that the right version is required. I think that's a somewhat special, but at least in my understanding absolutely legal use of Bundler.

If you have any concerns please let me know.

Radosław Bułat

Just having e.g. Octokit 0.6.3 as a dependency doesn't mean that require will load that version when relying on RubyGems.

AFAIK if you specify version 0.6.3 then exactly this version would be used by rubygems (if it make conflict with other gem then it fail with runtime error). If it wasn't like that rubygems would be useless, don't you think?:)

Btw, after installing 0.1.2 version I still have error related to bundler...

>> require "metior"
Bundler::GemNotFound: Could not find multipart-post-1.1.1 in any of the sources
    from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/spec_set.rb:87:in `materialize'
    from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/spec_set.rb:81:in `map!'
    from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/spec_set.rb:81:in `materialize'
    from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/definition.rb:90:in `specs'
    from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/definition.rb:135:in `specs_for'
    from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/definition.rb:124:in `requested_specs'
    from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/environment.rb:23:in `requested_specs'
    from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler/runtime.rb:11:in `setup'
    from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-1.0.14/lib/bundler.rb:107:in `setup'
    from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/metior-0.1.2/lib/metior.rb:10
    from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/metior-0.1.2/lib/metior.rb:9:in `chdir'
    from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/metior-0.1.2/lib/metior.rb:9
    from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:59:in `gem_original_require'
    from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:59:in `require'
    from (irb):3
Sebastian Staudt
Owner

AFAIK if you specify version 0.6.3 then exactly this version would be used by rubygems (if it make conflict with other gem then it fail with runtime error). If it wasn't like that rubygems would be useless, don't you think?:)

If that is true, I'll probably drop using Bundler in code. Do you have a proof for that?

About that error: That seems strange. Is multipart-post-1.1.1 installed in your environment?

Radosław Bułat

If that is true, I'll probably drop using Bundler in code. Do you have a proof for that?

http://docs.rubygems.org/read/chapter/4#page71
I forgot that you have to use "gem" method (described above).

About that error: That seems strange. Is multipart-post-1.1.1 installed in your environment?

$ gem list multipart-post
*** LOCAL GEMS ***

multipart-post (1.1.2)

It was installed with metior.

Sebastian Staudt koraktor reopened this
Sebastian Staudt
Owner

Ah fine. Looks like using Bundler directly isn't a good idea. Although it would be cool if it worked and Bundler and RubyGems would be more integrated into each other.

The problem here is that Gemfile.lock contains multipart-post-1.1.1 and that's what Bundler wants to load.
A workaround would be to install multipart-post-1.1.1 using gem install multipart-post -v 1.1.1.

It looks like the best solution would be to drop at least for the moment and load the dependencies manually (at least more manual than right now).

Thanks for your help.

Sebastian Staudt
Owner

I now took a slightly different approach in d2ec068 which should fix any Bundler related problems. I don't think that's something currently really supported by Bundler, but it works and I think it's a great way to not only manage dependencies, but also require them safely.

Radosław Bułat

Very nice! Now it's obvious that bundler should be integrated with rubygems.

Sebastian Staudt
Owner

Glad to see you like it.

So this can be closed now?

Sebastian Staudt koraktor closed this
Sebastian Staudt
Owner

Ok, I'll close this for now. Let's see how 0.1.3 performs. :)

Radosław Bułat

Sorry for late response. Yes, now it works fine for me :).

Sebastian Staudt koraktor referenced this issue from a commit
Sebastian Staudt Stop using Bundler for requiring dependencies
This won't work for projects without an own Gemfile. Seems like Bundler
just isn't ready for such "external" use yet. See issue #6.
Aside from that, RubyGems should handle dependencies well enough.
808b0f3
Sebastian Staudt
Owner

That last commit did finally remove that feature, although I still like the idea and I'd love to see Bundler support that kind of use.

Right now it's not possible to use Bundler if the running code (i.e. a project using Metior) doesn't have an own Gemfile. Although it's not used, it has to exists.

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.