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