diff options
author | David RodrÃguez <deivid.rodriguez@riseup.net> | 2022-06-21 18:45:45 +0200 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2022-06-23 18:17:37 +0900 |
commit | 6f229da2c07aec3441078248d7fd2fe844e8bc92 (patch) | |
tree | 63fd97c51f2cf0788300b1f95aa4120e125ea227 /lib | |
parent | 4f5eb48dead5c82b966c1fdebc890cf9d3010d86 (diff) | |
download | ruby-6f229da2c07aec3441078248d7fd2fe844e8bc92.tar.gz |
[rubygems/rubygems] Fix standalone script generation for statically linked dev ruby
https://github.com/rubygems/rubygems/commit/4d0d7b3c97
Diffstat (limited to 'lib')
-rw-r--r-- | lib/bundler/installer/standalone.rb | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/lib/bundler/installer/standalone.rb b/lib/bundler/installer/standalone.rb index 2aba648e77..248b677233 100644 --- a/lib/bundler/installer/standalone.rb +++ b/lib/bundler/installer/standalone.rb @@ -12,6 +12,7 @@ module Bundler end File.open File.join(bundler_path, "setup.rb"), "w" do |file| file.puts "require 'rbconfig'" + file.puts define_path_helpers file.puts reverse_rubygems_kernel_mixin paths.each do |path| if Pathname.new(path).absolute? @@ -30,19 +31,19 @@ module Bundler 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"]}'). - sub(extensions_dir, 'extensions/\k<platform>/#{RbConfig::CONFIG["ruby_version"]}') + sub(version_dir, '#{RUBY_ENGINE}/#{Gem.ruby_api_version}'). + sub(extensions_dir, 'extensions/\k<platform>/#{Gem.extension_api_version}') # This is a static string intentionally. It's interpolated at a later time. end end.flatten.compact end def version_dir - "#{RUBY_ENGINE}/#{RbConfig::CONFIG["ruby_version"]}" + "#{RUBY_ENGINE}/#{Gem.ruby_api_version}" end def extensions_dir - %r{extensions/(?<platform>[^/]+)/#{RbConfig::CONFIG["ruby_version"]}} + %r{extensions/(?<platform>[^/]+)/#{Regexp.escape(Gem.extension_api_version)}} end def bundler_path @@ -61,6 +62,26 @@ module Bundler raise Gem::InvalidSpecificationException.new(error_message) end + def define_path_helpers + <<~'END' + unless defined?(Gem) + module Gem + def self.ruby_api_version + RbConfig::CONFIG["ruby_version"] + end + + def self.extension_api_version + if 'no' == RbConfig::CONFIG['ENABLE_SHARED'] + "#{ruby_api_version}-static" + else + ruby_api_version + end + end + end + end + END + end + def reverse_rubygems_kernel_mixin <<~END kernel = (class << ::Kernel; self; end) |