[ruby/optparse] Define OptionParser::Version

https://github.com/ruby/optparse/commit/4c0021b5b2
This commit is contained in:
Nobuyoshi Nakada 2020-07-23 01:08:06 +09:00
parent cd429e68d2
commit f120e65200
2 changed files with 12 additions and 2 deletions

View File

@ -419,6 +419,8 @@
# 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

View File

@ -1,6 +1,14 @@
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@ruby-lang.org"]