Skip to content

Reduce gem size by excluding test files#83

Merged
aetherknight merged 1 commit intoaetherknight:mainfrom
yuri-zubov:reduce-gem-size
Apr 18, 2026
Merged

Reduce gem size by excluding test files#83
aetherknight merged 1 commit intoaetherknight:mainfrom
yuri-zubov:reduce-gem-size

Conversation

@yuri-zubov
Copy link
Copy Markdown
Contributor

@yuri-zubov yuri-zubov commented Apr 11, 2026

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
 24K	before.tar
 16K	after.tar
Metric Before After Saved
Size 24K 16K −8K (⏷ −33.3%)

whitch files was deleted?

data
-├── .github
-│   └── workflows
-│       └── ruby.yml
 ├── lib
 │   ├── recursive_open_struct
 │   │   ├── debug_inspect.rb
 │   │   ├── deep_dup.rb
 │   │   ├── dig.rb
 │   │   └── version.rb
 │   ├── recursive_open_struct.rb
 │   └── recursive-open-struct.rb
-├── spec
-│   ├── recursive_open_struct
-│   │   ├── debug_inspect_spec.rb
-│   │   ├── indifferent_access_spec.rb
-│   │   ├── open_struct_behavior_spec.rb
-│   │   ├── ostruct_2_0_0_spec.rb
-│   │   ├── ostruct_2_3_0_spec.rb
-│   │   ├── recursion_and_subclassing_spec.rb
-│   │   ├── recursion_spec.rb
-│   │   └── wrapping_spec.rb
-│   └── spec_helper.rb
-├── .document
-├── .gitignore
-├── .rspec
-├── .travis.yml
 ├── AUTHORS.txt
 ├── CHANGELOG.md
-├── CONTRIBUTING.md
-├── Gemfile
 ├── LICENSE.txt
-├── Rakefile
 ├── README.md
-└── recursive-open-struct.gemspec

ps: you can see on rails repo

QUOTE

s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files spec`.split("\n")
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.

ros.a_as_a_hash # { :b => 'c' }
QUOTE

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

Choose a reason for hiding this comment

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

AUTHORS.txt needs to be included here as well for licensing purposes.

Copy link
Copy Markdown
Owner

@aetherknight aetherknight left a comment

Choose a reason for hiding this comment

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

The change looks good, and the reduction in final archive size is nice. Note, however, that we should also include the AUTHORS.txt file in the gem archive. Once that is done, I'll do a final check, then merge.

@yuri-zubov
Copy link
Copy Markdown
Contributor Author

The change looks good, and the reduction in final archive size is nice. Note, however, that we should also include the AUTHORS.txt file in the gem archive. Once that is done, I'll do a final check, then merge.

done

@aetherknight aetherknight merged commit 18a4cdd into aetherknight:main Apr 18, 2026
9 checks passed
@aetherknight
Copy link
Copy Markdown
Owner

The change has been released in recursive-open-struct 2.1.1, along with some other maintenance changes for the project.

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