Skip to content

Commit 34da65a

Browse files
committed
Improve the version extraction
1 parent 5289373 commit 34da65a

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

syslog.gemspec

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
1-
2-
source_version = ["", "ext/syslog/"].find do |dir|
3-
begin
4-
break File.open(File.join(__dir__, "#{dir}syslog.c")) {|f|
5-
f.gets("\n#define SYSLOG_VERSION ")
6-
f.gets[/\s*"(.+)"/, 1]
7-
}
8-
rescue Errno::ENOENT
9-
end
1+
source_version = %w[. ext/syslog].find do |dir|
2+
break $1 if File.foreach(File.join(__dir__, dir, "syslog.c")).any?(/^#define\s+SYSLOG_VERSION\s+"(.+)"/)
3+
rescue Errno::ENOENT
104
end
115

126
Gem::Specification.new do |spec|

0 commit comments

Comments
 (0)