[前][次][番号順一覧][スレッド一覧]

ruby-changes:67417

From: David <ko1@a...>
Date: Tue, 31 Aug 2021 19:07:00 +0900 (JST)
Subject: [ruby-changes:67417] 7465b94f8a (master): [rubygems/rubygems] Remove unnecessary `ruby_version` local variable

https://git.ruby-lang.org/ruby.git/commit/?id=7465b94f8a

From 7465b94f8a4c2849498bf36b98be8da99c0504c2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?David=20Rodr=C3=ADguez?= <deivid.rodriguez@r...>
Date: Fri, 30 Jul 2021 12:42:18 +0200
Subject: [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.

https://github.com/rubygems/rubygems/commit/bf96030362
---
 lib/bundler/installer/standalone.rb          | 3 +--
 spec/bundler/install/gems/standalone_spec.rb | 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/lib/bundler/installer/standalone.rb b/lib/bundler/installer/standalone.rb
index 2668ae0..4bd9b2e 100644
--- a/lib/bundler/installer/standalone.rb
+++ b/lib/bundler/installer/standalone.rb
@@ -12,7 +12,6 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/installer/standalone.rb#L12
       end
       File.open File.join(bundler_path, "setup.rb"), "w" do |file|
         file.puts "require 'rbconfig'"
-        file.puts "ruby_version = RbConfig::CONFIG[\"ruby_version\"]"
         file.puts reverse_rubygems_kernel_mixin
         paths.each do |path|
           file.puts %($:.unshift File.expand_path("\#{__dir__}/#{path}"))
@@ -26,7 +25,7 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/installer/standalone.rb#L25
       @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}/#{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.
         end
       end.flatten.compact
diff --git a/spec/bundler/install/gems/standalone_spec.rb b/spec/bundler/install/gems/standalone_spec.rb
index ce1307f..fc8e24f 100644
--- a/spec/bundler/install/gems/standalone_spec.rb
+++ b/spec/bundler/install/gems/standalone_spec.rb
@@ -159,7 +159,7 @@ RSpec.shared_examples "bundle install --standalone" do https://github.com/ruby/ruby/blob/trunk/spec/bundler/install/gems/standalone_spec.rb#L159
     it "generates a bundle/bundler/setup.rb with the proper paths" do
       expected_path = bundled_app("bundle/bundler/setup.rb")
       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")'
     end
   end
-- 
cgit v1.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]