From 26ddc436e828cb2527be7cd2d0d1bb5e8b10b868 Mon Sep 17 00:00:00 2001 From: Orien Madgwick <497874+orien@users.noreply.github.com> Date: Tue, 21 Feb 2023 23:30:55 +1100 Subject: [PATCH] Remove development and test files from the gem package (#503) There are several files in the gem package that aren't useful for downstream projects. Removing these files reduces the gem package size from 34K to 24K! --- cells.gemspec | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cells.gemspec b/cells.gemspec index 556fa7dd..6ccfe9a9 100644 --- a/cells.gemspec +++ b/cells.gemspec @@ -19,8 +19,11 @@ Gem::Specification.new do |spec| spec.metadata['source_code_uri'] = spec.homepage spec.metadata['wiki_uri'] = "#{spec.homepage}/wiki" - spec.files = `git ls-files`.split("\n") - spec.test_files = `git ls-files -- {test}/*`.split("\n") + spec.files = Dir.chdir(__dir__) do + `git ls-files -z`.split("\x0").reject do |file| + file.start_with?(*%w[.git Gemfile Rakefile TODO test]) + end + end spec.require_paths = ['lib'] spec.required_ruby_version = '>= 2.2.10'