diff options
Diffstat (limited to 'spec/bundler/support/path.rb')
-rw-r--r-- | spec/bundler/support/path.rb | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/spec/bundler/support/path.rb b/spec/bundler/support/path.rb index 8d1807b56c..7352d5a353 100644 --- a/spec/bundler/support/path.rb +++ b/spec/bundler/support/path.rb @@ -42,8 +42,7 @@ module Spec end def dev_gemfile - name = RUBY_VERSION.start_with?("2.6") ? "dev26_gems.rb" : "dev_gems.rb" - @dev_gemfile ||= tool_dir.join(name) + @dev_gemfile ||= tool_dir.join("dev_gems.rb") end def bindir @@ -81,7 +80,13 @@ module Spec end def shipped_files - @shipped_files ||= loaded_gemspec.files + @shipped_files ||= if ruby_core_tarball? + loaded_gemspec.files.map {|f| f.gsub(%r{^exe/}, "libexec/") } + elsif ruby_core? + tracked_files + else + loaded_gemspec.files + end end def lib_tracked_files @@ -226,13 +231,6 @@ module Spec root.join("lib") end - # Sometimes rubygems version under test does not include - # https://github.com/rubygems/rubygems/pull/2728 and will not always end up - # activating the current bundler. In that case, require bundler absolutely. - def entrypoint - Gem.rubygems_version < Gem::Version.new("3.1.a") ? "#{lib_dir}/bundler" : "bundler" - end - def global_plugin_gem(*args) home ".bundle", "plugin", "gems", *args end @@ -252,6 +250,13 @@ module Spec File.open(version_file, "w") {|f| f << contents } end + def replace_required_ruby_version(version, dir:) + gemspec_file = File.expand_path("bundler.gemspec", dir) + contents = File.read(gemspec_file) + contents.sub!(/(^\s+s\.required_ruby_version\s*=\s*)"[^"]+"/, %(\\1"#{version}")) + File.open(gemspec_file, "w") {|f| f << contents } + end + def ruby_core? # avoid to warnings @ruby_core ||= nil @@ -272,11 +277,11 @@ module Spec def git_ls_files(glob) 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") + 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*" : "" + ruby_core? ? "libexec/bundle* lib/bundler lib/bundler.rb spec/bundler man/bundle*" : "lib exe spec CHANGELOG.md LICENSE.md README.md bundler.gemspec" end def lib_tracked_files_glob |