From 5221cb4468526a18875c21cff5dee5ac96d9873b Mon Sep 17 00:00:00 2001 From: Jean Boussier Date: Thu, 2 Dec 2021 10:07:26 +0100 Subject: [ruby/ipaddr] Expose IPAddr::VERSION An almost universal convention for gems is to expose Namespace::VERSION which makes it much easier when debugging etc. https://github.com/ruby/ipaddr/commit/587ae6996e --- lib/ipaddr.gemspec | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib/ipaddr.gemspec') diff --git a/lib/ipaddr.gemspec b/lib/ipaddr.gemspec index 36e2300002..352570a213 100644 --- a/lib/ipaddr.gemspec +++ b/lib/ipaddr.gemspec @@ -3,9 +3,13 @@ lib = File.expand_path("../lib", __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) +version = File.foreach(File.expand_path("ipaddr.rb", lib)).find do |line| + /^\s*VERSION\s*=\s*["'](.*)["']/ =~ line and break $1 +end + Gem::Specification.new do |spec| spec.name = "ipaddr" - spec.version = "1.2.3" + spec.version = version spec.authors = ["Akinori MUSHA", "Hajimu UMEMOTO"] spec.email = ["knu@idaemons.org", "ume@mahoroba.org"] -- cgit v1.2.3