[ruby/nkf] Expose NKF::GEM_VERSION

https://github.com/ruby/nkf/commit/0d0fb3a162
This commit is contained in:
Hiroshi SHIBATA 2023-04-14 12:01:01 +09:00 коммит произвёл git
Родитель 8a06f1a69f
Коммит 283c190374
2 изменённых файлов: 14 добавлений и 1 удалений

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

@ -9,6 +9,7 @@
#define RUBY_NKF_REVISION "$Revision$" #define RUBY_NKF_REVISION "$Revision$"
#define RUBY_NKF_VERSION NKF_VERSION " (" NKF_RELEASE_DATE ")" #define RUBY_NKF_VERSION NKF_VERSION " (" NKF_RELEASE_DATE ")"
#define NKF_GEM_VERSION "0.1.2"
#include "ruby/ruby.h" #include "ruby/ruby.h"
#include "ruby/encoding.h" #include "ruby/encoding.h"
@ -500,4 +501,6 @@ Init_nkf(void)
rb_define_const(mNKF, "NKF_VERSION", rb_str_new2(NKF_VERSION)); rb_define_const(mNKF, "NKF_VERSION", rb_str_new2(NKF_VERSION));
/* Release date of nkf */ /* Release date of nkf */
rb_define_const(mNKF, "NKF_RELEASE_DATE", rb_str_new2(NKF_RELEASE_DATE)); rb_define_const(mNKF, "NKF_RELEASE_DATE", rb_str_new2(NKF_RELEASE_DATE));
/* Version of nkf library */
rb_define_const(mNKF, "GEM_VERSION", rb_str_new_cstr(NKF_GEM_VERSION));
} }

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

@ -1,6 +1,16 @@
source_version = ["", "ext/nkf/"].find do |dir|
begin
break File.open(File.join(__dir__, "#{dir}nkf.c")) {|f|
f.gets("\n#define NKF_GEM_VERSION ")
f.gets[/\s*"(.+)"/, 1]
}
rescue Errno::ENOENT
end
end
Gem::Specification.new do |spec| Gem::Specification.new do |spec|
spec.name = "nkf" spec.name = "nkf"
spec.version = "0.1.2" spec.version = source_version
spec.authors = ["NARUSE Yui"] spec.authors = ["NARUSE Yui"]
spec.email = ["naruse@airemix.jp"] spec.email = ["naruse@airemix.jp"]