diff options
| author | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2024-04-18 17:40:49 +0900 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2025-10-28 11:06:18 +0000 |
| commit | 52451798d2647739912b8a32b055ff998abe69a7 (patch) | |
| tree | caf9e5a55f50474bccf8ea2caebc05ba942ef4eb | |
| parent | 3afe8ed46f3cf71ae48703c5264d2d0712597a59 (diff) | |
[ruby/rubygems] Simulate default gems manually
https://github.com/ruby/rubygems/commit/c3cc38c72c
| -rw-r--r-- | spec/bundler/support/helpers.rb | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/spec/bundler/support/helpers.rb b/spec/bundler/support/helpers.rb index 17c38c7760..719a6e65d2 100644 --- a/spec/bundler/support/helpers.rb +++ b/spec/bundler/support/helpers.rb @@ -333,9 +333,20 @@ module Spec raise "OMG `#{path}` does not exist!" unless File.exist?(path) args = "--no-document --ignore-dependencies --verbose --local --install-dir #{install_dir}" - args += " --default" if default gem_command "install #{args} '#{path}'" + + if default + gem = Pathname.new(path).basename.to_s.match(/(.*)\.gem/)[1] + + # Revert Gem::Installer#write_spec and apply Gem::Installer#write_default_spec + FileUtils.mkdir_p File.join(install_dir, "specifications", "default") + File.rename File.join(install_dir, "specifications", gem + ".gemspec"), + File.join(install_dir, "specifications", "default", gem + ".gemspec") + + # Revert Gem::Installer#write_cache_file + File.delete File.join(install_dir, "cache", gem + ".gem") + end end def with_built_bundler(version = nil, opts = {}, &block) |
