diff --git a/templates/new_gem/fluent-plugin.gemspec.erb b/templates/new_gem/fluent-plugin.gemspec.erb index 6eb8a54bfc..97a69d153d 100644 --- a/templates/new_gem/fluent-plugin.gemspec.erb +++ b/templates/new_gem/fluent-plugin.gemspec.erb @@ -12,12 +12,13 @@ Gem::Specification.new do |spec| spec.homepage = "TODO: Put your gem's website or public repo URL here." spec.license = "<%= @license.name %>" - test_files, files = `git ls-files -z`.split("\x0").partition do |f| - f.match(%r{^(test|spec|features)/}) + spec.files = Dir.chdir(__dir__) do + `git ls-files -z`.split("\x0").reject do |f| + (File.expand_path(f) == __FILE__) || + f.start_with?(*%w[test/ spec/ features/ .git .circleci appveyor Gemfile]) + end end - spec.files = files - spec.executables = files.grep(%r{^bin/}) { |f| File.basename(f) } - spec.test_files = test_files + spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } spec.require_paths = ["lib"] spec.add_development_dependency "bundler", "~> <%= bundler_version %>"