Skip to content

Commit e47289f

Browse files
committed
Allow to add ruby w/o patchlevel (e.g. previews and rcs)
1 parent c8db856 commit e47289f

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

Rakefile

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,21 @@ def get_dest_dir(ruby_dir, version, tempdir)
1313
patchlevel = ENV['PATCHLEVEL']
1414
if !patchlevel
1515
puts "extracting patchlevel from version.h"
16-
patchlevel = File.new("#{tempdir}/#{ruby_dir}/version.h").each_line do |li|
16+
patchlevel = File.new("#{tempdir}/#{ruby_dir}/version.h").each_line.map do |li|
1717
if /#define RUBY_PATCHLEVEL (\d+)/ =~ li
1818
break $1
19+
else
20+
nil
1921
end
20-
end
22+
end.find { |p| not p.nil?}
2123
puts "extracted patchlevel '#{patchlevel}'"
2224
end
23-
if !patchlevel
24-
abort "Unable to extract patchlevel from verion.h please use a $PATCHLEVEL"
25+
if patchlevel
26+
dest_dir = dest_dir + "-p" + patchlevel
27+
else
28+
warn "Unable to extract patchlevel from verion.h assuming there is no patchlevel please use a $PATCHLEVEL to specify one"
2529
end
26-
dest_dir = dest_dir + "-p" + patchlevel
30+
dest_dir
2731
end
2832

2933
desc <<DESCR

0 commit comments

Comments
 (0)