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

Bundler fails to parse a gemspec line when it appears in a gemfile that is evaled inside of another gemfile #4584

Closed
stupakov opened this issue May 17, 2016 · 2 comments · Fixed by #4585
Assignees

Comments

@stupakov
Copy link

Bundler version: 1.12.4
OS: observed on OS X 10.10.5 AND on Ubuntu 14.04.1
Description:
Bundler fails to parse a gemspec line when it appears in a gemfile that is evaled inside of another gemfile
Reproducing: The minimum setup for reproducing this bug can be found in the simple example at https://github.com/stupakov/bundler-bug

Failure output:

[!] There was an error parsing `Gemfile`:
[!] There was an error parsing `Gemfile-other`: No such file or directory - gems/mygem/mygem.gemspec. Bundler cannot continue.

 #  from Gemfile-other:1
 #  -------------------------------------------
 >  gemspec path: 'gems/mygem'
 #  -------------------------------------------
. Bundler cannot continue.

 #  from /Users/myusername/workspace/bundler-bug/Gemfile:1
 #  -------------------------------------------
 >  eval_gemfile 'Gemfile-other'
 #  -------------------------------------------
@RochesterinNYC RochesterinNYC self-assigned this May 17, 2016
@RochesterinNYC
Copy link
Contributor

RochesterinNYC commented May 17, 2016

I investigated this briefly and the root cause of the issue is that the gemfile parameter passed to eval_gemfile at https://github.com/bundler/bundler/blob/master/lib/bundler/dsl.rb#L36 on the second invocation results in a relative path when it should be an absolute path.

@RochesterinNYC
Copy link
Contributor

Example work-around that illustrates the problem:

Changing the eval_gemfile line in the Gemfile to

eval_gemfile(File.dirname(__FILE__) + '/Gemfile-Other')

enables a successful bundle install.

homu added a commit that referenced this issue May 20, 2016
…=segiddins

Use the full expanded path of passed `Gemfile` during `eval_gemfile`

- fixes #4584
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants