From ba99eae2a596658a71079975fb7d53ae1f2341a5 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Thu, 23 Jul 2020 18:31:23 +0900 Subject: [PATCH] [ruby/optparse] Fix ls-files matching regexp As splitting by NUL means to allow the file names to contain newlines, path names should match at beginning-of-string instead of beginning-of-line. https://github.com/ruby/optparse/commit/df3933aa2b --- lib/optparse/optparse.gemspec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/optparse/optparse.gemspec b/lib/optparse/optparse.gemspec index d67060a63f..25f81c08bb 100644 --- a/lib/optparse/optparse.gemspec +++ b/lib/optparse/optparse.gemspec @@ -21,9 +21,9 @@ Gem::Specification.new do |spec| 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)/}) } + `git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) } end spec.bindir = "exe" - spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } + spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) } spec.require_paths = ["lib"] end