From 2b0b1a82eebfc4ac8ac10d0d01fd274baad8aa8e Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Fri, 14 Apr 2023 11:06:40 +0900 Subject: [PATCH] Expose Pathname::VERSION --- lib/pathname.rb | 2 ++ pathname.gemspec | 11 +++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/pathname.rb b/lib/pathname.rb index 7bdfd0e..e0f38b2 100644 --- a/lib/pathname.rb +++ b/lib/pathname.rb @@ -14,6 +14,8 @@ class Pathname + VERSION = "0.2.1" + # :stopdoc: # to_path is implemented so Pathname objects are usable with File.open, etc. diff --git a/pathname.gemspec b/pathname.gemspec index 92bc02b..890bc2f 100644 --- a/pathname.gemspec +++ b/pathname.gemspec @@ -1,6 +1,13 @@ +name = File.basename(__FILE__, ".gemspec") +version = ["lib", "ext/lib"].find do |dir| + break File.foreach(File.join(__dir__, dir, "#{name}.rb")) do |line| + /^\s*VERSION\s*=\s*"(.*)"/ =~ line and break $1 + end rescue nil +end + Gem::Specification.new do |spec| - spec.name = "pathname" - spec.version = "0.2.1" + spec.name = name + spec.version = version spec.authors = ["Tanaka Akira"] spec.email = ["akr@fsij.org"]