diff options
-rw-r--r-- | lib/time.gemspec | 11 | ||||
-rw-r--r-- | lib/time.rb | 3 |
2 files changed, 12 insertions, 2 deletions
diff --git a/lib/time.gemspec b/lib/time.gemspec index ce5f76f8e9..a9349a253f 100644 --- a/lib/time.gemspec +++ b/lib/time.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 = "time" - spec.version = "0.2.2" + spec.name = name + spec.version = version spec.authors = ["Tanaka Akira"] spec.email = ["[email protected]"] diff --git a/lib/time.rb b/lib/time.rb index 6a13212a49..c572e76d7d 100644 --- a/lib/time.rb +++ b/lib/time.rb @@ -25,6 +25,9 @@ require 'date' # :startdoc: class Time + + VERSION = "0.2.2" + class << Time # |