1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[rubygems/rubygems] Remove unnecessary ruby_version local variable

Under some case, this variable might not end up being used, in which
case running the script would print unused variable warnings.

bf96030362
This commit is contained in:
David Rodríguez 2021-07-30 12:42:18 +02:00 committed by Hiroshi SHIBATA
parent 7566c85cc0
commit 7465b94f8a
Notes: git 2021-08-31 19:07:22 +09:00
2 changed files with 2 additions and 3 deletions

View file

@ -12,7 +12,6 @@ module Bundler
end end
File.open File.join(bundler_path, "setup.rb"), "w" do |file| File.open File.join(bundler_path, "setup.rb"), "w" do |file|
file.puts "require 'rbconfig'" file.puts "require 'rbconfig'"
file.puts "ruby_version = RbConfig::CONFIG[\"ruby_version\"]"
file.puts reverse_rubygems_kernel_mixin file.puts reverse_rubygems_kernel_mixin
paths.each do |path| paths.each do |path|
file.puts %($:.unshift File.expand_path("\#{__dir__}/#{path}")) file.puts %($:.unshift File.expand_path("\#{__dir__}/#{path}"))
@ -26,7 +25,7 @@ module Bundler
@specs.map do |spec| @specs.map do |spec|
next if spec.name == "bundler" next if spec.name == "bundler"
Array(spec.require_paths).map do |path| Array(spec.require_paths).map do |path|
gem_path(path, spec).sub(version_dir, '#{RUBY_ENGINE}/#{ruby_version}') gem_path(path, spec).sub(version_dir, '#{RUBY_ENGINE}/#{RbConfig::CONFIG["ruby_version"]}')
# This is a static string intentionally. It's interpolated at a later time. # This is a static string intentionally. It's interpolated at a later time.
end end
end.flatten.compact end.flatten.compact

View file

@ -159,7 +159,7 @@ RSpec.shared_examples "bundle install --standalone" do
it "generates a bundle/bundler/setup.rb with the proper paths" do it "generates a bundle/bundler/setup.rb with the proper paths" do
expected_path = bundled_app("bundle/bundler/setup.rb") expected_path = bundled_app("bundle/bundler/setup.rb")
extension_line = File.read(expected_path).each_line.find {|line| line.include? "/extensions/" }.strip extension_line = File.read(expected_path).each_line.find {|line| line.include? "/extensions/" }.strip
expect(extension_line).to start_with '$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{ruby_version}/extensions/' expect(extension_line).to start_with '$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{RbConfig::CONFIG["ruby_version"]}/extensions/'
expect(extension_line).to end_with '/very_simple_binary-1.0")' expect(extension_line).to end_with '/very_simple_binary-1.0")'
end end
end end