ruby-changes:71143
From: Hiroshi <ko1@a...>
Date: Thu, 10 Feb 2022 17:18:22 +0900 (JST)
Subject: [ruby-changes:71143] f07a2613e3 (master): Support directory layout of ruby/ruby repository
https://git.ruby-lang.org/ruby.git/commit/?id=f07a2613e3 From f07a2613e3f14ab713bc5ab88541101bc02a8e38 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA <hsbt@r...> Date: Tue, 8 Feb 2022 14:32:40 +0900 Subject: Support directory layout of ruby/ruby repository --- lib/ipaddr.gemspec | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/ipaddr.gemspec b/lib/ipaddr.gemspec index 352570a213..1f4798e43a 100644 --- a/lib/ipaddr.gemspec +++ b/lib/ipaddr.gemspec @@ -1,9 +1,17 @@ https://github.com/ruby/ruby/blob/trunk/lib/ipaddr.gemspec#L1 # frozen_string_literal: true # coding: utf-8 -lib = File.expand_path("../lib", __FILE__) -$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) -version = File.foreach(File.expand_path("ipaddr.rb", lib)).find do |line| +if File.exist?(File.expand_path("ipaddr.gemspec")) + lib = File.expand_path("../lib", __FILE__) + $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) + + file = File.expand_path("ipaddr.rb", lib) +else + # for ruby-core + file = File.expand_path("../ipaddr.rb", __FILE__) +end + +version = File.foreach(file).find do |line| /^\s*VERSION\s*=\s*["'](.*)["']/ =~ line and break $1 end -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/