From 551e54793e32e2a21e387a57e403a4bd747ce3e3 Mon Sep 17 00:00:00 2001 From: Masafumi Koba <473530+ybiquitous@users.noreply.github.com> Date: Wed, 10 Jul 2024 12:17:38 +0900 Subject: [PATCH] Include minimum files in packed gem (#91) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Include minimum files in packed gem This aims to reduce the gem size by excluding unneeded files like test files, CI files, etc. Note that `test_files` in a gemspec is no longer supported. Gem size diff: ```sh-session $ du -h database_rewinder-1.0.1.gem* 12K database_rewinder-1.0.1.gem 16K database_rewinder-1.0.1.gem.old ``` Newly included files in the gem: ```sh-session $ tree -aF database_rewinder-1.0.1 database_rewinder-1.0.1/ ├── MIT_LICENSE ├── README.md └── lib/ ├── database_rewinder/ │   ├── active_record_monkey.rb │   ├── cleaner.rb │   ├── compatibility.rb │   ├── dummy_model.rb │   ├── multiple_statements_executor.rb │   └── railtie.rb └── database_rewinder.rb 3 directories, 9 files ``` * Prefer `git ls-files` to exclude unexpected files --- database_rewinder.gemspec | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/database_rewinder.gemspec b/database_rewinder.gemspec index 9966c41..8be0e92 100644 --- a/database_rewinder.gemspec +++ b/database_rewinder.gemspec @@ -14,9 +14,8 @@ Gem::Specification.new do |spec| spec.homepage = 'https://github.com/amatsuda/database_rewinder' spec.license = "MIT" - spec.files = `git ls-files`.split($/) + spec.files = `git ls-files lib/ MIT_LICENSE README.md`.split spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } - spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] spec.add_development_dependency 'bundler'