Skip to content

Commit 5412260

Browse files
authored
Merge pull request #9 from valich/master
make headers search survive src-based rubies
2 parents 80b91bc + 6bfd6fe commit 5412260

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

lib/debase/ruby_core_source.rb

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ def self.create_makefile_with_core(hdrs, name)
1616
end
1717

1818
ruby_dir = if RUBY_PATCHLEVEL < 0
19-
REVISION_MAP[RUBY_REVISION] or
20-
no_source_abort("ruby-#{RUBY_VERSION} (revision #{RUBY_REVISION})")
19+
REVISION_MAP[RUBY_REVISION] or "ruby-#{RUBY_VERSION}"
2120
else
2221
"ruby-#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}"
2322
end
@@ -49,7 +48,7 @@ def self.create_makefile_with_core(hdrs, name)
4948
def self.deduce_packaged_source_dir(ruby_dir)
5049
prefix = File.dirname(__FILE__) + '/ruby_core_source/'
5150
expected_directory = prefix + ruby_dir
52-
if File.directory?(expected_directory)
51+
if RUBY_REVISION > 0 and File.directory?(expected_directory)
5352
expected_directory
5453
else
5554
# Fallback to an older version.
@@ -58,7 +57,7 @@ def self.deduce_packaged_source_dir(ruby_dir)
5857
select { |d| File.directory?(d) }.
5958
map { |d| [d, ruby_source_dir_version(d)] }.
6059
sort { |(_, v1), (_, v2)| -(v1 <=> v2) }.
61-
find { |(_, v)| v < ruby_version }
60+
find { |(_, v)| v <= ruby_version }
6261

6362
version = File.basename(path)
6463
fallback_source_warning(ruby_dir, version)
@@ -67,15 +66,15 @@ def self.deduce_packaged_source_dir(ruby_dir)
6766
end
6867

6968
def self.ruby_source_dir_version(dir)
70-
match = /ruby-([0-9\.]+)-p([0-9]+)/.match(dir)
69+
match = /ruby-([0-9\.]+)-(.+)/.match(dir)
7170
Gem::Version.new("#{match[1]}.#{match[2]}")
7271
end
7372

7473
def self.fallback_source_warning(ruby_version, fallback_version)
7574
warn <<-STR
7675
**************************************************************************
77-
No source for #{ruby_version} provided with debase-ruby_core_source gem.
78-
Falling back to #{fallback_version}.
76+
No source for #{ruby_version} (revision #{RUBY_REVISION}) provided with
77+
debase-ruby_core_source gem. Falling back to #{fallback_version}.
7978
**************************************************************************
8079
STR
8180
end
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module Debase
22
module RubyCoreSource
3-
VERSION = '0.9.11'
3+
VERSION = '0.9.12'
44
end
55
end

0 commit comments

Comments
 (0)