[ruby/readline-ext] Expose Readline::GEM_VERSION

https://github.com/ruby/readline-ext/commit/70aa84b80e
This commit is contained in:
Hiroshi SHIBATA 2023-04-14 11:34:47 +09:00 committed by git
parent 283c190374
commit 3733ee835b
2 changed files with 15 additions and 1 deletions

View File

@ -1,6 +1,16 @@
source_version = ["", "ext/readline/"].find do |dir|
begin
break File.open(File.join(__dir__, "#{dir}readline.c")) {|f|
f.gets("\n#define READLINE_VERSION ")
f.gets[/\s*"(.+)"/, 1]
}
rescue Errno::ENOENT
end
end
Gem::Specification.new do |spec|
spec.name = "readline-ext"
spec.version = "0.1.5"
spec.version = source_version
spec.authors = ["Yukihiro Matsumoto"]
spec.email = ["matz@ruby-lang.org"]

View File

@ -15,6 +15,8 @@
************************************************/
#define READLINE_VERSION "0.1.5"
#ifdef RUBY_EXTCONF_H
#include RUBY_EXTCONF_H
#endif
@ -2119,6 +2121,8 @@ Init_readline(void)
/* Version string of GNU Readline or libedit. */
rb_define_const(mReadline, "VERSION", version);
rb_define_const(mReadline, "GEM_VERSION", rb_str_new_cstr(READLINE_VERSION));
rl_attempted_completion_function = readline_attempted_completion_function;
#if defined(HAVE_RL_PRE_INPUT_HOOK)
rl_pre_input_hook = (rl_hook_func_t *)readline_pre_input_hook;