Skip to content

Commit 8d48efe

Browse files
authored
Merge pull request #40 from ruby/fix-gemspec-for-ruby-core
Support directory layout of ruby/ruby repository
2 parents 6edf6ee + 9385bd8 commit 8d48efe

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

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")
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)