treasure-data / trino-client-ruby

Trino/Presto client library for Ruby
Apache License 2.0
70 stars 45 forks source link

Reduce published gem size #113

Closed ybiquitous closed 1 year ago

ybiquitous commented 1 year ago

Purpose

This Pull Request reduces the published gem size by excluding unneeded files for execution. The latest version's gem size is 98.5 KB.

image

https://rubygems.org/gems/trino-client/versions/2.0.0

Overview

The PR updates the files option in the gemspec file.

You can confirm the size diff by the following verification: 100K -> 84K (-16K)

$ git checkout master && gem build -o before.gem
...
$ git checkout reduce-published-gem-size && gem build -o after.gem
...
$ du -h before.gem after.gem
100K    before.gem
 84K    after.gem

Here are files included in the packed gem file:

$ gem build && gem unpack *.gem
...
$ tree trino-client-2.0.0/
trino-client-2.0.0//
├── ChangeLog.md
├── LICENSE
├── README.md
├── SECURITY.md
├── lib/
│   ├── trino/
│   │   ├── client/
│   │   │   ├── client.rb
│   │   │   ├── errors.rb
│   │   │   ├── faraday_client.rb
│   │   │   ├── model_versions/
│   │   │   │   ├── 0.149.rb
│   │   │   │   ├── 0.153.rb
│   │   │   │   ├── 0.173.rb
│   │   │   │   ├── 0.178.rb
│   │   │   │   ├── 0.205.rb
│   │   │   │   ├── 303.rb
│   │   │   │   ├── 316.rb
│   │   │   │   └── 351.rb
│   │   │   ├── models.rb
│   │   │   ├── query.rb
│   │   │   ├── statement_client.rb
│   │   │   └── version.rb
│   │   └── client.rb
│   └── trino-client.rb
└── trino-client.gemspec

5 directories, 22 files

Checklist

ybiquitous commented 1 year ago

If a new gem package is necessary, please let me know. I will publish.

Yeah, I need a new version with decreased size. Can you publish it? Thanks.

yuokada commented 1 year ago

@ybiquitous Published v2.0.1. https://rubygems.org/gems/trino-client/versions/2.0.1

ybiquitous commented 1 year ago

Thank you! 🎉

image

https://rubygems.org/gems/trino-client/versions/2.0.1

And much better diff of the gem! https://my.diffend.io/gems/trino-client/2.0.0/2.0.1