diff options
author | ima1zumi <mariimaizumi5@gmail.com> | 2024-01-01 23:36:59 +0900 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2024-01-02 22:17:05 +0000 |
commit | 8916b81bf434fc50bb9ce912a3dd468d784ca737 (patch) | |
tree | e32c10961d98bd31719fc43d322a39145c28c849 | |
parent | e46922e48f3d4bc9e199ab1a46f4373b092986b8 (diff) | |
download | ruby-8916b81bf434fc50bb9ce912a3dd468d784ca737.tar.gz |
[ruby/io-console] Define IO::ConsoleMode::VERSION from console.c
https://github.com/ruby/io-console/commit/6302a2082c
-rw-r--r-- | ext/io/console/console.c | 4 | ||||
-rw-r--r-- | ext/io/console/extconf.rb | 6 | ||||
-rw-r--r-- | ext/io/console/io-console.gemspec | 10 |
3 files changed, 13 insertions, 7 deletions
diff --git a/ext/io/console/console.c b/ext/io/console/console.c index 6fd8677a3c..0448a6cba8 100644 --- a/ext/io/console/console.c +++ b/ext/io/console/console.c @@ -2,6 +2,10 @@ /* * console IO module */ + +static const char *const +IO_CONSOLE_VERSION = "0.7.2.dev.1"; + #include "ruby.h" #include "ruby/io.h" #include "ruby/thread.h" diff --git a/ext/io/console/extconf.rb b/ext/io/console/extconf.rb index aa0b6c6cfb..a72403c7f9 100644 --- a/ext/io/console/extconf.rb +++ b/ext/io/console/extconf.rb @@ -1,11 +1,6 @@ # frozen_string_literal: false require 'mkmf' -version = ["../../..", "."].find do |dir| - break File.read(File.join(__dir__, dir, "io-console.gemspec"))[/^_VERSION\s*=\s*"(.*?)"/, 1] -rescue -end - have_func("rb_io_path") have_func("rb_io_descriptor") have_func("rb_io_get_write_io") @@ -40,7 +35,6 @@ when true elsif have_func("rb_scheduler_timeout") # 3.0 have_func("rb_io_wait") end - $defs << "-D""IO_CONSOLE_VERSION=#{version}" create_makefile("io/console") {|conf| conf << "\n""VK_HEADER = #{vk_header}\n" } diff --git a/ext/io/console/io-console.gemspec b/ext/io/console/io-console.gemspec index c5e713fef1..f9c1729cb7 100644 --- a/ext/io/console/io-console.gemspec +++ b/ext/io/console/io-console.gemspec @@ -1,5 +1,13 @@ # -*- ruby -*- -_VERSION = "0.7.2.dev.1" +_VERSION = ["", "ext/io/console/"].find do |dir| + begin + break File.open(File.join(__dir__, "#{dir}console.c")) {|f| + f.gets("\nIO_CONSOLE_VERSION ") + f.gets[/"(.+)"/, 1] + } + rescue Errno::ENOENT + end +end Gem::Specification.new do |s| s.name = "io-console" |