[ruby/syslog] Expose Syslog::VERSION

https://github.com/ruby/syslog/commit/ff5d72fcb9
This commit is contained in:
Hiroshi SHIBATA 2023-04-21 13:22:10 +09:00 committed by git
parent 0cc5c5952d
commit 117fc8e72d
2 changed files with 16 additions and 1 deletions

View File

@ -12,6 +12,8 @@
#include "ruby/util.h"
#include <syslog.h>
#define SYSLOG_VERSION "0.1.1"
/* Syslog class */
static VALUE mSyslog;
/*
@ -574,6 +576,8 @@ void Init_syslog(void)
/* Syslog macros */
rb_define_const(mSyslog, "VERSION", rb_str_new_cstr(SYSLOG_VERSION));
rb_define_method(mSyslogMacros, "LOG_MASK", mSyslogMacros_LOG_MASK, 1);
rb_define_method(mSyslogMacros, "LOG_UPTO", mSyslogMacros_LOG_UPTO, 1);
rb_define_singleton_method(mSyslogMacros, "included", mSyslogMacros_included, 1);

View File

@ -1,6 +1,17 @@
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
end
Gem::Specification.new do |spec|
spec.name = "syslog"
spec.version = "0.1.1"
spec.version = source_version
spec.authors = ["Akinori MUSHA"]
spec.email = ["knu@idaemons.org"]