diff options
author | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2023-04-14 12:01:01 +0900 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2023-04-14 03:43:17 +0000 |
commit | 283c19037423aa9ac86b1094950aec04210f9129 (patch) | |
tree | 80bd81e15e8fc96810d13397d6570359fd78e49f /ext | |
parent | 8a06f1a69f987d37aa1b3701668a1a1b6c826667 (diff) | |
download | ruby-283c19037423aa9ac86b1094950aec04210f9129.tar.gz |
[ruby/nkf] Expose NKF::GEM_VERSION
https://github.com/ruby/nkf/commit/0d0fb3a162
Diffstat (limited to 'ext')
-rw-r--r-- | ext/nkf/nkf.c | 3 | ||||
-rw-r--r-- | ext/nkf/nkf.gemspec | 12 |
2 files changed, 14 insertions, 1 deletions
diff --git a/ext/nkf/nkf.c b/ext/nkf/nkf.c index c6ddee1976..f89ad68845 100644 --- a/ext/nkf/nkf.c +++ b/ext/nkf/nkf.c @@ -9,6 +9,7 @@ #define RUBY_NKF_REVISION "$Revision$" #define RUBY_NKF_VERSION NKF_VERSION " (" NKF_RELEASE_DATE ")" +#define NKF_GEM_VERSION "0.1.2" #include "ruby/ruby.h" #include "ruby/encoding.h" @@ -500,4 +501,6 @@ Init_nkf(void) rb_define_const(mNKF, "NKF_VERSION", rb_str_new2(NKF_VERSION)); /* Release date of nkf */ 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)); } diff --git a/ext/nkf/nkf.gemspec b/ext/nkf/nkf.gemspec index 7f3bd4a4b1..92ab0f22fe 100644 --- a/ext/nkf/nkf.gemspec +++ b/ext/nkf/nkf.gemspec @@ -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| spec.name = "nkf" - spec.version = "0.1.2" + spec.version = source_version spec.authors = ["NARUSE Yui"] spec.email = ["naruse@airemix.jp"] |