Skip to content

Commit 3733ee8

Browse files
hsbtmatzbot
authored andcommitted
[ruby/readline-ext] Expose Readline::GEM_VERSION
ruby/readline-ext@70aa84b80e
1 parent 283c190 commit 3733ee8

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

ext/readline/readline-ext.gemspec

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
1+
source_version = ["", "ext/readline/"].find do |dir|
2+
begin
3+
break File.open(File.join(__dir__, "#{dir}readline.c")) {|f|
4+
f.gets("\n#define READLINE_VERSION ")
5+
f.gets[/\s*"(.+)"/, 1]
6+
}
7+
rescue Errno::ENOENT
8+
end
9+
end
10+
111
Gem::Specification.new do |spec|
212
spec.name = "readline-ext"
3-
spec.version = "0.1.5"
13+
spec.version = source_version
414
spec.authors = ["Yukihiro Matsumoto"]
515
spec.email = ["[email protected]"]
616

ext/readline/readline.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
1616
************************************************/
1717

18+
#define READLINE_VERSION "0.1.5"
19+
1820
#ifdef RUBY_EXTCONF_H
1921
#include RUBY_EXTCONF_H
2022
#endif
@@ -2119,6 +2121,8 @@ Init_readline(void)
21192121
/* Version string of GNU Readline or libedit. */
21202122
rb_define_const(mReadline, "VERSION", version);
21212123

2124+
rb_define_const(mReadline, "GEM_VERSION", rb_str_new_cstr(READLINE_VERSION));
2125+
21222126
rl_attempted_completion_function = readline_attempted_completion_function;
21232127
#if defined(HAVE_RL_PRE_INPUT_HOOK)
21242128
rl_pre_input_hook = (rl_hook_func_t *)readline_pre_input_hook;

0 commit comments

Comments
 (0)