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:
Nobuyoshi Nakada 2020-07-29 00:31:52 +09:00
parent cfbae7dae0
commit b2d96abb42
Notes: git 2020-07-30 19:03:45 +09:00
53 changed files with 190 additions and 186 deletions

View File

@ -288,6 +288,7 @@
# #
class CGI class CGI
VERSION = "0.1.0"
end end
require 'cgi/core' require 'cgi/core'

View File

@ -1,12 +1,15 @@
begin # frozen_string_literal: true
require_relative "lib/cgi/version"
rescue LoadError # Fallback to load version file in ruby core repository name = File.basename(__FILE__, ".gemspec")
require_relative "version" 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 end
Gem::Specification.new do |spec| Gem::Specification.new do |spec|
spec.name = "cgi" spec.name = name
spec.version = CGI::VERSION spec.version = version
spec.authors = ["Yukihiro Matsumoto"] spec.authors = ["Yukihiro Matsumoto"]
spec.email = ["matz@ruby-lang.org"] spec.email = ["matz@ruby-lang.org"]

View File

@ -1,3 +0,0 @@
class CGI
VERSION = "0.1.0"
end

View File

@ -39,6 +39,8 @@
# Be advised, RDoc will not detect delegated methods. # Be advised, RDoc will not detect delegated methods.
# #
class Delegator < BasicObject class Delegator < BasicObject
VERSION = "0.1.0"
kernel = ::Kernel.dup kernel = ::Kernel.dup
kernel.class_eval do kernel.class_eval do
alias __raise__ raise alias __raise__ raise

View File

@ -1,12 +1,15 @@
begin # frozen_string_literal: true
require_relative "lib/delegate/version"
rescue LoadError # Fallback to load version file in ruby core repository name = File.basename(__FILE__, ".gemspec")
require_relative "version" 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 end
Gem::Specification.new do |spec| Gem::Specification.new do |spec|
spec.name = "delegate" spec.name = name
spec.version = Delegator::VERSION spec.version = version
spec.authors = ["Yukihiro Matsumoto"] spec.authors = ["Yukihiro Matsumoto"]
spec.email = ["matz@ruby-lang.org"] spec.email = ["matz@ruby-lang.org"]

View File

@ -1,3 +0,0 @@
class Delegator < BasicObject
VERSION = "0.1.0"
end

View File

@ -110,7 +110,10 @@
# #
module Forwardable module Forwardable
require 'forwardable/impl' require 'forwardable/impl'
require "forwardable/version"
# Version of +forwardable.rb+
VERSION = "1.3.1"
FORWARDABLE_VERSION = VERSION
@debug = nil @debug = nil
class << self class << self

View File

@ -1,13 +1,15 @@
begin # frozen_string_literal: true
require_relative "lib/forwardable/version"
rescue LoadError name = File.basename(__FILE__, ".gemspec")
# for Ruby core repository version = ["lib", Array.new(name.count("-")+1, "..").join("/")].find do |dir|
require_relative "version" break File.foreach(File.join(__dir__, dir, "#{name.tr('-', '/')}.rb")) do |line|
/^\s*VERSION\s*=\s*"(.*)"/ =~ line and break $1
end rescue nil
end end
Gem::Specification.new do |spec| Gem::Specification.new do |spec|
spec.name = "forwardable" spec.name = name
spec.version = Forwardable::VERSION spec.version = version
spec.authors = ["Keiju ISHITSUKA"] spec.authors = ["Keiju ISHITSUKA"]
spec.email = ["keiju@ruby-lang.org"] spec.email = ["keiju@ruby-lang.org"]

View File

@ -1,5 +0,0 @@
module Forwardable
# Version of +forwardable.rb+
VERSION = "1.3.1"
FORWARDABLE_VERSION = VERSION
end

View File

@ -85,6 +85,9 @@
# hello -n 6 --name -- /tmp # hello -n 6 --name -- /tmp
# #
class GetoptLong class GetoptLong
# Version.
VERSION = "0.1.0"
# #
# Orderings. # Orderings.
# #

View File

@ -1,12 +1,15 @@
begin # frozen_string_literal: true
require_relative "lib/getoptlong/version"
rescue LoadError # Fallback to load version file in ruby core repository name = File.basename(__FILE__, ".gemspec")
require_relative "version" 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 end
Gem::Specification.new do |spec| Gem::Specification.new do |spec|
spec.name = "getoptlong" spec.name = name
spec.version = GetoptLong::VERSION spec.version = version
spec.authors = ["Yukihiro Matsumoto"] spec.authors = ["Yukihiro Matsumoto"]
spec.email = ["matz@ruby-lang.org"] spec.email = ["matz@ruby-lang.org"]

