diff --git a/lib/shellwords.rb b/lib/shellwords.rb index 4368a53..5866601 100644 --- a/lib/shellwords.rb +++ b/lib/shellwords.rb @@ -68,6 +68,9 @@ # 1: {IEEE Std 1003.1-2008, 2016 Edition, the Shell & Utilities volume}[http://pubs.opengroup.org/onlinepubs/9699919799/utilities/contents.html] module Shellwords + + VERSION = "0.1.0" + # Splits a string into an array of tokens in the same way the UNIX # Bourne shell does. # diff --git a/shellwords.gemspec b/shellwords.gemspec index 8ae87b2..d60ab5f 100644 --- a/shellwords.gemspec +++ b/shellwords.gemspec @@ -1,6 +1,14 @@ +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 = "shellwords" - spec.version = "0.1.0" + spec.name = name + spec.version = version spec.authors = ["Akinori MUSHA"] spec.email = ["knu@idaemons.org"]