Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Gemfile is evaluated twice when a lockfile exists #3096

Closed
grosser opened this issue Jul 12, 2014 · 7 comments
Closed

Gemfile is evaluated twice when a lockfile exists #3096

grosser opened this issue Jul 12, 2014 · 7 comments

Comments

@grosser
Copy link
Contributor

grosser commented Jul 12, 2014

#Gemfile
puts "WUT"

no Gemfile.lock -> WUT
with Gemfile.lock -> WUTWUT

tracked it down to this guy: https://github.com/bundler/bundler/blob/master/lib/bundler/installer.rb#L63-L71

I guess it should reuse the definition from https://github.com/bundler/bundler/blob/master/lib/bundler/cli/install.rb#L77-L78

not only bundle install also bundle exec ruby -e 1 evaluates the Gemfile twice, so basically every bundle run could save a few miliseconds

@indirect
Copy link
Member

Theoretically, that first attempt will be the only attempt if the needed gems are already present. It's probably possible to skip evaluating the Gemfile twice, though.

On Sat, Jul 12, 2014 at 3:34 PM, Michael Grosser notifications@github.com
wrote:

#Gemfile
puts "WUT"

no Gemfile.lock -> WUT
with Gemfile.lock -> WUTWUT
tracked it down to this guy: https://github.com/bundler/bundler/blob/master/lib/bundler/installer.rb#L63-L71
I guess it should reuse the definition from https://github.com/bundler/bundler/blob/master/lib/bundler/cli/install.rb#L77-L78

also bundle exec ruby -e 1 evaluates the Gemfile twice, so basically every bundle run could save a few miliseconds

Reply to this email directly or view it on GitHub:
#3096

@grosser
Copy link
Contributor Author

grosser commented Jul 13, 2014

Still happens when all gems are present, so happens every time.

On Sat, Jul 12, 2014 at 10:24 PM, André Arko notifications@github.com
wrote:

Theoretically, that first attempt will be the only attempt if the needed
gems are already present. It's probably possible to skip evaluating the
Gemfile twice, though.

On Sat, Jul 12, 2014 at 3:34 PM, Michael Grosser notifications@github.com

wrote:

#Gemfile
puts "WUT"

no Gemfile.lock -> WUT
with Gemfile.lock -> WUTWUT
tracked it down to this guy:
https://github.com/bundler/bundler/blob/master/lib/bundler/installer.rb#L63-L71
I guess it should reuse the definition from
https://github.com/bundler/bundler/blob/master/lib/bundler/cli/install.rb#L77-L78
also bundle exec ruby -e 1 evaluates the Gemfile twice, so basically

every bundle run could save a few miliseconds

Reply to this email directly or view it on GitHub:
#3096


Reply to this email directly or view it on GitHub
#3096 (comment).

@ejaypcanaria
Copy link
Contributor

The Gemfile needs to have at least one gem statement to reproduce this issue.

@segiddins
Copy link
Member

So I took a look, and the second evaluation happens at https://github.com/bundler/bundler/blob/master/lib/bundler/installer.rb#L69, where it's checked whether we need to do a local install.

@segiddins
Copy link
Member

I have a fix for this that I'll PR in a minute

@coilysiren
Copy link
Contributor

If anyone wants to help with segiddins's PR for this, that's here -> #4417

homu added a commit that referenced this issue Sep 10, 2016
[Installer] Skip eval’ing a Gemfile twice when there’s a lockfile

Closes #3096. Closes #4417.

\c @indirect
@segiddins
Copy link
Member

This is now fixed on 2.0

@grosser grosser closed this as completed Sep 22, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants