[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 коммит произвёл git
Родитель a66c41d600
Коммит 85ed226cca
1 изменённых файлов: 3 добавлений и 9 удалений

Просмотреть файл

@ -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|