Skip to content

Reduce gem size by excluding test files#225

Merged
fwininger merged 4 commits intomgomes:masterfrom
yuri-zubov:reduce-gem-size
Mar 7, 2026
Merged

Reduce gem size by excluding test files#225
fwininger merged 4 commits intomgomes:masterfrom
yuri-zubov:reduce-gem-size

Conversation

@yuri-zubov
Copy link
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
 44K	before.tar
 24K	after.tar
Metric Before After Saved
Size 44K 24K −20K (⏷ −45.5%)

whitch files was deleted?

data
-├── api_auth.gemspec
-├── Appraisals
 ├── CHANGELOG.md
-├── Gemfile
-├── gemfiles
-│   ├── rails_7.gemfile
-│   ├── rails_8.1.gemfile
-│   └── rails_8.gemfile
 ├── lib
 │   ├── api_auth
 │   │   ├── base.rb
 │   │   ├── errors.rb
 │   │   ├── headers.rb
 │   │   ├── helpers.rb
 │   │   ├── middleware
 │   │   │   └── excon.rb
 │   │   ├── railtie.rb
 │   │   └── request_drivers
 │   │       ├── action_controller.rb
 │   │       ├── action_dispatch.rb
 │   │       ├── curb.rb
 │   │       ├── excon.rb
 │   │       ├── faraday_env.rb
 │   │       ├── faraday.rb
 │   │       ├── grape_request.rb
 │   │       ├── http.rb
 │   │       ├── httpi.rb
 │   │       ├── net_http.rb
 │   │       ├── rack.rb
 │   │       ├── rest_client.rb
 │   │       └── typhoeus_request.rb
 │   ├── api_auth.rb
 │   ├── api-auth.rb
 │   ├── excon
 │   │   └── api_auth.rb
 │   └── faraday
 │       ├── api_auth
 │       │   └── middleware.rb
 │       └── api_auth.rb
 ├── LICENSE.txt
-├── Rakefile
 ├── README.md
-├── spec
-│   ├── api_auth_spec.rb
-│   ├── faraday_middleware_spec.rb
-│   ├── fixtures
-│   │   └── upload.png
-│   ├── headers_spec.rb
-│   ├── helpers_spec.rb
-│   ├── railtie_spec.rb
-│   ├── request_drivers
-│   │   ├── action_controller_spec.rb
-│   │   ├── action_dispatch_spec.rb
-│   │   ├── curb_spec.rb
-│   │   ├── excon_spec.rb
-│   │   ├── faraday_env_spec.rb
-│   │   ├── faraday_spec.rb
-│   │   ├── grape_request_spec.rb
-│   │   ├── http_spec.rb
-│   │   ├── httpi_spec.rb
-│   │   ├── net_http_spec.rb
-│   │   ├── rack_spec.rb
-│   │   ├── rest_client_spec.rb
-│   │   └── typhoeus_request_spec.rb
-│   └── spec_helper.rb
-└── VERSION

ps: you can see on rails repo

s.add_development_dependency 'rubocop', '~> 1.50'
s.add_development_dependency 'typhoeus', '~> 1.4'

s.files = `git ls-files`.split("\n")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Contributor Author

@yuri-zubov yuri-zubov Mar 6, 2026

Choose a reason for hiding this comment

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

api_auth.gemspec is not necessary
Added VERSION

Copy link
Contributor Author

@yuri-zubov yuri-zubov Mar 6, 2026

Choose a reason for hiding this comment

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

@fwininger
The same MR in the popular gem friendly_id

https://github.com/rgrove/sanitize/pull/248/changes
No one adds gemspec

@fwininger
Copy link
Collaborator

Thanks @yuri-zubov

@yuri-zubov
Copy link
Contributor Author

@fwininger

https://github.com/mgomes/api_auth/actions/runs/22763567494/job/66025994083

I don't want to fix rubocop

lib/api_auth/request_drivers/rest_client.rb:4:1: C: Style/OneClassPerFile: Do not define multiple classes/modules at the top level in a single file.
module ApiAuth
^^^^^^^^^^^^^^

It's not my changes :)

@yuri-zubov
Copy link
Contributor Author

@fwininger

I have just fixed Style/OneClassPerFile, re-run CI again please

@fwininger fwininger merged commit 82d9455 into mgomes:master Mar 7, 2026
10 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