summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2022-08-04 17:30:03 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2022-08-05 09:52:20 +0900
commit57911712011e285d76cf8132dd080b5727f43bf3 (patch)
tree178a2a9a3e61945057ab5fc671a61e67c216463c
parent661536ab168ab99e1dae31d661ff4807e7734ae4 (diff)
Load gemspec file at that directory
Gemspec files generated by old bundler run `git` without changing the working directory. Or some gemspec files expect an owned file at the top exists ath the current working directory.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/6203
-rw-r--r--tool/lib/bundled_gem.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/tool/lib/bundled_gem.rb b/tool/lib/bundled_gem.rb
index 0b7d52b86a..38c331183d 100644
--- a/tool/lib/bundled_gem.rb
+++ b/tool/lib/bundled_gem.rb
@@ -15,8 +15,8 @@ module BundledGem
end
def copy(path, *rest)
- spec = Gem::Specification.load(path)
- path = File.dirname(path)
+ path, n = File.split(path)
+ spec = Dir.chdir(path) {Gem::Specification.load(n)} or raise "Cannot load #{path}"
prepare_test(spec, *rest) do |dir|
FileUtils.rm_rf(dir)
files = spec.files.reject {|f| f.start_with?(".git")}