diff options
-rw-r--r-- | lib/base64.gemspec | 11 | ||||
-rw-r--r-- | lib/base64.rb | 3 |
2 files changed, 12 insertions, 2 deletions
diff --git a/lib/base64.gemspec b/lib/base64.gemspec index daa0b7fa14..d793dce063 100644 --- a/lib/base64.gemspec +++ b/lib/base64.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 = "base64" - spec.version = "0.1.1" + spec.name = name + spec.version = version spec.authors = ["Yusuke Endoh"] spec.email = ["[email protected]"] diff --git a/lib/base64.rb b/lib/base64.rb index 693aa1f519..15c0b297ce 100644 --- a/lib/base64.rb +++ b/lib/base64.rb @@ -22,6 +22,9 @@ # binary data into purely printable characters. module Base64 + + VERSION = "0.1.1" + module_function # Returns the Base64-encoded version of +bin+. |