summaryrefslogtreecommitdiff
path: root/lib/bundler.rb
diff options
context:
space:
mode:
authorSamuel Giddins <segiddins@segiddins.me>2017-04-05 12:27:17 -0500
committerSamuel Giddins <segiddins@segiddins.me>2017-04-05 12:27:17 -0500
commit4e0bdcaab59fbcaea4fff2e2a75b1ad36819cc5a (patch)
tree79d5125122e69deb78be9f85c276fe49452438e6 /lib/bundler.rb
parent6a7262c5f048db438fc29dee5c1b95646dee58c6 (diff)
downloadbundler-4e0bdcaab59fbcaea4fff2e2a75b1ad36819cc5a.tar.gz
[Bundler] Avoid chdir when loading a yaml gemspec
Diffstat (limited to 'lib/bundler.rb')
-rw-r--r--lib/bundler.rb22
1 files changed, 11 insertions, 11 deletions
diff --git a/lib/bundler.rb b/lib/bundler.rb
index 1969f36a71..88822f8f1a 100644
--- a/lib/bundler.rb
+++ b/lib/bundler.rb
@@ -413,20 +413,20 @@ EOF
def load_gemspec_uncached(file, validate = false)
path = Pathname.new(file)
- # Eval the gemspec from its parent directory, because some gemspecs
- # depend on "./" relative paths.
- SharedHelpers.chdir(path.dirname.to_s) do
- contents = path.read
- spec = if contents[0..2] == "---" # YAML header
- eval_yaml_gemspec(path, contents)
- else
+ contents = path.read
+ spec = if contents.start_with?("---") # YAML header
+ eval_yaml_gemspec(path, contents)
+ else
+ # Eval the gemspec from its parent directory, because some gemspecs
+ # depend on "./" relative paths.
+ SharedHelpers.chdir(path.dirname.to_s) do
eval_gemspec(path, contents)
end
- return unless spec
- spec.loaded_from = path.expand_path.to_s
- Bundler.rubygems.validate(spec) if validate
- spec
end
+ return unless spec
+ spec.loaded_from = path.expand_path.to_s
+ Bundler.rubygems.validate(spec) if validate
+ spec
end
def clear_gemspec_cache