View File

@ -1,3 +0,0 @@
class GetoptLong
VERSION = "0.1.0"
end

View File

@ -1,13 +1,14 @@
# frozen_string_literal: true
name = File.basename(__FILE__, ".gemspec") name = File.basename(__FILE__, ".gemspec")
version = nil version = ["lib", Array.new(name.count("-")+1, "..").join("/")].find do |dir|
["lib", "../.."].find do |dir| break File.foreach(File.join(__dir__, dir, "#{name.tr('-', '/')}.rb")) do |line|
version = File.foreach(File.join(__dir__, dir, "#{name.tr('-', '/')}.rb")) do |line|
/^\s*VERSION\s*=\s*"(.*)"/ =~ line and break $1 /^\s*VERSION\s*=\s*"(.*)"/ =~ line and break $1
end rescue nil end rescue nil
end end
Gem::Specification.new do |spec| Gem::Specification.new do |spec|
spec.name = "net-ftp" spec.name = name
spec.version = version spec.version = version
spec.authors = ["Shugo Maeda"] spec.authors = ["Shugo Maeda"]
spec.email = ["shugo@ruby-lang.org"] spec.email = ["shugo@ruby-lang.org"]

View File

@ -388,6 +388,7 @@ module Net #:nodoc:
class HTTP < Protocol class HTTP < Protocol
# :stopdoc: # :stopdoc:
VERSION = "0.1.0"
Revision = %q$Revision$.split[1] Revision = %q$Revision$.split[1]
HTTPVersion = '1.1' HTTPVersion = '1.1'
begin begin

View File

@ -1,12 +1,15 @@
begin # frozen_string_literal: true
require_relative "lib/net/http/version"
rescue LoadError # Fallback to load version file in ruby core repository name = File.basename(__FILE__, ".gemspec")
require_relative "version" 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 end
Gem::Specification.new do |spec| Gem::Specification.new do |spec|
spec.name = "net-http" spec.name = name
spec.version = Net::Http::VERSION spec.version = version
spec.authors = ["NARUSE, Yui"] spec.authors = ["NARUSE, Yui"]
spec.email = ["naruse@airemix.jp"] spec.email = ["naruse@airemix.jp"]

View File

@ -1,5 +0,0 @@
module Net
module Http
VERSION = "0.1.0"
end
end

View File

@ -201,6 +201,8 @@ module Net
# Unicode", RFC 2152, May 1997. # Unicode", RFC 2152, May 1997.
# #
class IMAP < Protocol class IMAP < Protocol
VERSION = "0.1.0"
include MonitorMixin include MonitorMixin
if defined?(OpenSSL::SSL) if defined?(OpenSSL::SSL)
include OpenSSL include OpenSSL

View File

@ -1,12 +1,15 @@
begin # frozen_string_literal: true
require_relative 'lib/net/imap/version'
rescue LoadError # Fallback to load version file in ruby core repository name = File.basename(__FILE__, ".gemspec")
require_relative "version" 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 end
Gem::Specification.new do |spec| Gem::Specification.new do |spec|
spec.name = "net-imap" spec.name = name
spec.version = Net::Imap::VERSION spec.version = version
spec.authors = ["Shugo Maeda"] spec.authors = ["Shugo Maeda"]
spec.email = ["shugo@ruby-lang.org"] spec.email = ["shugo@ruby-lang.org"]

View File

@ -1,5 +0,0 @@
module Net
module Imap
VERSION = "0.1.0"
end
end

View File

@ -194,9 +194,8 @@ module Net
# String. Normally the unique-id is a hash of the message. # String. Normally the unique-id is a hash of the message.
# #
class POP3 < Protocol class POP3 < Protocol
# version of this library
# svn revision of this library VERSION = "0.1.0"
Revision = %q$Revision$.split[1]
# #
# Class Parameters # Class Parameters

View File

@ -1,12 +1,15 @@
begin # frozen_string_literal: true
require_relative "lib/net/pop/version"
rescue LoadError # Fallback to load version file in ruby core repository name = File.basename(__FILE__, ".gemspec")
require_relative "version" 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 end
Gem::Specification.new do |spec| Gem::Specification.new do |spec|
spec.name = "net-pop" spec.name = name
spec.version = Net::POP3::VERSION spec.version = version
spec.authors = ["Yukihiro Matsumoto"] spec.authors = ["Yukihiro Matsumoto"]
spec.email = ["matz@ruby-lang.org"] spec.email = ["matz@ruby-lang.org"]

View File

