diff options
Diffstat (limited to 'lib/shellwords.gemspec')
| -rw-r--r-- | lib/shellwords.gemspec | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/lib/shellwords.gemspec b/lib/shellwords.gemspec index 8ae87b230e..b601508f94 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"] @@ -13,10 +21,9 @@ Gem::Specification.new do |spec| spec.metadata["homepage_uri"] = spec.homepage spec.metadata["source_code_uri"] = spec.homepage - spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do - `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } + srcdir, gemspec_file = File.split(__FILE__) + spec.files = Dir.chdir(srcdir) do + `git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:(?:test|spec|features)/|\.git|Rake)}) || f == gemspec_file} end - spec.bindir = "exe" - spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ["lib"] end |
