diff --git a/lib/prettyprint.rb b/lib/prettyprint.rb index 188c2e6..540b12f 100644 --- a/lib/prettyprint.rb +++ b/lib/prettyprint.rb @@ -33,6 +33,8 @@ # class PrettyPrint + VERSION = "0.1.1" + # This is a convenience method which is same as follows: # # begin diff --git a/prettyprint.gemspec b/prettyprint.gemspec index eae2227..a18adb1 100644 --- a/prettyprint.gemspec +++ b/prettyprint.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 = "prettyprint" - spec.version = "0.1.1" + spec.name = name + spec.version = version spec.authors = ["Tanaka Akira"] spec.email = ["akr@fsij.org"]