[ruby/syslog] Improve the version extraction

https://github.com/ruby/syslog/commit/34da65a002
This commit is contained in:
Akinori MUSHA 2023-04-25 10:50:46 +09:00 committed by git
parent a66c41d600
commit 85ed226cca

View File

@ -1,12 +1,6 @@
source_version = ["", "ext/syslog/"].find do |dir|
begin
break File.open(File.join(__dir__, "#{dir}syslog.c")) {|f|
f.gets("\n#define SYSLOG_VERSION ")
f.gets[/\s*"(.+)"/, 1]
}
rescue Errno::ENOENT
end
source_version = %w[. ext/syslog].find do |dir|
break $1 if File.foreach(File.join(__dir__, dir, "syslog.c")).any?(/^#define\s+SYSLOG_VERSION\s+"(.+)"/)
rescue Errno::ENOENT
end
Gem::Specification.new do |spec|