Skip to content

Reduce gem size by excluding test files#216

Merged
Fryguy merged 1 commit into
ManageIQ:masterfrom
yuri-zubov:reduce-gem-size
May 26, 2026
Merged

Reduce gem size by excluding test files#216
Fryguy merged 1 commit into
ManageIQ:masterfrom
yuri-zubov:reduce-gem-size

Conversation

@yuri-zubov
Copy link
Copy Markdown
Contributor

This pull request updates the *.gemspec file to optimize the gem package size and structure

$ gem build -o before.tar

$ git switch reduce-gem-size

$ gem build -o after.tar

$ du -sh before.tar after.tar
 28K	before.tar
 16K	after.tar
Metric Before After Saved
Size 28K 16K −20K (⏷ −45.5%)

whitch files was deleted?

data
-├── .github
-│   └── workflows
-│       └── ci.yaml
-├── examples
-│   ├── a_basic_example.rb
-│   ├── alt_names.rb
-│   ├── banners1.rb
-│   ├── banners2.rb
-│   ├── banners3.rb
-│   ├── boolean.rb
-│   ├── constraints.rb
-│   ├── didyoumean.rb
-│   ├── medium_example.rb
-│   ├── partialmatch.rb
-│   ├── permitted.rb
-│   └── types_custom.rb
 ├── lib
 │   └── optimist.rb
-├── test
-│   ├── optimist
-│   │   ├── alt_names_test.rb
-│   │   ├── command_line_error_test.rb
-│   │   ├── help_needed_test.rb
-│   │   ├── parser_constraint_test.rb
-│   │   ├── parser_educate_test.rb
-│   │   ├── parser_opt_test.rb
-│   │   ├── parser_parse_test.rb
-│   │   ├── parser_permitted_test.rb
-│   │   ├── parser_test.rb
-│   │   └── version_needed_test.rb
-│   ├── support
-│   │   └── assert_helpers.rb
-│   ├── optimist_test.rb
-│   └── test_helper.rb
-├── .gitignore
-├── .rubocop_local.yml
-├── .rubocop.yml
-├── .whitesource
 ├── CHANGELOG.md
-├── FAQ.txt
-├── Gemfile
 ├── LICENSE.txt
-├── optimist.gemspec
-├── Rakefile
 ├── README.md
-└── renovate.json

ps: you can see on rails repo

Comment thread optimist.gemspec

spec.files = `git ls-files -z`.split("\x0")
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test_files directive is no longer used by RubyGems.org.

Copy link
Copy Markdown
Member

@kbrock kbrock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have no tests or exe. It is boilerplate. Assuming we will not have new lines in our file names, so while that change is not necessary, looks good

@Fryguy
Copy link
Copy Markdown
Member

Fryguy commented May 26, 2026

is the gemspec required to be part of the package? I feel like we should include that one too.

@Fryguy Fryguy self-assigned this May 26, 2026
@Fryguy
Copy link
Copy Markdown
Member

Fryguy commented May 26, 2026

EDIT: Oh I see in your actioncable example there they don't have it - that works for me 👍

@Fryguy Fryguy merged commit 8c69f2e into ManageIQ:master May 26, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants