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

Support directory layout of ruby/ruby repository

This commit is contained in:
Hiroshi SHIBATA 2022-02-08 14:32:40 +09:00
parent 52d3e31d27
commit f07a2613e3
No known key found for this signature in database
GPG key ID: F9CF13417264FAC2

View file

@ -1,9 +1,17 @@
# frozen_string_literal: true
# coding: utf-8
if File.exist?(File.expand_path("ipaddr.gemspec"))
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|
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