diff options
author | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2023-05-25 15:58:09 +0900 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2023-05-25 07:08:44 +0000 |
commit | 5bfb317a938e461a9f99fe209765263cfe23b4d5 (patch) | |
tree | 6ae1717b15fde6aa99ac534b10bf4c24a2945f71 | |
parent | 8e2fac7b9c9e9f83b6a84133678b5a98e799b84c (diff) | |
download | ruby-5bfb317a938e461a9f99fe209765263cfe23b4d5.tar.gz |
[ruby/benchmark] Don't use version.rb
https://github.com/ruby/benchmark/commit/6d51b10500
-rw-r--r-- | lib/benchmark.rb | 2 | ||||
-rw-r--r-- | lib/benchmark/benchmark.gemspec | 13 | ||||
-rw-r--r-- | lib/benchmark/version.rb | 4 |
3 files changed, 9 insertions, 10 deletions
diff --git a/lib/benchmark.rb b/lib/benchmark.rb index 79c782e262..d9f89239fc 100644 --- a/lib/benchmark.rb +++ b/lib/benchmark.rb @@ -121,6 +121,8 @@ module Benchmark + VERSION = "0.2.1" + BENCHMARK_VERSION = "2002-04-25" # :nodoc: # Invokes the block with a Benchmark::Report object, which diff --git a/lib/benchmark/benchmark.gemspec b/lib/benchmark/benchmark.gemspec index 0aadf017f0..d6e98db805 100644 --- a/lib/benchmark/benchmark.gemspec +++ b/lib/benchmark/benchmark.gemspec @@ -1,12 +1,13 @@ -begin - require_relative "lib/benchmark/version" -rescue LoadError # Fallback to load version file in ruby core repository - require_relative "version" +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 = "benchmark" - spec.version = Benchmark::VERSION + spec.name = name + spec.version = version spec.authors = ["Yukihiro Matsumoto"] spec.email = ["matz@ruby-lang.org"] diff --git a/lib/benchmark/version.rb b/lib/benchmark/version.rb deleted file mode 100644 index 645966fd80..0000000000 --- a/lib/benchmark/version.rb +++ /dev/null @@ -1,4 +0,0 @@ -# frozen_string_literal: true -module Benchmark - VERSION = "0.2.1" -end |