Skip to content

Commit

Permalink
Don't use version.rb
Browse files Browse the repository at this point in the history
  • Loading branch information
hsbt committed May 25, 2023
1 parent 40e1302 commit 6d51b10
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
13 changes: 7 additions & 6 deletions benchmark.gemspec
Original file line number Diff line number Diff line change
@@ -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 = ["[email protected]"]

Expand Down
2 changes: 2 additions & 0 deletions lib/benchmark.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions lib/benchmark/version.rb

This file was deleted.

0 comments on commit 6d51b10

Please sign in to comment.