From a70653ca7facbb2004562e5718fa51e7ade6b157 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Thu, 30 Mar 2023 13:05:45 +0900 Subject: [PATCH] [ruby/find] Expose Find::VERSION https://github.com/ruby/find/commit/a24124a08a --- lib/find.gemspec | 11 +++++++++-- lib/find.rb | 2 ++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/find.gemspec b/lib/find.gemspec index 3f0aadcdae..e4aceadbf7 100644 --- a/lib/find.gemspec +++ b/lib/find.gemspec @@ -1,6 +1,13 @@ +name = File.basename(__FILE__, ".gemspec") +version = ["lib", Array.new(name.count("-")+1, "..").join("/")].find do |dir| + break File.foreach(File.join(__dir__, dir, "#{name.tr('-', '/')}.rb")) do |line| + /^\s*VERSION\s*=\s*"(.*)"/ =~ line and break $1 + end rescue nil +end + Gem::Specification.new do |spec| - spec.name = "find" - spec.version = "0.1.1" + spec.name = name + spec.version = version spec.authors = ['Kazuki Tsujimoto'] spec.email = ['kazuki@callcc.net'] diff --git a/lib/find.rb b/lib/find.rb index 9bee99c66d..79e2e2854d 100644 --- a/lib/find.rb +++ b/lib/find.rb @@ -27,6 +27,8 @@ # module Find + VERSION = "0.1.1" + # # Calls the associated block with the name of every file and directory listed # as arguments, then recursively on their subdirectories, and so on.