@ -1,6 +0,0 @@
module Net
class Protocol; end
class POP3 < Protocol
VERSION = "0.1.0"
end
end

View File

@ -26,6 +26,8 @@ require 'io/wait'
module Net # :nodoc: module Net # :nodoc:
class Protocol #:nodoc: internal use only class Protocol #:nodoc: internal use only
VERSION = "0.1.0"
private private
def Protocol.protocol_param(name, val) def Protocol.protocol_param(name, val)
module_eval(<<-End, __FILE__, __LINE__ + 1) module_eval(<<-End, __FILE__, __LINE__ + 1)

View File

@ -1,12 +1,15 @@
begin # frozen_string_literal: true
require_relative "lib/net/protocol/version"
rescue LoadError # Fallback to load version file in ruby core repository name = File.basename(__FILE__, ".gemspec")
require_relative "version" 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 end
Gem::Specification.new do |spec| Gem::Specification.new do |spec|
spec.name = "net-protocol" spec.name = name
spec.version = Net::Protocol::VERSION spec.version = version
spec.authors = ["Yukihiro Matsumoto"] spec.authors = ["Yukihiro Matsumoto"]
spec.email = ["matz@ruby-lang.org"] spec.email = ["matz@ruby-lang.org"]

View File

@ -1,5 +0,0 @@
module Net
class Protocol
VERSION = "0.1.0"
end
end

View File

@ -168,6 +168,7 @@ module Net
# 'Your Account', 'Your Password', :cram_md5) # 'Your Account', 'Your Password', :cram_md5)
# #
class SMTP < Protocol class SMTP < Protocol
VERSION = "0.1.0"
Revision = %q$Revision$.split[1] Revision = %q$Revision$.split[1]

View File

@ -1,12 +1,15 @@
begin # frozen_string_literal: true
require_relative "lib/net/smtp/version"
rescue LoadError # Fallback to load version file in ruby core repository name = File.basename(__FILE__, ".gemspec")
require_relative "version" 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 end
Gem::Specification.new do |spec| Gem::Specification.new do |spec|
spec.name = "net-smtp" spec.name = name
spec.version = Net::SMTP::VERSION spec.version = version
spec.authors = ["Yukihiro Matsumoto"] spec.authors = ["Yukihiro Matsumoto"]
spec.email = ["matz@ruby-lang.org"] spec.email = ["matz@ruby-lang.org"]

View File

@ -1,6 +0,0 @@
module Net
class Protocol; end
class SMTP < Protocol
VERSION = "0.1.0"
end
end

View File

@ -136,6 +136,7 @@
# ticker.add_observer(warner, :call) # ticker.add_observer(warner, :call)
# ticker.run # ticker.run
module Observable module Observable
VERSION = "0.1.0"
# #
# Add +observer+ as an observer on this object. So that it will receive # Add +observer+ as an observer on this object. So that it will receive

View File

@ -1,12 +1,15 @@
begin # frozen_string_literal: true
require_relative "lib/observer/version"
rescue LoadError # Fallback to load version file in ruby core repository name = File.basename(__FILE__, ".gemspec")
require_relative "version" 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 end
Gem::Specification.new do |spec| Gem::Specification.new do |spec|
spec.name = "observer" spec.name = name
spec.version = Observer::VERSION spec.version = version
spec.authors = ["Yukihiro Matsumoto"] spec.authors = ["Yukihiro Matsumoto"]
spec.email = ["matz@ruby-lang.org"] spec.email = ["matz@ruby-lang.org"]

View File

@ -1,3 +0,0 @@
module Observer
VERSION = "0.1.0"
end

View File

@ -30,6 +30,7 @@
# #
module Open3 module Open3
VERSION = "0.1.0"
# Open stdin, stdout, and stderr streams and start external executable. # Open stdin, stdout, and stderr streams and start external executable.
# In addition, a thread to wait for the started process is created. # In addition, a thread to wait for the started process is created.

View File

@ -1,12 +1,15 @@
begin # frozen_string_literal: true
require_relative "lib/open3/version"
rescue LoadError # Fallback to load version file in ruby core repository name = File.basename(__FILE__, ".gemspec")
require_relative "version" 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 end
Gem::Specification.new do |spec| Gem::Specification.new do |spec|
spec.name = "open3" spec.name = name
spec.version = Open3::VERSION spec.version = version
spec.authors = ["Yukihiro Matsumoto"] spec.authors = ["Yukihiro Matsumoto"]
spec.email = ["matz@ruby-lang.org"] spec.email = ["matz@ruby-lang.org"]

View File

@ -1,3 +0,0 @@
module Open3
VERSION = "0.1.0"
end

View File

@ -1,7 +1,8 @@
# frozen_string_literal: true
name = File.basename(__FILE__, ".gemspec") name = File.basename(__FILE__, ".gemspec")
version = nil version = ["lib", Array.new(name.count("-")+1, "..").join("/")].find do |dir|
["lib", ".."].find do |dir| break File.foreach(File.join(__dir__, dir, "#{name.tr('-', '/')}.rb")) do |line|
version = File.foreach(File.join(__dir__, dir, "#{name}.rb")) do |line|
/^\s*OptionParser::Version\s*=\s*"(.*)"/ =~ line and break $1 /^\s*OptionParser::Version\s*=\s*"(.*)"/ =~ line and break $1
end rescue nil end rescue nil
end end

View File

@ -9,8 +9,6 @@
# See OpenStruct for an example. # See OpenStruct for an example.
# #
require_relative 'ostruct/version'
# #
# An OpenStruct is a data structure, similar to a Hash, that allows the # An OpenStruct is a data structure, similar to a Hash, that allows the
# definition of arbitrary attributes with their accompanying values. This is # definition of arbitrary attributes with their accompanying values. This is
@ -75,6 +73,7 @@ require_relative 'ostruct/version'
# of these properties compared to using a Hash or a Struct. # of these properties compared to using a Hash or a Struct.
# #
class OpenStruct class OpenStruct
VERSION = "0.2.0"
# #
# Creates a new OpenStruct object. By default, the resulting OpenStruct # Creates a new OpenStruct object. By default, the resulting OpenStruct

View File

@ -1,15 +1,15 @@
# frozen_string_literal: true # frozen_string_literal: true
begin name = File.basename(__FILE__, ".gemspec")
require_relative "lib/ostruct/version" version = ["lib", Array.new(name.count("-")+1, "..").join("/")].find do |dir|
rescue LoadError break File.foreach(File.join(__dir__, dir, "#{name.tr('-', '/')}.rb")) do |line|
# for Ruby core repository /^\s*VERSION\s*=\s*"(.*)"/ =~ line and break $1
require_relative "version" end rescue nil
end end
Gem::Specification.new do |spec| Gem::Specification.new do |spec|
spec.name = "ostruct" spec.name = name
spec.version = OpenStruct::VERSION spec.version = version
spec.authors = ["Marc-Andre Lafortune"] spec.authors = ["Marc-Andre Lafortune"]
spec.email = ["ruby-core@marc-andre.ca"] spec.email = ["ruby-core@marc-andre.ca"]

View File

@ -1,5 +0,0 @@
# frozen_string_literal: true
class OpenStruct
VERSION = "0.2.0"
end

View File

@ -92,6 +92,8 @@ require "digest"
# Needless to say, if you're storing valuable data with PStore, then you should # Needless to say, if you're storing valuable data with PStore, then you should
# backup the PStore files from time to time. # backup the PStore files from time to time.
class PStore class PStore
VERSION = "0.1.0"
RDWR_ACCESS = {mode: IO::RDWR | IO::CREAT | IO::BINARY, encoding: Encoding::ASCII_8BIT}.freeze RDWR_ACCESS = {mode: IO::RDWR | IO::CREAT | IO::BINARY, encoding: Encoding::ASCII_8BIT}.freeze
RD_ACCESS = {mode: IO::RDONLY | IO::BINARY, encoding: Encoding::ASCII_8BIT}.freeze RD_ACCESS = {mode: IO::RDONLY | IO::BINARY, encoding: Encoding::ASCII_8BIT}.freeze
WR_ACCESS = {mode: IO::WRONLY | IO::CREAT | IO::TRUNC | IO::BINARY, encoding: Encoding::ASCII_8BIT}.freeze WR_ACCESS = {mode: IO::WRONLY | IO::CREAT | IO::TRUNC | IO::BINARY, encoding: Encoding::ASCII_8BIT}.freeze

View File

@ -1,12 +1,15 @@
begin # frozen_string_literal: true
require_relative "lib/pstore/version"
rescue LoadError # Fallback to load version file in ruby core repository name = File.basename(__FILE__, ".gemspec")
require_relative "version" 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 end
Gem::Specification.new do |spec| Gem::Specification.new do |spec|
spec.name = "pstore" spec.name = name
spec.version = PStore::VERSION spec.version = version
spec.authors = ["Yukihiro Matsumoto"] spec.authors = ["Yukihiro Matsumoto"]
spec.email = ["matz@ruby-lang.org"] spec.email = ["matz@ruby-lang.org"]

View File

@ -1,3 +0,0 @@
class PStore
VERSION = "0.1.0"
end

View File

@ -92,6 +92,8 @@
# p a.strip # => nil # p a.strip # => nil
# #
module Singleton module Singleton
VERSION = "0.1.0"
# Raises a TypeError to prevent cloning. # Raises a TypeError to prevent cloning.
def clone def clone
raise TypeError, "can't clone instance of singleton #{self.class}" raise TypeError, "can't clone instance of singleton #{self.class}"

View File

@ -1,12 +1,15 @@
begin # frozen_string_literal: true
require_relative "lib/singleton/version"
rescue LoadError # Fallback to load version file in ruby core repository name = File.basename(__FILE__, ".gemspec")
require_relative "version" 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 end
Gem::Specification.new do |spec| Gem::Specification.new do |spec|
spec.name = "singleton" spec.name = name
spec.version = Singleton::VERSION spec.version = version
spec.authors = ["Yukihiro Matsumoto"] spec.authors = ["Yukihiro Matsumoto"]
spec.email = ["matz@ruby-lang.org"] spec.email = ["matz@ruby-lang.org"]

View File

@ -1,3 +0,0 @@
module Singleton
VERSION = "0.1.0"
end

View File

@ -23,6 +23,8 @@
# Copyright:: (C) 2000 Information-technology Promotion Agency, Japan # Copyright:: (C) 2000 Information-technology Promotion Agency, Japan
module Timeout module Timeout
VERSION = "0.1.0"
# Raised by Timeout.timeout when the block times out. # Raised by Timeout.timeout when the block times out.
class Error < RuntimeError class Error < RuntimeError
attr_reader :thread attr_reader :thread

View File

@ -1,12 +1,15 @@
begin # frozen_string_literal: true
require_relative "lib/timeout/version"
rescue LoadError # Fallback to load version file in ruby core repository name = File.basename(__FILE__, ".gemspec")
require_relative "version" 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 end
Gem::Specification.new do |spec| Gem::Specification.new do |spec|
spec.name = "timeout" spec.name = name
spec.version = Timeout::VERSION spec.version = version
spec.authors = ["Yukihiro Matsumoto"] spec.authors = ["Yukihiro Matsumoto"]
spec.email = ["matz@ruby-lang.org"] spec.email = ["matz@ruby-lang.org"]

View File

@ -1,3 +0,0 @@
module Timeout
VERSION = "0.1.0"
end

View File

@ -60,6 +60,7 @@
# by Keiju ISHITSUKA(keiju@ishitsuka.com) # by Keiju ISHITSUKA(keiju@ishitsuka.com)
# #
class Tracer class Tracer
VERSION = "0.1.0"
class << self class << self
# display additional debug information (defaults to false) # display additional debug information (defaults to false)

View File

@ -1,13 +1,15 @@
begin # frozen_string_literal: true
require_relative "lib/tracer/version"
rescue LoadError name = File.basename(__FILE__, ".gemspec")
# for Ruby core repository version = ["lib", Array.new(name.count("-")+1, "..").join("/")].find do |dir|
require_relative "version" break File.foreach(File.join(__dir__, dir, "#{name.tr('-', '/')}.rb")) do |line|
/^\s*VERSION\s*=\s*"(.*)"/ =~ line and break $1
end rescue nil
end end
Gem::Specification.new do |spec| Gem::Specification.new do |spec|
spec.name = "tracer" spec.name = name
spec.version = Tracer::VERSION spec.version = version
spec.authors = ["Keiju ISHITSUKA"] spec.authors = ["Keiju ISHITSUKA"]
spec.email = ["keiju@ruby-lang.org"] spec.email = ["keiju@ruby-lang.org"]

View File

@ -1,5 +0,0 @@
# frozen_string_literal: true
class Tracer
VERSION = "0.1.0"
end

View File

@ -17,6 +17,7 @@ require "delegate"
# #
class WeakRef < Delegator class WeakRef < Delegator
VERSION = "0.1.0"
## ##
# RefError is raised when a referenced object has been recycled by the # RefError is raised when a referenced object has been recycled by the

View File

@ -1,3 +0,0 @@
module Weakref
VERSION = "0.1.0"
end

View File

@ -1,10 +1,15 @@
lib = File.expand_path("lib", __dir__) # frozen_string_literal: true
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "weakref/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| Gem::Specification.new do |spec|
spec.name = "weakref" spec.name = name
spec.version = Weakref::VERSION spec.version = version
spec.authors = ["Yukihiro Matsumoto"] spec.authors = ["Yukihiro Matsumoto"]
spec.email = ["matz@ruby-lang.org"] spec.email = ["matz@ruby-lang.org"]