Skip to content

Commit 6d51b10

Browse files
committed
Don't use version.rb
1 parent 40e1302 commit 6d51b10

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

benchmark.gemspec

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
begin
2-
require_relative "lib/benchmark/version"
3-
rescue LoadError # Fallback to load version file in ruby core repository
4-
require_relative "version"
1+
name = File.basename(__FILE__, ".gemspec")
2+
version = ["lib", Array.new(name.count("-")+1, ".").join("/")].find do |dir|
3+
break File.foreach(File.join(__dir__, dir, "#{name.tr('-', '/')}.rb")) do |line|
4+
/^\s*VERSION\s*=\s*"(.*)"/ =~ line and break $1
5+
end rescue nil
56
end
67

78
Gem::Specification.new do |spec|
8-
spec.name = "benchmark"
9-
spec.version = Benchmark::VERSION
9+
spec.name = name
10+
spec.version = version
1011
spec.authors = ["Yukihiro Matsumoto"]
1112
spec.email = ["matz@ruby-lang.org"]
1213

lib/benchmark.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@
121121

122122
module Benchmark
123123

124+
VERSION = "0.2.1"
125+
124126
BENCHMARK_VERSION = "2002-04-25" # :nodoc:
125127

126128
# Invokes the block with a Benchmark::Report object, which

lib/benchmark/version.rb

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)