bundler evaluates the .gemspec in the current directory instead of the directory containing the .gemspec #947

Closed
sumbach opened this Issue Jan 16, 2011 · 1 comment

1 participant

@sumbach

When evaluating the .gemspec file via the bundler dsl ("gemspec" in your Gemfile), the .gemspec is evaluated in the current directory rather than the directory containing the .gemspec file. This can cause a number of issues with relative paths in the .gemspec, in this case you'll see an error message from git:

$ ./bin/example-executable

Hello, World!
I'm going to run myself recursively from another directory now...
Hello again
I'm back!

$ bundle exec ./bin/example-executable
Hello, World!
I'm going to run myself recursively from another directory now...
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git
Hello again
I'm back!

Details and sample code here: https://gist.github.com/781594

@sumbach

Use #load_gemspec to evaluate gemspec files specified in Gemfile

  • #load_gemspec already wraps the eval in chdir to resolve issue #947
  • also loads gemspec files in YAML format
  • also provides better error messages than Gem::Specification

Closed by 2bf0911

@leobessa leobessa pushed a commit that referenced this issue Apr 18, 2011
@sumbach sumbach Use #load_gemspec to evaluate gemspec files specified in Gemfile
  - #load_gemspec already wraps the eval in chdir to resolve issue #947
  - also loads gemspec files in YAML format
  - also provides better error messages than Gem::Specification

Closes #947
2bf0911
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment