diff options
author | Hiroshi SHIBATA <[email protected]> | 2023-03-30 14:14:15 +0900 |
---|---|---|
committer | git <[email protected]> | 2023-04-13 09:49:14 +0000 |
commit | 8b924ebdf25fd77250d6ab69f162a2ab7fc888fc (patch) | |
tree | da0d4a15980e09dce2646939565a0654ba5e7b90 | |
parent | 84d11498c2198659ae2771dcdad09b1a4a4769d0 (diff) |
[ruby/tempfile] Expose Tempfile::VERSION
https://github.com/ruby/tempfile/commit/6aa1f37dc4
-rw-r--r-- | lib/tempfile.gemspec | 11 | ||||
-rw-r--r-- | lib/tempfile.rb | 2 |
2 files changed, 11 insertions, 2 deletions
diff --git a/lib/tempfile.gemspec b/lib/tempfile.gemspec index acb26b68db..6b433dd9a6 100644 --- a/lib/tempfile.gemspec +++ b/lib/tempfile.gemspec @@ -1,6 +1,13 @@ +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 = "tempfile" - spec.version = "0.1.3" + spec.name = name + spec.version = version spec.authors = ["Yukihiro Matsumoto"] spec.email = ["[email protected]"] diff --git a/lib/tempfile.rb b/lib/tempfile.rb index 1bb13e9501..d53d8c7196 100644 --- a/lib/tempfile.rb +++ b/lib/tempfile.rb @@ -88,6 +88,8 @@ require 'tmpdir' # mutex. class Tempfile < DelegateClass(File) + VERSION = "0.1.3" + # Creates a file in the underlying file system; # returns a new \Tempfile object based on that file. # |