summaryrefslogtreecommitdiff
path: root/lib/bundler/installer
diff options
context:
space:
mode:
authorcitrusmoose <citrusmoose@users.noreply.github.com>2022-06-16 15:13:17 -0400
committergit <svn-admin@ruby-lang.org>2022-06-20 16:04:47 +0900
commit8d689294d033d59f211a6d2c2da72b34ce53c4e5 (patch)
treea5b354d8a20e300e2d560001e504333de52142e5 /lib/bundler/installer
parentec5c56412f0b67845b42acec06cbd1d341896f25 (diff)
[rubygems/rubygems] Fix extension paths in generated standalone script
The paths for extensions of gems would contain the hardcoded ruby version on which the extension was built. This will replace it with runtime ruby version like the parent version directory. It will make the standalone script compatible between different ruby version installations. https://github.com/rubygems/rubygems/commit/a9dae93d5d
Diffstat (limited to 'lib/bundler/installer')
-rw-r--r--lib/bundler/installer/standalone.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/bundler/installer/standalone.rb b/lib/bundler/installer/standalone.rb
index e8494b4bcd..2aba648e77 100644
--- a/lib/bundler/installer/standalone.rb
+++ b/lib/bundler/installer/standalone.rb
@@ -29,7 +29,9 @@ module Bundler
@specs.map do |spec|
next if spec.name == "bundler"
Array(spec.require_paths).map do |path|
- gem_path(path, spec).sub(version_dir, '#{RUBY_ENGINE}/#{RbConfig::CONFIG["ruby_version"]}')
+ gem_path(path, spec).
+ sub(version_dir, '#{RUBY_ENGINE}/#{RbConfig::CONFIG["ruby_version"]}').
+ sub(extensions_dir, 'extensions/\k<platform>/#{RbConfig::CONFIG["ruby_version"]}')
# This is a static string intentionally. It's interpolated at a later time.
end
end.flatten.compact
@@ -39,6 +41,10 @@ module Bundler
"#{RUBY_ENGINE}/#{RbConfig::CONFIG["ruby_version"]}"
end
+ def extensions_dir
+ %r{extensions/(?<platform>[^/]+)/#{RbConfig::CONFIG["ruby_version"]}}
+ end
+
def bundler_path
Bundler.root.join(Bundler.settings[:path], "bundler")
end