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

ruby-changes:70320

From: Nobuyoshi <ko1@a...>
Date: Sun, 19 Dec 2021 12:14:21 +0900 (JST)
Subject: [ruby-changes:70320] a81e0600a7 (master): [ruby/reline] Load correct version.rb from gemspec

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

From a81e0600a7fa97bc1782de91110c6704a47af419 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Wed, 15 Dec 2021 22:43:45 +0900
Subject: [ruby/reline] Load correct version.rb from gemspec

When merged to ruby/ruby, reline.gemspec file is located under
lib/reline, as the same as reline/version.rb.  That is the latter
path relative from the former differs from the ruby/reline case,
and the reline/version.rb in the default load path will be loaded.
Try `require_relative` not to load unexpected files.

https://github.com/ruby/reline/commit/54905d0e1b
---
 lib/reline/reline.gemspec | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/lib/reline/reline.gemspec b/lib/reline/reline.gemspec
index 400301fc705..26809db8738 100644
--- a/lib/reline/reline.gemspec
+++ b/lib/reline/reline.gemspec
@@ -1,7 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/lib/reline/reline.gemspec#L1
 
-lib = File.expand_path('../lib', __FILE__)
-$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
-require 'reline/version'
+begin
+  require_relative 'lib/reline/version'
+rescue LoadError
+  require_relative 'version'
+end
 
 Gem::Specification.new do |spec|
   spec.name          = 'reline'
-- 
cgit v1.2.1


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

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