ruby-changes:56410
From: Nobuyoshi <ko1@a...>
Date: Wed, 10 Jul 2019 12:36:30 +0900 (JST)
Subject: [ruby-changes:56410] Nobuyoshi Nakada: 1d2ec4b216 (master): Added Etc::VERSION
https://git.ruby-lang.org/ruby.git/commit/?id=1d2ec4b216 From 1d2ec4b21647089598d0be3a8bc5f56a71b5e892 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Wed, 10 Jul 2019 12:33:29 +0900 Subject: Added Etc::VERSION diff --git a/ext/etc/etc.c b/ext/etc/etc.c index 93b19f1..b6dca94 100644 --- a/ext/etc/etc.c +++ b/ext/etc/etc.c @@ -52,6 +52,8 @@ char *getenv(); https://github.com/ruby/ruby/blob/trunk/ext/etc/etc.c#L52 #endif char *getlogin(); +#define RUBY_ETC_VERSION "1.0.1" + #include "constdefs.h" /* call-seq: @@ -1062,6 +1064,7 @@ Init_etc(void) https://github.com/ruby/ruby/blob/trunk/ext/etc/etc.c#L1064 VALUE mEtc; mEtc = rb_define_module("Etc"); + rb_define_const(mEtc, "VERSION", rb_str_new_cstr(RUBY_ETC_VERSION)); init_constants(mEtc); rb_define_module_function(mEtc, "getlogin", etc_getlogin, 0); diff --git a/ext/etc/etc.gemspec b/ext/etc/etc.gemspec index f3ec4af..f280169 100644 --- a/ext/etc/etc.gemspec +++ b/ext/etc/etc.gemspec @@ -1,8 +1,19 @@ https://github.com/ruby/ruby/blob/trunk/ext/etc/etc.gemspec#L1 # frozen_string_literal: true +version = ["", "ext/etc/"].find do |dir| + begin + break File.open(File.expand_path("../#{dir}/etc.c", __FILE__)) do |f| + f.gets "\n#define RUBY_ETC_VERSION " + f.gets[/"(.+)"/, 1] + end + rescue + next + end +end + Gem::Specification.new do |spec| spec.name = "etc" - spec.version = "1.0.1" + spec.version = version spec.authors = ["Yukihiro Matsumoto"] spec.email = ["matz@r..."] -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/