1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[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. # have any questions, file a ticket at http://bugs.ruby-lang.org.
# #
class OptionParser class OptionParser
OptionParser::Version = "0.1.0"
# :stopdoc: # :stopdoc:
NoArgument = [NO_ARGUMENT = :NONE, nil].freeze NoArgument = [NO_ARGUMENT = :NONE, nil].freeze
RequiredArgument = [REQUIRED_ARGUMENT = :REQUIRED, true].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| Gem::Specification.new do |spec|
spec.name = "optparse" spec.name = name
spec.version = "0.1.0" spec.version = version
spec.authors = ["Nobu Nakada"] spec.authors = ["Nobu Nakada"]
spec.email = ["nobu@ruby-lang.org"] spec.email = ["nobu@ruby-lang.org"]