Skip to content

Reduce gem size by excluding test files - #215

Merged
flavorjones merged 1 commit into
rails:mainfrom
yuri-zubov:reduce-gem-size
May 11, 2026
Merged

flavorjones merged 1 commit into
rails:mainfrom
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 −12K (⏷ −42.9%)

whitch files was deleted?

data
 ├── lib
 │   ├── rails
 │   │   └── html
 │   │       ├── sanitizer
 │   │       │   └── version.rb
 │   │       ├── sanitizer.rb
 │   │       └── scrubbers.rb
 │   └── rails-html-sanitizer.rb
-├── test
-│   ├── rails_api_test.rb
-│   ├── sanitizer_test.rb
-│   ├── scrubbers_test.rb
-│   └── test_helper.rb
 ├── CHANGELOG.md
 ├── MIT-LICENSE
 └── README.md

ps: you can see on rails repo

}

spec.files = Dir["lib/**/*", "README.md", "MIT-LICENSE", "CHANGELOG.md"]
spec.test_files = Dir["test/**/*"]

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.

@flavorjones

Copy link
Copy Markdown
Member

@yuri-zubov Thank you!

@flavorjones
flavorjones merged commit f87abb4 into rails:main May 11, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants