diff options
-rw-r--r-- | lib/shellwords.gemspec | 12 | ||||
-rw-r--r-- | lib/shellwords.rb | 3 |
2 files changed, 13 insertions, 2 deletions
diff --git a/lib/shellwords.gemspec b/lib/shellwords.gemspec index 8ae87b230e..d60ab5f650 100644 --- a/lib/shellwords.gemspec +++ b/lib/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"] diff --git a/lib/shellwords.rb b/lib/shellwords.rb index 4368a53ea8..5866601b17 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. # |