Skip to content

Commit

Permalink
Merge pull request #15 from ruby/expose-gem-version
Browse files Browse the repository at this point in the history
Expose Readline::GEM_VERSION
  • Loading branch information
hsbt authored Apr 14, 2023
2 parents 1e7b6cb + 70aa84b commit f2e280b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
4 changes: 4 additions & 0 deletions ext/readline/readline.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
************************************************/

#define READLINE_VERSION "0.1.5"

#ifdef RUBY_EXTCONF_H
#include RUBY_EXTCONF_H
#endif
Expand Down Expand Up @@ -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;
Expand Down
12 changes: 11 additions & 1 deletion readline-ext.gemspec
Original file line number Diff line number Diff line change
@@ -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 = ["[email protected]"]

Expand Down

0 comments on commit f2e280b

Please sign in to comment.