ruby-changes:62363
From: Nobuyoshi <ko1@a...>
Date: Thu, 23 Jul 2020 10:59:23 +0900 (JST)
Subject: [ruby-changes:62363] f120e65200 (master): [ruby/optparse] Define OptionParser::Version
https://git.ruby-lang.org/ruby.git/commit/?id=f120e65200 From f120e6520063913229a659741d96187eb2f7dd82 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Thu, 23 Jul 2020 01:08:06 +0900 Subject: [ruby/optparse] Define OptionParser::Version https://github.com/ruby/optparse/commit/4c0021b5b2 diff --git a/lib/optparse.rb b/lib/optparse.rb index 614ebc3..82582f6 100644 --- a/lib/optparse.rb +++ b/lib/optparse.rb @@ -419,6 +419,8 @@ https://github.com/ruby/ruby/blob/trunk/lib/optparse.rb#L419 # have any questions, file a ticket at http://bugs.ruby-lang.org. # class OptionParser + OptionParser::Version = "0.1.0" + # :stopdoc: NoArgument = [NO_ARGUMENT = :NONE, nil].freeze RequiredArgument = [REQUIRED_ARGUMENT = :REQUIRED, true].freeze diff --git a/lib/optparse/optparse.gemspec b/lib/optparse/optparse.gemspec index 2ec715c..d67060a 100644 --- a/lib/optparse/optparse.gemspec +++ b/lib/optparse/optparse.gemspec @@ -1,6 +1,14 @@ https://github.com/ruby/ruby/blob/trunk/lib/optparse/optparse.gemspec#L1 +name = File.basename(__FILE__, ".gemspec") +version = nil +["lib", ".."].find do |dir| + version = File.foreach(File.join(__dir__, dir, "#{name}.rb")) do |line| + /^\s*OptionParser::Version\s*=\s*"(.*)"/ =~ line and break $1 + end rescue nil +end + Gem::Specification.new do |spec| - spec.name = "optparse" - spec.version = "0.1.0" + spec.name = name + spec.version = version spec.authors = ["Nobu Nakada"] spec.email = ["nobu@r..."] -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/