โฏ๏ธ Zip::Merge
if ci_badges.map(&:color).detect { it != "green"} โ๏ธ let me know on Discord or RubyForum, as I may have missed the notification.
if ci_badges.map(&:color).all? { it == "green"} ๐๏ธ send money so I can do more of this. FLOSS maintenance is now my full-time job.
๐ฃ How will this project approach the September 2025 hostile takeover of RubyGems? ๐๏ธ
I've summarized my thoughts in this blog post.
๐ป Synopsis

Zip::Merge plans ZIP archive merges by member path and raw byte ranges. It is
a Kaitai-family binary AST integration in the StructuredMerge stack: ZIP
inventories are represented with TreeHaver ZIP report nodes, and analysis enters
through a parser_for(:zip) Kaitai path. It depends on binary-merge for the
shared binary-family substrate: preservation reports, unsafe diagnostics,
byte-range ownership, and renderer planning vocabulary.
It identifies safe preservation cases, unsafe entries, members that need
structured nested merges, and archive metadata that must be rewritten by a
renderer.
Key Features
- Central directory and local header inventory parsing.
- Kaitai-family binary AST reporting through TreeHaver ZIP structures.
- Shared binary-family report and diagnostic helpers from
binary-merge. - Member decisions for preserve, add, delete, rewrite, delegate, and reject operations.
- Nested family dispatch for structured archive members.
- Raw-preserving renderer for safe unchanged members.
- Checksum and central-directory update reporting.
๐ก Info you can shake a stick at
| Tokens to Remember | |
|---|---|
| Works with MRI Ruby 4 | |
| Support & Community | |
| Source | |
| Documentation | |
| Compliance | |
| Style | |
| Maintainer ๐๏ธ | |
... ๐ |
Compatibility
Compatible with MRI Ruby 4.0.0+, and concordant releases of JRuby, and TruffleRuby.
CI workflows and Appraisals are generated for MRI Ruby 4.0.0+.
This test floor is configured by ruby.test_minimum in .kettle-jem.yml and
may be higher than the gem's runtime compatibility floor when legacy Rubies are
not practical for the current toolchain.
The amazing test matrix is powered by the kettle-dev stack.
How kettle-dev manages complexity in tests
| Gem | Source | Role | Total downloads |
|---|---|---|---|
| appraisal2 | GitHub | multi-dependency Appraisal matrix generation | |
| appraisal2-rubocop | GitHub | RuboCop Appraisal generator integration | |
| kettle-dev | GitHub | development, release, and CI workflow tooling | |
| kettle-jem | GitHub | Appraisals & CI workflow templates | |
| kettle-soup-cover | GitHub | SimpleCov coverage policy and reporting | |
| kettle-test | GitHub | standard test runner and coverage harness | |
| rubocop-lts | GitHub | Ruby-version-aware linting | |
| turbo_tests2 | GitHub | parallel test execution |
โจ Installation
Install the gem and add to the application's Gemfile by executing:
bundle add zip-merge
If bundler is not being used to manage dependencies, install the gem by executing:
gem install zip-merge
โ๏ธ Configuration
Zip::Merge works from parsed inventories rather than global settings.
ancestor = Zip::Merge.parse_zip_inventory(ancestor_bytes)
current = Zip::Merge.parse_zip_inventory(current_bytes)
incoming = Zip::Merge.parse_zip_inventory(incoming_bytes)
plan = Zip::Merge.plan_zip_merge(ancestor, current, incoming)
Rendering requires caller-supplied member bytes for added, rewritten, or delegated members.
๐ง Basic Usage
require "zip/merge"
zip_parser = TreeHaver.parser_for(:zip, backend_type: :kaitai)
ancestor = zip_parser.parse(File.binread("base.zip"))
current = zip_parser.parse(File.binread("ours.zip"))
incoming = zip_parser.parse(File.binread("theirs.zip"))
plan = Zip::Merge.plan_zip_merge(ancestor, current, incoming)
plan.member_decisions.each do |decision|
puts "#{decision.operation}: #{decision.normalized_path}"
end
๐ Security
See SECURITY.md.
๐ค Contributing
If you need some ideas of where to help, you could work on adding more code coverage, or if it is already ๐ฏ (see below) check issues or PRs, or use the gem and think about how it could be better.
We so if you make changes, remember to update it.
See CONTRIBUTING.md for more detailed instructions.
Code Coverage
Coverage service badges
๐ Versioning
This library follows for its public API where practical.
For most applications, prefer the Pessimistic Version Constraint with two digits of precision.
For example:
spec.add_dependency("zip-merge", "~> 7.0")
๐ Is "Platform Support" part of the public API? More details inside.
Dropping support for a platform can be a breaking change for affected users. If a release changes supported platforms, it should be called out clearly in the changelog and versioned with that impact in mind.
To get a better understanding of how SemVer is intended to work over a project's lifetime, read this article from the creator of SemVer:
See CHANGELOG.md for a list of releases.
๐ License
The gem is available under the following licenses: AGPL-3.0-only, PolyForm-Small-Business-1.0.0. See LICENSE.md for details.
If none of the available licenses suit your use case, please contact us to discuss a custom commercial license.
