Skip to content

Commit f07a261

Browse files
committed
Support directory layout of ruby/ruby repository
1 parent 52d3e31 commit f07a261

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

lib/ipaddr.gemspec

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
11
# frozen_string_literal: true
22
# coding: utf-8
3-
lib = File.expand_path("../lib", __FILE__)
4-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
53

6-
version = File.foreach(File.expand_path("ipaddr.rb", lib)).find do |line|
4+
if File.exist?(File.expand_path("ipaddr.gemspec"))
5+
lib = File.expand_path("../lib", __FILE__)
6+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
7+
8+
file = File.expand_path("ipaddr.rb", lib)
9+
else
10+
# for ruby-core
11+
file = File.expand_path("../ipaddr.rb", __FILE__)
12+
end
13+
14+
version = File.foreach(file).find do |line|
715
/^\s*VERSION\s*=\s*["'](.*)["']/ =~ line and break $1
816
end
917

0 commit comments

Comments
 (0)