mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Extract version number from the source
"requiring version.rb" strategy has some issues. - cannot work when cross-compiling - often introduces wrong namespace - must know the superclasses - costs at each runtime than at build-time etc.
This commit is contained in:
parent
cfbae7dae0
commit
b2d96abb42
Notes:
git
2020-07-30 19:03:45 +09:00
53 changed files with 190 additions and 186 deletions
|
@ -1,13 +1,15 @@
|
|||
begin
|
||||
require_relative "lib/tracer/version"
|
||||
rescue LoadError
|
||||
# for Ruby core repository
|
||||
require_relative "version"
|
||||
# frozen_string_literal: true
|
||||
|
||||
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 = "tracer"
|
||||
spec.version = Tracer::VERSION
|
||||
spec.name = name
|
||||
spec.version = version
|
||||
spec.authors = ["Keiju ISHITSUKA"]
|
||||
spec.email = ["keiju@ruby-lang.org"]
|
||||
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class Tracer
|
||||
VERSION = "0.1.0"
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue