diff options
author | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2022-02-08 15:53:29 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-08 15:53:29 +0900 |
commit | 36fa57fca0d5ecb317de8dba616a2225f3cac27a (patch) | |
tree | dc745180b05b7394aaf524486493a618413e36cf /lib/ipaddr.gemspec | |
parent | bb4d9f82499bf252345e47498d32a2b280342b9f (diff) |
Fixed path for ipaddr.rb (#5533)
Diffstat (limited to 'lib/ipaddr.gemspec')
-rw-r--r-- | lib/ipaddr.gemspec | 14 |
1 files 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 @@ # 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 |