summaryrefslogtreecommitdiff
path: root/spec/bundler/support/path.rb
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2020-05-25 20:32:23 +0200
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2020-06-05 07:32:42 +0900
commit592762069d025148463266187d6519c4799353dc (patch)
tree8aa2910d74998c5ad27e845effcb9ba75f33b882 /spec/bundler/support/path.rb
parentbd9a6ba4ef26d1dea61efcb9d170c7d6ad805a27 (diff)
[rubygems/rubygems] Support running specs against a tarball
When bundler specs are run from a ruby tarball (ruby-core does this), there's no git folder, so `git ls-files` fails. Support this case by making specs rely on the list of files from the bundler gemspec instead, and invert the spec that makes sure we ship the right set of files. As per the other quality specs, skip them in this case. https://github.com/rubygems/rubygems/commit/b28d5ec931
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3184
Diffstat (limited to 'spec/bundler/support/path.rb')
-rw-r--r--spec/bundler/support/path.rb22
1 files changed, 16 insertions, 6 deletions
diff --git a/spec/bundler/support/path.rb b/spec/bundler/support/path.rb
index 187ccefd71..f56fdfc5aa 100644
--- a/spec/bundler/support/path.rb
+++ b/spec/bundler/support/path.rb
@@ -68,7 +68,7 @@ module Spec
end
def shipped_files
- @shipped_files ||= git_ls_files(shipped_files_glob)
+ @shipped_files ||= loaded_gemspec.files
end
def lib_tracked_files
@@ -231,20 +231,22 @@ module Spec
end
end
+ def git_commit_sha
+ ruby_core_tarball? ? "unknown" : sys_exec("git rev-parse --short HEAD", :dir => source_root).strip
+ end
+
private
def git_ls_files(glob)
- sys_exec("git ls-files -z -- #{glob}", :dir => source_root).split("\x0")
+ skip "Not running on a git context, since running tests from a tarball" if ruby_core_tarball?
+
+ sys_exec!("git ls-files -z -- #{glob}", :dir => source_root).split("\x0")
end
def tracked_files_glob
ruby_core? ? "lib/bundler lib/bundler.rb spec/bundler man/bundle*" : ""
end
- def shipped_files_glob
- ruby_core? ? "lib/bundler lib/bundler.rb man/bundle* man/gemfile* libexec/bundle*" : "lib man exe CHANGELOG.md LICENSE.md README.md bundler.gemspec"
- end
-
def lib_tracked_files_glob
ruby_core? ? "lib/bundler lib/bundler.rb" : "lib"
end
@@ -253,6 +255,14 @@ module Spec
ruby_core? ? "man/bundle* man/gemfile*" : "man"
end
+ def git_root
+ ruby_core? ? source_root : source_root.parent
+ end
+
+ def ruby_core_tarball?
+ !git_root.join(".git").directory?
+ end
+
extend self
end
end