zip-merge 7.1.20 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/LICENSE.md +3 -6
- data/README.md +94 -60
- data/lib/zip/merge/backend.rb +2 -2
- data/lib/zip/merge/provider.rb +4 -4
- data/lib/zip/merge/version.rb +1 -1
- data/lib/zip/merge.rb +102 -102
- data/lib/zip-merge.rb +3 -3
- data.tar.gz.sig +0 -0
- metadata +13 -14
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6b2bd3aec391e9417cee2ece2479d1f4e837b87705f7eaf1cc4ba570465fd0d3
|
|
4
|
+
data.tar.gz: d26a295c6a4c5c78dc6226369d31541df5f73457d6d495a31d96884afcd73e7f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 88d8da93fe6e475226c7e7deccccff5eb24e6ceac8fc354a42b6fe56c29c034e989312f84c546fb2a1d4ef21879ca62f0117cccf45f964cdc88dfb17cc3ba6a9
|
|
7
|
+
data.tar.gz: be9e8123721f6c283822f41a14f5d5527ab76c686fb15ffab39705ff3673151182412cd0d471dd52dd3b5b8717b3af42304e824d3a1d58b90e9122ce8cdb9c71
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/LICENSE.md
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
# License
|
|
2
2
|
|
|
3
|
-
This project is made available under the following
|
|
3
|
+
This project is made available under the following license.
|
|
4
4
|
Choose the option that best fits your use case:
|
|
5
5
|
|
|
6
|
-
- [
|
|
7
|
-
- [PolyForm-Small-Business-1.0.0](https://github.com/structuredmerge/structuredmerge-ruby/blob/main/PolyForm-Small-Business-1.0.0.md)
|
|
8
|
-
|
|
9
|
-
If none of the above licenses fit your use case, please [contact us](mailto:floss@galtzo.com) to discuss a custom commercial license.
|
|
6
|
+
- [MIT](https://github.com/structuredmerge/structuredmerge-ruby/blob/main/MIT.md)
|
|
10
7
|
|
|
11
8
|
## Copyright Notice
|
|
12
9
|
|
|
13
|
-
-
|
|
10
|
+
- Copyright (c) 2026 Peter H. Boling
|
data/README.md
CHANGED
|
@@ -2,22 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
# ☯️ Zip::Merge
|
|
4
4
|
|
|
5
|
-
[![Version][👽versioni]][👽version] [![Ruby Users Forum][✉️ruby-forum-top-img]][✉️ruby-forum] [![GitHub tag (latest SemVer)][⛳️tag-img]][⛳️tag] [![License:
|
|
5
|
+
[![Version][👽versioni]][👽version] [![Ruby Users Forum][✉️ruby-forum-top-img]][✉️ruby-forum] [![GitHub tag (latest SemVer)][⛳️tag-img]][⛳️tag] [![License: MIT][📄license-img]][📄license] [![Total downloads][👽dl-ranki]][👽dl-rank] [![CodeCov Test Coverage][🏀codecovi]][🏀codecov] [![Coveralls Test Coverage][🏀coveralls-img]][🏀coveralls] [![QLTY Test Coverage][🏀qlty-covi]][🏀qlty-cov] [![QLTY Maintainability][🏀qlty-mnti]][🏀qlty-mnt] [![CI Current][🚎11-c-wfi]][🚎11-c-wf] [![CI Test Coverage][🚎2-cov-wfi]][🚎2-cov-wf]
|
|
6
6
|
|
|
7
7
|
`if ci_badges.map(&:color).detect { it != "green"}` ☝️ [let me know on Discord][✉️discord-invite] or [RubyForum][✉️ruby-forum], as I may have missed the notification.
|
|
8
8
|
|
|
9
|
-
---
|
|
10
|
-
|
|
11
9
|
`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.
|
|
12
10
|
|
|
13
11
|
[![Sponsor Me on Github][🖇sponsor-img]][🖇sponsor] [![Liberapay Goal Progress][⛳liberapay-img]][⛳liberapay] [![Donate on PayPal][🖇paypal-img]][🖇paypal] [![Buy me a coffee][🖇buyme-small-img]][🖇buyme] [![Donate at ko-fi.com][🖇kofi-img]][🖇kofi]
|
|
14
12
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
I've summarized my thoughts in [this blog post](https://dev.to/galtzo/hostile-takeover-of-rubygems-my-thoughts-5hlo).
|
|
19
|
-
|
|
20
|
-
</details>
|
|
13
|
+
<!-- kettle-sponsors:shields:start -->
|
|
14
|
+
<a href="#corporate-sponsorship"><img src="https://logos.galtzo.com/assets/images/sponsors/shield/github.svg" alt="services: GitHub"></a> <a href="#corporate-sponsorship"><img src="https://logos.galtzo.com/assets/images/sponsors/shield/healthsherpa.svg" alt="sponsor: HealthSherpa"></a> <a href="#corporate-sponsorship"><img src="https://logos.galtzo.com/assets/images/sponsors/shield/microsoft.svg" alt="compute: Microsoft"></a>
|
|
15
|
+
<!-- kettle-sponsors:shields:end -->
|
|
21
16
|
|
|
22
17
|
## 🌻 Synopsis <a href="https://discord.gg/3qme4XHNKN"><img alt="Galtzo FLOSS Logo by Aboling0, CC BY-SA 4.0" src="https://logos.galtzo.com/assets/images/galtzo-floss/avatar-128px.svg" width="8%" align="right"/></a> <a href="https://ruby-toolbox.com"><img alt="ruby-lang Logo, Yukihiro Matsumoto, Ruby Visual Identity Team, CC BY-SA 2.5" src="https://logos.galtzo.com/assets/images/ruby-lang/avatar-128px.svg" width="8%" align="right"/></a>
|
|
23
18
|
|
|
@@ -41,48 +36,6 @@ renderer.
|
|
|
41
36
|
- Raw-preserving renderer for safe unchanged members.
|
|
42
37
|
- Checksum and central-directory update reporting.
|
|
43
38
|
|
|
44
|
-
## 💡 Info you can shake a stick at
|
|
45
|
-
|
|
46
|
-
| Tokens to Remember | [![Gem name][⛳️name-img]][⛳️gem-name] [![Gem namespace][⛳️namespace-img]][⛳️gem-namespace] |
|
|
47
|
-
|-------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
48
|
-
| Works with MRI Ruby 4 | [![Ruby current Compat][💎ruby-c-i]][🚎11-c-wf]|
|
|
49
|
-
| Support & Community | [![Join Me on Daily.dev's RubyFriends][✉️ruby-friends-img]][✉️ruby-friends] [![Get help from RubyForum][✉️ruby-forum-img]][✉️ruby-forum] [![Live Chat on Discord][✉️discord-invite-img-ftb]][✉️discord-invite] [![Get help from me on Upwork][👨🏼🏫expsup-upwork-img]][👨🏼🏫expsup-upwork] [![Get help from me on Codementor][👨🏼🏫expsup-codementor-img]][👨🏼🏫expsup-codementor] |
|
|
50
|
-
| Source | [![Source on GitLab.com][📜src-gl-img]][📜src-gl] [![Source on CodeBerg.org][📜src-cb-img]][📜src-cb] [![Source on GitHub.com][📜src-gh-img]][📜src-gh] [![The best SHA: dQw4w9WgXcQ!][🧮kloc-img]][🧮kloc] |
|
|
51
|
-
| Documentation | [![Current release on RubyDoc.info][📜docs-cr-rd-img]][🚎yard-current] [![YARD on Galtzo.com][📜docs-head-rd-img]][🚎yard-head] [![Maintainer Blog][🚂maint-blog-img]][🚂maint-blog] [![GitLab Wiki][📜gl-wiki-img]][📜gl-wiki] [![GitHub Wiki][📜gh-wiki-img]][📜gh-wiki] |
|
|
52
|
-
| Compliance | [![License: AGPL-3.0-only OR PolyForm-Small-Business-1.0.0][📄license-img]][📄license] [![Apache license compatibility: Category X][📄license-compat-img]][📄license-compat] [![📄ilo-declaration-img]][📄ilo-declaration] [![Security Policy][🔐security-img]][🔐security] [![Contributor Covenant 2.1][🪇conduct-img]][🪇conduct] [![SemVer 2.0.0][📌semver-img]][📌semver] |
|
|
53
|
-
| Style | [![Enforced Code Style Linter][💎rlts-img]][💎rlts] [![Keep-A-Changelog 1.0.0][📗keep-changelog-img]][📗keep-changelog] [![Gitmoji Commits][📌gitmoji-img]][📌gitmoji] [![Compatibility appraised by: appraisal2][💎appraisal2-img]][💎appraisal2] |
|
|
54
|
-
| Maintainer 🎖️ | [![Follow Me on LinkedIn][💖🖇linkedin-img]][💖🖇linkedin] [![Follow Me on Ruby.Social][💖🐘ruby-mast-img]][💖🐘ruby-mast] [![Follow Me on Bluesky][💖🦋bluesky-img]][💖🦋bluesky] [![Contact Maintainer][🚂maint-contact-img]][🚂maint-contact] [![My technical writing][💖💁🏼♂️devto-img]][💖💁🏼♂️devto] |
|
|
55
|
-
| `...` 💖 | [![Find Me on WellFound:][💖✌️wellfound-img]][💖✌️wellfound] [![Find Me on CrunchBase][💖💲crunchbase-img]][💖💲crunchbase] [![My LinkTree][💖🌳linktree-img]][💖🌳linktree] [![More About Me][💖💁🏼♂️aboutme-img]][💖💁🏼♂️aboutme] [🧊][💖🧊berg] [🐙][💖🐙hub] [🛖][💖🛖hut] [🧪][💖🧪lab] |
|
|
56
|
-
|
|
57
|
-
### Compatibility
|
|
58
|
-
|
|
59
|
-
The gem's declared runtime compatibility floor is MRI Ruby 4.0.0+, with concordant releases of JRuby and TruffleRuby.
|
|
60
|
-
CI workflows and Appraisals are generated for MRI Ruby 4.0.0+.
|
|
61
|
-
The current MRI CI lane runs on Linux and macOS.
|
|
62
|
-
The test floor is configured by `ruby.test_minimum` in `.kettle-jem.yml`.
|
|
63
|
-
When it is higher than the runtime floor, older runtime-compatible Rubies are
|
|
64
|
-
not covered by the generated CI or Appraisal matrix.
|
|
65
|
-
|
|
66
|
-
<a href="https://github.com/kettle-dev"><img alt="kettle-dev Logo by Aboling0, CC BY-SA 4.0" src="https://logos.galtzo.com/assets/images/kettle-dev/avatar-128px.svg" width="14%" align="right"/></a>
|
|
67
|
-
|
|
68
|
-
The _amazing_ test matrix is powered by the kettle-dev stack.
|
|
69
|
-
|
|
70
|
-
<details markdown="1">
|
|
71
|
-
<summary>How kettle-dev manages complexity in tests</summary>
|
|
72
|
-
|
|
73
|
-
| Gem | Source | Role | Total downloads |
|
|
74
|
-
|-----|--------|------|---------------------|
|
|
75
|
-
| [appraisal2](https://clickgems.clickhouse.com/dashboard/appraisal2) | [GitHub](https://github.com/appraisal-rb/appraisal2) | multi-dependency Appraisal matrix generation | [](https://clickgems.clickhouse.com/dashboard/appraisal2) |
|
|
76
|
-
| [appraisal2-rubocop](https://clickgems.clickhouse.com/dashboard/appraisal2-rubocop) | [GitHub](https://github.com/appraisal-rb/appraisal2-rubocop) | RuboCop Appraisal generator integration | [](https://clickgems.clickhouse.com/dashboard/appraisal2-rubocop) |
|
|
77
|
-
| [kettle-dev](https://clickgems.clickhouse.com/dashboard/kettle-dev) | [GitHub](https://github.com/kettle-dev/kettle-dev) | development, release, and CI workflow tooling | [](https://clickgems.clickhouse.com/dashboard/kettle-dev) |
|
|
78
|
-
| [kettle-jem](https://clickgems.clickhouse.com/dashboard/kettle-jem) | [GitHub](https://github.com/kettle-dev/kettle-jem) | Appraisals & CI workflow templates | [](https://clickgems.clickhouse.com/dashboard/kettle-jem) |
|
|
79
|
-
| [kettle-soup-cover](https://clickgems.clickhouse.com/dashboard/kettle-soup-cover) | [GitHub](https://github.com/kettle-dev/kettle-soup-cover) | SimpleCov coverage policy and reporting | [](https://clickgems.clickhouse.com/dashboard/kettle-soup-cover) |
|
|
80
|
-
| [kettle-test](https://clickgems.clickhouse.com/dashboard/kettle-test) | [GitHub](https://github.com/kettle-dev/kettle-test) | standard test runner and coverage harness | [](https://clickgems.clickhouse.com/dashboard/kettle-test) |
|
|
81
|
-
| [rubocop-lts](https://clickgems.clickhouse.com/dashboard/rubocop-lts) | [GitHub](https://github.com/rubocop-lts/rubocop-lts) | Ruby-version-aware linting | [](https://clickgems.clickhouse.com/dashboard/rubocop-lts) |
|
|
82
|
-
| [turbo_tests2](https://clickgems.clickhouse.com/dashboard/turbo_tests2) | [GitHub](https://github.com/galtzo-floss/turbo_tests2) | parallel test execution | [](https://clickgems.clickhouse.com/dashboard/turbo_tests2) |
|
|
83
|
-
|
|
84
|
-
</details>
|
|
85
|
-
|
|
86
39
|
## ✨ Installation
|
|
87
40
|
|
|
88
41
|
Install the gem and add to the application's Gemfile by executing:
|
|
@@ -126,6 +79,59 @@ plan.member_decisions.each do |decision|
|
|
|
126
79
|
end
|
|
127
80
|
```
|
|
128
81
|
|
|
82
|
+
## 🏢 Corporate Sponsorship
|
|
83
|
+
|
|
84
|
+
<!-- kettle-sponsors:cards:start -->
|
|
85
|
+
<a href="https://github.com"><picture><source media="(max-width: 600px)" srcset="https://logos.galtzo.com/assets/images/sponsors/phone/github.svg"><img src="https://logos.galtzo.com/assets/images/sponsors/github.svg" align="top" alt="Sponsor: GitHub - Copilot Max"></picture></a> <a href="https://healthsherpa.com"><picture><source media="(max-width: 600px)" srcset="https://logos.galtzo.com/assets/images/sponsors/phone/healthsherpa.svg"><img src="https://logos.galtzo.com/assets/images/sponsors/healthsherpa.svg" align="top" alt="Sponsor: HealthSherpa - GitHub Sponsors => @pboling (maintainer)"></picture></a> <a href="https://opensource.microsoft.com"><picture><source media="(max-width: 600px)" srcset="https://logos.galtzo.com/assets/images/sponsors/phone/microsoft.svg"><img src="https://logos.galtzo.com/assets/images/sponsors/microsoft.svg" align="top" alt="Sponsor: Microsoft - Azure compute resources"></picture></a>
|
|
86
|
+
|
|
87
|
+
<sub>Create sponsorship badges for your project with [kettle-sponsors](https://github.com/kettle-dev/kettle-sponsors).</sub>
|
|
88
|
+
<!-- kettle-sponsors:cards:end -->
|
|
89
|
+
|
|
90
|
+
**If you're working in a company that's making significant use of structuredmerge tools we'd
|
|
91
|
+
appreciate it if you suggest to your company to become a structuredmerge sponsor.**
|
|
92
|
+
|
|
93
|
+
## 💡 Info you can shake a stick at
|
|
94
|
+
|
|
95
|
+
| Tokens to Remember | [![Gem name][⛳️name-img]][⛳️gem-name] [![Gem namespace][⛳️namespace-img]][⛳️gem-namespace] |
|
|
96
|
+
|-------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
97
|
+
| Works with MRI Ruby 4 | [![Ruby current Compat][💎ruby-c-i]][🚎11-c-wf]|
|
|
98
|
+
| Support & Community | [![Join Me on Daily.dev's RubyFriends][✉️ruby-friends-img]][✉️ruby-friends] [![Get help from RubyForum][✉️ruby-forum-img]][✉️ruby-forum] [![Live Chat on Discord][✉️discord-invite-img-ftb]][✉️discord-invite] [![Get help from me on Upwork][👨🏼🏫expsup-upwork-img]][👨🏼🏫expsup-upwork] [![Get help from me on Codementor][👨🏼🏫expsup-codementor-img]][👨🏼🏫expsup-codementor] |
|
|
99
|
+
| Source | [![Source on GitLab.com][📜src-gl-img]][📜src-gl] [![Source on CodeBerg.org][📜src-cb-img]][📜src-cb] [![Source on GitHub.com][📜src-gh-img]][📜src-gh] [![The best SHA: dQw4w9WgXcQ!][🧮kloc-img]][🧮kloc] |
|
|
100
|
+
| Documentation | [![Current release on RubyDoc.info][📜docs-cr-rd-img]][🚎yard-current] [![YARD on Galtzo.com][📜docs-head-rd-img]][🚎yard-head] [![Maintainer Blog][🚂maint-blog-img]][🚂maint-blog] [![GitLab Wiki][📜gl-wiki-img]][📜gl-wiki] [![GitHub Wiki][📜gh-wiki-img]][📜gh-wiki] |
|
|
101
|
+
| Compliance | [![License: MIT][📄license-img]][📄license] [![Apache license compatibility: Category A][📄license-compat-img]][📄license-compat] [![📄ilo-declaration-img]][📄ilo-declaration] [![Security Policy][🔐security-img]][🔐security] [![Contributor Covenant 3.0][🪇conduct-img]][🪇conduct] [![SemVer 2.0.0][📌semver-img]][📌semver] |
|
|
102
|
+
| Style | [![Enforced Code Style Linter][💎rlts-img]][💎rlts] [![Keep-A-Changelog 1.0.0][📗keep-changelog-img]][📗keep-changelog] [![Gitmoji Commits][📌gitmoji-img]][📌gitmoji] [![Compatibility appraised by: appraisal2][💎appraisal2-img]][💎appraisal2] |
|
|
103
|
+
| Maintainer 🎖️ | [![Follow Me on LinkedIn][💖🖇linkedin-img]][💖🖇linkedin] [![Follow Me on Ruby.Social][💖🐘ruby-mast-img]][💖🐘ruby-mast] [![Follow Me on Bluesky][💖🦋bluesky-img]][💖🦋bluesky] [![Contact Maintainer][🚂maint-contact-img]][🚂maint-contact] [![My technical writing][💖💁🏼♂️devto-img]][💖💁🏼♂️devto] |
|
|
104
|
+
| `...` 💖 | [![Find Me on WellFound:][💖✌️wellfound-img]][💖✌️wellfound] [![Find Me on CrunchBase][💖💲crunchbase-img]][💖💲crunchbase] [![My LinkTree][💖🌳linktree-img]][💖🌳linktree] [![More About Me][💖💁🏼♂️aboutme-img]][💖💁🏼♂️aboutme] [🧊][💖🧊berg] [🐙][💖🐙hub] [🛖][💖🛖hut] [🧪][💖🧪lab] |
|
|
105
|
+
|
|
106
|
+
### Compatibility
|
|
107
|
+
|
|
108
|
+
The gem's declared runtime compatibility floor is MRI Ruby 4.0.0+, with concordant releases of JRuby and TruffleRuby.
|
|
109
|
+
CI workflows and Appraisals are generated for MRI Ruby 4.0.0+.
|
|
110
|
+
The current MRI CI lane runs on Linux and macOS.
|
|
111
|
+
The test floor is configured by `ruby.test_minimum` in `.structuredmerge/kettle-jem.yml`.
|
|
112
|
+
When it is higher than the runtime floor, older runtime-compatible Rubies are
|
|
113
|
+
not covered by the generated CI or Appraisal matrix.
|
|
114
|
+
|
|
115
|
+
<a href="https://github.com/kettle-dev"><img alt="kettle-dev Logo by Aboling0, CC BY-SA 4.0" src="https://logos.galtzo.com/assets/images/kettle-dev/avatar-128px.svg" width="14%" align="right"/></a>
|
|
116
|
+
|
|
117
|
+
The _amazing_ test matrix is powered by the kettle-dev stack.
|
|
118
|
+
|
|
119
|
+
<details markdown="1">
|
|
120
|
+
<summary>How kettle-dev manages complexity in tests</summary>
|
|
121
|
+
|
|
122
|
+
| Gem | Source | Role | Total downloads |
|
|
123
|
+
|-----|--------|------|---------------------|
|
|
124
|
+
| [appraisal2](https://clickgems.clickhouse.com/dashboard/appraisal2) | [GitHub](https://github.com/appraisal-rb/appraisal2) | multi-dependency Appraisal matrix generation | [](https://clickgems.clickhouse.com/dashboard/appraisal2) |
|
|
125
|
+
| [appraisal2-rubocop](https://clickgems.clickhouse.com/dashboard/appraisal2-rubocop) | [GitHub](https://github.com/appraisal-rb/appraisal2-rubocop) | RuboCop Appraisal generator integration | [](https://clickgems.clickhouse.com/dashboard/appraisal2-rubocop) |
|
|
126
|
+
| [kettle-dev](https://clickgems.clickhouse.com/dashboard/kettle-dev) | [GitHub](https://github.com/kettle-dev/kettle-dev) | development, release, and CI workflow tooling | [](https://clickgems.clickhouse.com/dashboard/kettle-dev) |
|
|
127
|
+
| [kettle-jem](https://clickgems.clickhouse.com/dashboard/kettle-jem) | [GitHub](https://github.com/kettle-dev/kettle-jem) | Appraisals & CI workflow templates | [](https://clickgems.clickhouse.com/dashboard/kettle-jem) |
|
|
128
|
+
| [kettle-soup-cover](https://clickgems.clickhouse.com/dashboard/kettle-soup-cover) | [GitHub](https://github.com/kettle-dev/kettle-soup-cover) | SimpleCov coverage policy and reporting | [](https://clickgems.clickhouse.com/dashboard/kettle-soup-cover) |
|
|
129
|
+
| [kettle-test](https://clickgems.clickhouse.com/dashboard/kettle-test) | [GitHub](https://github.com/kettle-dev/kettle-test) | standard test runner and coverage harness | [](https://clickgems.clickhouse.com/dashboard/kettle-test) |
|
|
130
|
+
| [rubocop-lts](https://clickgems.clickhouse.com/dashboard/rubocop-lts) | [GitHub](https://github.com/rubocop-lts/rubocop-lts) | Ruby-version-aware linting | [](https://clickgems.clickhouse.com/dashboard/rubocop-lts) |
|
|
131
|
+
| [turbo_tests2](https://clickgems.clickhouse.com/dashboard/turbo_tests2) | [GitHub](https://github.com/galtzo-floss/turbo_tests2) | parallel test execution | [](https://clickgems.clickhouse.com/dashboard/turbo_tests2) |
|
|
132
|
+
|
|
133
|
+
</details>
|
|
134
|
+
|
|
129
135
|
## 🔐 Security
|
|
130
136
|
|
|
131
137
|
See [SECURITY.md][🔐security].
|
|
@@ -139,6 +145,8 @@ We [![Keep A Changelog][📗keep-changelog-img]][📗keep-changelog] so if you m
|
|
|
139
145
|
|
|
140
146
|
See [CONTRIBUTING.md][🤝contributing] for more detailed instructions.
|
|
141
147
|
|
|
148
|
+
Want to contribute with AI coding agents? This project is developed with [Cloudroom][🖇cloudroom] and ships an `AGENTS.md` with repo conventions so agents can jump straight in. Signing up with [my referral link][🖇cloudroom] also supports ongoing maintenance at no extra cost to you.
|
|
149
|
+
|
|
142
150
|
## 📌 Versioning
|
|
143
151
|
|
|
144
152
|
This library follows [![Semantic Versioning 2.0.0][📌semver-img]][📌semver] for its public API where practical.
|
|
@@ -167,10 +175,23 @@ See [CHANGELOG.md][📌changelog] for a list of releases.
|
|
|
167
175
|
|
|
168
176
|
## 📄 License
|
|
169
177
|
|
|
170
|
-
The gem is available under the
|
|
171
|
-
|
|
178
|
+
The gem is available as open source under the terms of
|
|
179
|
+
the [MIT](https://github.com/structuredmerge/structuredmerge-ruby/blob/main/MIT.md) [![License: MIT][📄license-img]][📄license-ref].
|
|
180
|
+
|
|
181
|
+
### Please give the project a star ⭐ ♥.
|
|
182
|
+
|
|
183
|
+
Many parts of this project are actively managed by a [kettle-jem](https://github.com/structuredmerge/structuredmerge-ruby/tree/main/gems/kettle-jem) smart template utilizing [StructuredMerge.org](https://structuredmerge.org) merge contracts.
|
|
172
184
|
|
|
173
|
-
If
|
|
185
|
+
If this project helps you, please consider supporting the maintainer. This is not gated on the project's license; it appears in every README:
|
|
186
|
+
|
|
187
|
+
[![Sponsor me on GitHub Sponsors][🖇sponsor-bottom-img]][🖇sponsor] 💌 [![Sponsor me on Liberapay][⛳liberapay-bottom-img]][⛳liberapay] 💌 [![Donate on PayPal][🖇paypal-bottom-img]][🖇paypal] 💌 [![Buy me a coffee][🖇buyme-small-img]][🖇buyme] 💌 [![Donate at ko-fi.com][🖇kofi-img]][🖇kofi]
|
|
188
|
+
|
|
189
|
+
I use [Cloudroom][🖇cloudroom], an agentic AI coding environment, every day. It's the first AI product that made me say "shut up and take my money."
|
|
190
|
+
If you sign up with [my referral link][🖇cloudroom], I receive a share of your subscription for as long as you stay subscribed, at no extra cost to you.
|
|
191
|
+
|
|
192
|
+
[🖇cloudroom]: https://go.cloudroom.dev/u9f53f181a
|
|
193
|
+
|
|
194
|
+
Thanks for RTFM. ☺️
|
|
174
195
|
|
|
175
196
|
[⛳liberapay-img]: https://img.shields.io/liberapay/goal/pboling.svg?logo=liberapay&color=a51611&style=flat
|
|
176
197
|
[⛳liberapay-bottom-img]: https://img.shields.io/liberapay/goal/pboling.svg?style=for-the-badge&logo=liberapay&color=a51611
|
|
@@ -195,6 +216,7 @@ If none of the available licenses suit your use case, please [contact us](mailto
|
|
|
195
216
|
[✉️ruby-forum-top-img]: https://img.shields.io/discourse/topics?server=https%3A%2F%2Fwww.rubyforum.org&style=flat&logo=discourse&label=Ruby%20Users%20Forum
|
|
196
217
|
[✉️ruby-forum-img]: https://img.shields.io/discourse/topics?server=https%3A%2F%2Fwww.rubyforum.org&style=for-the-badge&logo=discourse&label=Ruby%20Users%20Forum
|
|
197
218
|
[✉️ruby-forum]: https://www.rubyforum.org/tag/structuredmerge
|
|
219
|
+
|
|
198
220
|
[✇bundle-group-pattern]: https://gist.github.com/pboling/4564780
|
|
199
221
|
[⛳️gem-namespace]: https://github.com/structuredmerge/structuredmerge-ruby/tree/main/gems/zip-merge
|
|
200
222
|
[⛳️namespace-img]: https://img.shields.io/badge/namespace-Zip::Merge-3C2D2D.svg?style=square&logo=ruby&logoColor=white
|
|
@@ -248,6 +270,16 @@ If none of the available licenses suit your use case, please [contact us](mailto
|
|
|
248
270
|
[👽dl-ranki]: https://img.shields.io/gem/dt/zip-merge.svg
|
|
249
271
|
[👽version]: https://clickgems.clickhouse.com/dashboard/zip-merge
|
|
250
272
|
[👽versioni]: https://img.shields.io/gem/v/zip-merge.svg
|
|
273
|
+
[🏀qlty-mnt]: https://qlty.sh/gh/structuredmerge/projects/structuredmerge-ruby
|
|
274
|
+
[🏀qlty-mnti]: https://qlty.sh/gh/structuredmerge/projects/structuredmerge-ruby/maintainability.svg
|
|
275
|
+
[🏀qlty-cov]: https://qlty.sh/gh/structuredmerge/projects/structuredmerge-ruby/metrics/code?sort=coverageRating
|
|
276
|
+
[🏀qlty-covi]: https://qlty.sh/gh/structuredmerge/projects/structuredmerge-ruby/coverage.svg
|
|
277
|
+
[🏀codecov]: https://codecov.io/gh/structuredmerge/structuredmerge-ruby
|
|
278
|
+
[🏀codecovi]: https://codecov.io/gh/structuredmerge/structuredmerge-ruby/graph/badge.svg
|
|
279
|
+
[🏀coveralls]: https://coveralls.io/github/structuredmerge/structuredmerge-ruby?branch=main
|
|
280
|
+
[🏀coveralls-img]: https://coveralls.io/repos/github/structuredmerge/structuredmerge-ruby/badge.svg?branch=main
|
|
281
|
+
[🚎2-cov-wf]: https://github.com/structuredmerge/structuredmerge-ruby/actions/workflows/coverage.yml
|
|
282
|
+
[🚎2-cov-wfi]: https://github.com/structuredmerge/structuredmerge-ruby/actions/workflows/coverage.yml/badge.svg
|
|
251
283
|
[🚎11-c-wf]: https://github.com/structuredmerge/structuredmerge-ruby/actions/workflows/current.yml
|
|
252
284
|
[🚎11-c-wfi]: https://github.com/structuredmerge/structuredmerge-ruby/actions/workflows/current.yml/badge.svg
|
|
253
285
|
[💎ruby-c-i]: https://img.shields.io/badge/Ruby-current-CC342D?style=for-the-badge&logo=ruby&logoColor=green
|
|
@@ -259,11 +291,12 @@ If none of the available licenses suit your use case, please [contact us](mailto
|
|
|
259
291
|
[🤝cb-pulls]: https://codeberg.org/structuredmerge/structuredmerge-ruby/pulls
|
|
260
292
|
[🤝cb-donate]: https://donate.codeberg.org/
|
|
261
293
|
[🤝contributing]: https://github.com/structuredmerge/structuredmerge-ruby/blob/main/CONTRIBUTING.md
|
|
294
|
+
[🏀codecov-g]: https://codecov.io/gh/structuredmerge/structuredmerge-ruby/graph/badge.svg
|
|
262
295
|
[🖐contrib-rocks]: https://contrib.rocks
|
|
263
296
|
[🖐contributors]: https://github.com/structuredmerge/structuredmerge-ruby/graphs/contributors
|
|
264
297
|
[🖐contributors-img]: https://contrib.rocks/image?repo=structuredmerge/structuredmerge-ruby
|
|
265
298
|
[🪇conduct]: https://github.com/structuredmerge/structuredmerge-ruby/blob/main/CODE_OF_CONDUCT.md
|
|
266
|
-
[🪇conduct-img]: https://img.shields.io/badge/Contributor_Covenant-
|
|
299
|
+
[🪇conduct-img]: https://img.shields.io/badge/Contributor_Covenant-3.0-259D6C.svg
|
|
267
300
|
[📌pvc]: http://guides.rubygems.org/patterns/#pessimistic-version-constraint
|
|
268
301
|
[📌semver]: https://semver.org/spec/v2.0.0.html
|
|
269
302
|
[📌semver-img]: https://img.shields.io/badge/semver-2.0.0-259D6C.svg?style=flat
|
|
@@ -275,15 +308,16 @@ If none of the available licenses suit your use case, please [contact us](mailto
|
|
|
275
308
|
[📌gitmoji]: https://gitmoji.dev
|
|
276
309
|
[📌gitmoji-img]: https://img.shields.io/badge/gitmoji_commits-%20%F0%9F%98%9C%20%F0%9F%98%8D-34495e.svg?style=flat-square
|
|
277
310
|
[🧮kloc]: https://www.youtube.com/watch?v=dQw4w9WgXcQ
|
|
278
|
-
[🧮kloc-img]: https://img.shields.io/badge/KLOC-0.
|
|
311
|
+
[🧮kloc-img]: https://img.shields.io/badge/KLOC-0.290-FFDD67.svg?style=for-the-badge&logo=YouTube&logoColor=blue
|
|
279
312
|
[🔐security]: https://github.com/structuredmerge/structuredmerge-ruby/blob/main/SECURITY.md
|
|
280
313
|
[🔐security-img]: https://img.shields.io/badge/security-policy-259D6C.svg?style=flat
|
|
281
314
|
[📄copyright-notice-explainer]: https://opensource.stackexchange.com/questions/5778/why-do-licenses-such-as-the-mit-license-specify-a-single-year
|
|
282
315
|
[📄license]: LICENSE.md
|
|
283
|
-
[📄license-ref]:
|
|
284
|
-
[📄license-img]: https://img.shields.io/badge/License-
|
|
285
|
-
[📄license-compat]: https://www.apache.org/legal/resolved.html#category-
|
|
286
|
-
[📄license-compat-img]: https://img.shields.io/badge/
|
|
316
|
+
[📄license-ref]: https://github.com/structuredmerge/structuredmerge-ruby/blob/main/MIT.md
|
|
317
|
+
[📄license-img]: https://img.shields.io/badge/License-MIT-259D6C.svg
|
|
318
|
+
[📄license-compat]: https://www.apache.org/legal/resolved.html#category-a
|
|
319
|
+
[📄license-compat-img]: https://img.shields.io/badge/Apache_Compatible:_Category_A-%E2%9C%93-259D6C.svg?style=flat&logo=Apache
|
|
320
|
+
|
|
287
321
|
[📄ilo-declaration]: https://www.ilo.org/declaration/lang--en/index.htm
|
|
288
322
|
[📄ilo-declaration-img]: https://img.shields.io/badge/ILO_Fundamental_Principles-✓-259D6C.svg?style=flat
|
|
289
323
|
[🚎yard-current]: http://rubydoc.info/gems/zip-merge
|
data/lib/zip/merge/backend.rb
CHANGED
|
@@ -22,7 +22,7 @@ module Zip
|
|
|
22
22
|
# `parser_for(:zip)` Kaitai backend surface.
|
|
23
23
|
class Parser < TreeHaver::Base::Parser
|
|
24
24
|
def parse(source)
|
|
25
|
-
raise
|
|
25
|
+
raise "Language not set" unless language
|
|
26
26
|
|
|
27
27
|
Zip::Merge.parse_zip_inventory(source)
|
|
28
28
|
end
|
|
@@ -39,7 +39,7 @@ module Zip
|
|
|
39
39
|
:zip,
|
|
40
40
|
backend_module: Backend,
|
|
41
41
|
backend_type: :kaitai,
|
|
42
|
-
gem_name:
|
|
42
|
+
gem_name: "zip-merge",
|
|
43
43
|
contract: :kaitai
|
|
44
44
|
)
|
|
45
45
|
nil
|
data/lib/zip/merge/provider.rb
CHANGED
|
@@ -7,8 +7,8 @@ module Zip
|
|
|
7
7
|
class Provider < Binary::Merge::Provider
|
|
8
8
|
PARSE_ERRORS = [RuntimeError, NoMethodError, TypeError, KeyError].freeze
|
|
9
9
|
|
|
10
|
-
def provider_id =
|
|
11
|
-
def family =
|
|
10
|
+
def provider_id = "ruby.zip"
|
|
11
|
+
def family = "zip"
|
|
12
12
|
|
|
13
13
|
def capabilities
|
|
14
14
|
{
|
|
@@ -82,10 +82,10 @@ module Zip
|
|
|
82
82
|
family: family,
|
|
83
83
|
dialect: request[:dialect] || :zip,
|
|
84
84
|
backend: request[:backend],
|
|
85
|
-
package:
|
|
85
|
+
package: "zip-merge",
|
|
86
86
|
package_version: Zip::Merge::Version::VERSION
|
|
87
87
|
},
|
|
88
|
-
profile: {
|
|
88
|
+
profile: {profile_id: request[:profile_id] || :opaque_archive}
|
|
89
89
|
}.merge(fields)
|
|
90
90
|
end
|
|
91
91
|
end
|
data/lib/zip/merge/version.rb
CHANGED
|
@@ -5,7 +5,7 @@ module Zip
|
|
|
5
5
|
# Version namespace for this gem.
|
|
6
6
|
module Version
|
|
7
7
|
# Current gem version.
|
|
8
|
-
VERSION =
|
|
8
|
+
VERSION = "8.0.0"
|
|
9
9
|
end
|
|
10
10
|
# Current gem version exposed at the traditional constant location.
|
|
11
11
|
VERSION = Version::VERSION # Traditional Constant Location
|
data/lib/zip/merge.rb
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require
|
|
4
|
-
require
|
|
5
|
-
require
|
|
6
|
-
require_relative
|
|
3
|
+
require "stringio"
|
|
4
|
+
require "zlib"
|
|
5
|
+
require "tree_haver"
|
|
6
|
+
require_relative "merge/version"
|
|
7
7
|
|
|
8
8
|
module Zip
|
|
9
9
|
module Merge
|
|
10
10
|
LOCAL = 0x04034b50
|
|
11
11
|
CENTRAL = 0x02014b50
|
|
12
12
|
EOCD = 0x06054b50
|
|
13
|
-
DOS_EPOCH = [0, 0, 0x21, 0].pack(
|
|
13
|
+
DOS_EPOCH = [0, 0, 0x21, 0].pack("C*")
|
|
14
14
|
|
|
15
15
|
RenderError = Class.new(StandardError) do
|
|
16
16
|
attr_reader :diagnostic
|
|
@@ -32,21 +32,21 @@ module Zip
|
|
|
32
32
|
TreeHaver::ZipArchiveEntry.new(
|
|
33
33
|
path: name,
|
|
34
34
|
normalized_path: normalize_zip_path(name),
|
|
35
|
-
directory: name.end_with?(
|
|
35
|
+
directory: name.end_with?("/"),
|
|
36
36
|
compression: compression_name(record[:method]),
|
|
37
37
|
compressed_size: record[:compressed_size],
|
|
38
38
|
uncompressed_size: record[:uncompressed_size],
|
|
39
|
-
crc32:
|
|
39
|
+
crc32: "%08x" % record[:crc32],
|
|
40
40
|
local_header_range: TreeHaver::ByteRange.new(start_byte: record[:local_offset], end_byte: local[:data_start]),
|
|
41
41
|
data_range: TreeHaver::ByteRange.new(start_byte: local[:data_start],
|
|
42
|
-
|
|
42
|
+
end_byte: local[:data_start] + record[:compressed_size]),
|
|
43
43
|
central_directory_range: record[:range]
|
|
44
44
|
)
|
|
45
45
|
end.sort_by { |entry| entry.local_header_range.start_byte }
|
|
46
46
|
|
|
47
47
|
TreeHaver::ZipFamilyReport.new(
|
|
48
|
-
archive: TreeHaver::ZipArchiveInfo.new(format:
|
|
49
|
-
|
|
48
|
+
archive: TreeHaver::ZipArchiveInfo.new(format: "zip", schema: "zip.ksy", entry_count: entries.length,
|
|
49
|
+
central_directory_range: central[:range]),
|
|
50
50
|
entries: entries,
|
|
51
51
|
member_decisions: [],
|
|
52
52
|
unsafe_entries: unsafe_entries(entries, central[:records]),
|
|
@@ -73,35 +73,35 @@ module Zip
|
|
|
73
73
|
incoming_entry = incoming_entries[path]
|
|
74
74
|
if unsafe_by_path[path]
|
|
75
75
|
unsafe = unsafe_by_path[path]
|
|
76
|
-
report.member_decisions << TreeHaver::ZipMemberDecision.new(normalized_path: path, operation:
|
|
77
|
-
|
|
76
|
+
report.member_decisions << TreeHaver::ZipMemberDecision.new(normalized_path: path, operation: "reject",
|
|
77
|
+
disposition: "unsafe", reason: unsafe.reason)
|
|
78
78
|
report.merge_report.diagnostics << diagnostic(unsafe.category, schema_path(path), unsafe.reason)
|
|
79
79
|
elsif current_entry.nil? && incoming_entry
|
|
80
|
-
decision(report, path,
|
|
80
|
+
decision(report, path, "add", "requires_renderer", "member exists only in incoming archive")
|
|
81
81
|
elsif current_entry && incoming_entry.nil?
|
|
82
|
-
decision(report, path,
|
|
82
|
+
decision(report, path, "delete", "requires_renderer", "member was removed from incoming archive")
|
|
83
83
|
elsif ancestor_entry && same_entry?(current_entry,
|
|
84
|
-
|
|
85
|
-
report.member_decisions << TreeHaver::ZipMemberDecision.new(normalized_path: path, operation:
|
|
86
|
-
|
|
84
|
+
ancestor_entry) && same_entry?(incoming_entry, ancestor_entry)
|
|
85
|
+
report.member_decisions << TreeHaver::ZipMemberDecision.new(normalized_path: path, operation: "preserve",
|
|
86
|
+
disposition: "safe", reason: "member is unchanged from ancestor")
|
|
87
87
|
report.merge_report.preserved_ranges.concat([current_entry.local_header_range, current_entry.data_range])
|
|
88
88
|
elsif (family = nested_family(path))
|
|
89
|
-
report.member_decisions << TreeHaver::ZipMemberDecision.new(normalized_path: path, operation:
|
|
90
|
-
|
|
89
|
+
report.member_decisions << TreeHaver::ZipMemberDecision.new(normalized_path: path, operation: "delegate",
|
|
90
|
+
disposition: "requires_renderer", nested_family: family, reason: "structured member can be merged by a nested family before ZIP rendering")
|
|
91
91
|
report.merge_report.nested_dispatches << TreeHaver::BinaryNestedDispatch.new(
|
|
92
|
-
schema_path: "#{schema_path(path)}/data", family: family, status:
|
|
92
|
+
schema_path: "#{schema_path(path)}/data", family: family, status: "planned"
|
|
93
93
|
)
|
|
94
94
|
report.merge_report.rewritten_nodes << schema_path(path)
|
|
95
95
|
report.merge_report.checksum_updates << "#{schema_path(path)}/crc32"
|
|
96
96
|
else
|
|
97
|
-
decision(report, path,
|
|
97
|
+
decision(report, path, "rewrite", "requires_renderer", "member bytes or metadata changed")
|
|
98
98
|
report.merge_report.checksum_updates << "#{schema_path(path)}/crc32"
|
|
99
99
|
end
|
|
100
100
|
report.merge_report.matched_schema_paths << schema_path(path)
|
|
101
101
|
end
|
|
102
102
|
unless report.merge_report.rewritten_nodes.empty? && report.merge_report.checksum_updates.empty?
|
|
103
|
-
report.merge_report.rewritten_nodes <<
|
|
104
|
-
report.merge_report.checksum_updates.concat([
|
|
103
|
+
report.merge_report.rewritten_nodes << "/central_directory"
|
|
104
|
+
report.merge_report.checksum_updates.concat(["/central_directory/size", "/central_directory/offset"])
|
|
105
105
|
end
|
|
106
106
|
report
|
|
107
107
|
end
|
|
@@ -110,8 +110,8 @@ module Zip
|
|
|
110
110
|
unless [
|
|
111
111
|
0, 8
|
|
112
112
|
].include?(compression)
|
|
113
|
-
raise render_error(
|
|
114
|
-
|
|
113
|
+
raise render_error("unsupported_compression", "/render/options/compression",
|
|
114
|
+
"unsupported raw-preserving compression method")
|
|
115
115
|
end
|
|
116
116
|
|
|
117
117
|
source = source.b
|
|
@@ -119,24 +119,24 @@ module Zip
|
|
|
119
119
|
central = scan_central_directory(source)
|
|
120
120
|
source_entries = entries_by_path(source_inventory.entries)
|
|
121
121
|
raw_ranges = raw_local_record_ranges(source, source_entries)
|
|
122
|
-
output = +
|
|
122
|
+
output = +"".b
|
|
123
123
|
central_records = []
|
|
124
124
|
entries = entries_by_path(plan.entries)
|
|
125
125
|
plan.member_decisions.each do |member|
|
|
126
126
|
entry = entries[member.normalized_path]
|
|
127
127
|
case member.operation
|
|
128
|
-
when
|
|
129
|
-
raise render_error(
|
|
130
|
-
when
|
|
128
|
+
when "reject"
|
|
129
|
+
raise render_error("rejected_member", schema_path(member.normalized_path), member.reason)
|
|
130
|
+
when "delete"
|
|
131
131
|
next
|
|
132
|
-
when
|
|
132
|
+
when "preserve"
|
|
133
133
|
source_entry = source_entries.fetch(member.normalized_path)
|
|
134
134
|
validate_raw_preserve_entry!(source, central, source_entry)
|
|
135
135
|
range = raw_ranges.fetch(member.normalized_path)
|
|
136
136
|
offset = output.bytesize
|
|
137
137
|
output << source.byteslice(range.start_byte...range.end_byte)
|
|
138
138
|
central_records << central_record_from_entry(source_entry, offset)
|
|
139
|
-
when
|
|
139
|
+
when "add", "rewrite", "delegate"
|
|
140
140
|
content = member_bytes.fetch(member.normalized_path)
|
|
141
141
|
rendered, record = rendered_local_record(entry, content.b, compression, output.bytesize)
|
|
142
142
|
output << rendered
|
|
@@ -152,13 +152,13 @@ module Zip
|
|
|
152
152
|
report = parse_zip_inventory(output)
|
|
153
153
|
merge_report = plan.merge_report
|
|
154
154
|
merge_report.preserved_ranges = plan.member_decisions.filter_map do |member|
|
|
155
|
-
raw_ranges[member.normalized_path] if member.operation ==
|
|
155
|
+
raw_ranges[member.normalized_path] if member.operation == "preserve"
|
|
156
156
|
end
|
|
157
157
|
[output, report, merge_report]
|
|
158
158
|
end
|
|
159
159
|
|
|
160
160
|
def new_stored_zip(entries)
|
|
161
|
-
output = +
|
|
161
|
+
output = +"".b
|
|
162
162
|
central = []
|
|
163
163
|
entries.keys.sort.each do |name|
|
|
164
164
|
rendered, record = rendered_local_record(path_entry(name, entries[name]), entries[name].b, 0, output.bytesize)
|
|
@@ -172,86 +172,86 @@ module Zip
|
|
|
172
172
|
end
|
|
173
173
|
|
|
174
174
|
def empty_report
|
|
175
|
-
Binary::Merge.preservation_report(format:
|
|
176
|
-
|
|
175
|
+
Binary::Merge.preservation_report(format: "zip", schema: "zip.ksy", matched_schema_paths: [],
|
|
176
|
+
preserved_ranges: [])
|
|
177
177
|
end
|
|
178
178
|
|
|
179
179
|
def scan_central_directory(source)
|
|
180
180
|
eocd = source.bytesize - 22
|
|
181
|
-
eocd -= 1 while eocd >= 0 && source.byteslice(eocd, 4).unpack1(
|
|
182
|
-
raise
|
|
181
|
+
eocd -= 1 while eocd >= 0 && source.byteslice(eocd, 4).unpack1("V") != EOCD
|
|
182
|
+
raise "missing ZIP end of central directory" if eocd.negative?
|
|
183
183
|
|
|
184
|
-
size = source.byteslice(eocd + 12, 4).unpack1(
|
|
185
|
-
offset = source.byteslice(eocd + 16, 4).unpack1(
|
|
186
|
-
comment_length = source.byteslice(eocd + 20, 2).unpack1(
|
|
184
|
+
size = source.byteslice(eocd + 12, 4).unpack1("V")
|
|
185
|
+
offset = source.byteslice(eocd + 16, 4).unpack1("V")
|
|
186
|
+
comment_length = source.byteslice(eocd + 20, 2).unpack1("v")
|
|
187
187
|
records = {}
|
|
188
188
|
cursor = offset
|
|
189
189
|
while cursor < offset + size
|
|
190
|
-
raise
|
|
190
|
+
raise "unexpected central directory record" unless source.byteslice(cursor, 4).unpack1("V") == CENTRAL
|
|
191
191
|
|
|
192
|
-
name_len = source.byteslice(cursor + 28, 2).unpack1(
|
|
193
|
-
extra_len = source.byteslice(cursor + 30, 2).unpack1(
|
|
194
|
-
comment_len = source.byteslice(cursor + 32, 2).unpack1(
|
|
192
|
+
name_len = source.byteslice(cursor + 28, 2).unpack1("v")
|
|
193
|
+
extra_len = source.byteslice(cursor + 30, 2).unpack1("v")
|
|
194
|
+
comment_len = source.byteslice(cursor + 32, 2).unpack1("v")
|
|
195
195
|
name = source.byteslice(cursor + 46, name_len)
|
|
196
196
|
records[name] = {
|
|
197
197
|
range: TreeHaver::ByteRange.new(start_byte: cursor,
|
|
198
|
-
|
|
199
|
-
flags: source.byteslice(cursor + 8, 2).unpack1(
|
|
200
|
-
method: source.byteslice(cursor + 10, 2).unpack1(
|
|
201
|
-
crc32: source.byteslice(cursor + 16, 4).unpack1(
|
|
202
|
-
compressed_size: source.byteslice(cursor + 20, 4).unpack1(
|
|
203
|
-
uncompressed_size: source.byteslice(cursor + 24, 4).unpack1(
|
|
198
|
+
end_byte: cursor + 46 + name_len + extra_len + comment_len),
|
|
199
|
+
flags: source.byteslice(cursor + 8, 2).unpack1("v"),
|
|
200
|
+
method: source.byteslice(cursor + 10, 2).unpack1("v"),
|
|
201
|
+
crc32: source.byteslice(cursor + 16, 4).unpack1("V"),
|
|
202
|
+
compressed_size: source.byteslice(cursor + 20, 4).unpack1("V"),
|
|
203
|
+
uncompressed_size: source.byteslice(cursor + 24, 4).unpack1("V"),
|
|
204
204
|
extra_length: extra_len,
|
|
205
205
|
comment_length: comment_len,
|
|
206
|
-
local_offset: source.byteslice(cursor + 42, 4).unpack1(
|
|
206
|
+
local_offset: source.byteslice(cursor + 42, 4).unpack1("V")
|
|
207
207
|
}
|
|
208
208
|
cursor = records[name][:range].end_byte
|
|
209
209
|
end
|
|
210
|
-
{
|
|
210
|
+
{range: TreeHaver::ByteRange.new(start_byte: offset, end_byte: offset + size), records: records, archive_comment: comment_length.positive?}
|
|
211
211
|
end
|
|
212
212
|
|
|
213
213
|
def scan_local_headers(source, records)
|
|
214
214
|
records.transform_values do |record|
|
|
215
215
|
cursor = record[:local_offset]
|
|
216
|
-
raise
|
|
216
|
+
raise "unexpected ZIP local header" unless source.byteslice(cursor, 4).unpack1("V") == LOCAL
|
|
217
217
|
|
|
218
|
-
name_len = source.byteslice(cursor + 26, 2).unpack1(
|
|
219
|
-
extra_len = source.byteslice(cursor + 28, 2).unpack1(
|
|
220
|
-
{
|
|
218
|
+
name_len = source.byteslice(cursor + 26, 2).unpack1("v")
|
|
219
|
+
extra_len = source.byteslice(cursor + 28, 2).unpack1("v")
|
|
220
|
+
{data_start: cursor + 30 + name_len + extra_len, extra_length: extra_len}
|
|
221
221
|
end
|
|
222
222
|
end
|
|
223
223
|
|
|
224
224
|
def validate_raw_preserve_entry!(source, central, entry)
|
|
225
225
|
if central[:archive_comment]
|
|
226
|
-
raise render_error(
|
|
227
|
-
|
|
226
|
+
raise render_error("archive_comment", "/archive/comment",
|
|
227
|
+
"raw-preserving ZIP renderer does not yet preserve archive comments")
|
|
228
228
|
end
|
|
229
229
|
|
|
230
230
|
record = central[:records].fetch(entry.path)
|
|
231
231
|
unless (record[:flags] & 0x1).zero?
|
|
232
|
-
raise render_error(
|
|
233
|
-
|
|
232
|
+
raise render_error("encrypted_member", schema_path(entry.normalized_path),
|
|
233
|
+
"raw-preserving ZIP renderer rejects encrypted member #{entry.normalized_path}")
|
|
234
234
|
end
|
|
235
235
|
unless [
|
|
236
236
|
0, 8
|
|
237
237
|
].include?(record[:method])
|
|
238
|
-
raise render_error(
|
|
239
|
-
|
|
238
|
+
raise render_error("unsupported_compression", schema_path(entry.normalized_path),
|
|
239
|
+
"raw-preserving ZIP renderer rejects unsupported compression #{entry.compression.inspect}")
|
|
240
240
|
end
|
|
241
241
|
unless record[:extra_length].zero?
|
|
242
|
-
raise render_error(
|
|
243
|
-
|
|
242
|
+
raise render_error("central_directory_extra_field", schema_path(entry.normalized_path),
|
|
243
|
+
"raw-preserving ZIP renderer does not yet preserve central-directory extra fields for #{entry.normalized_path}")
|
|
244
244
|
end
|
|
245
245
|
unless record[:comment_length].zero?
|
|
246
|
-
raise render_error(
|
|
247
|
-
|
|
246
|
+
raise render_error("member_comment", schema_path(entry.normalized_path),
|
|
247
|
+
"raw-preserving ZIP renderer does not yet preserve member comments for #{entry.normalized_path}")
|
|
248
248
|
end
|
|
249
249
|
|
|
250
|
-
local_extra = source.byteslice(entry.local_header_range.start_byte + 28, 2).unpack1(
|
|
250
|
+
local_extra = source.byteslice(entry.local_header_range.start_byte + 28, 2).unpack1("v")
|
|
251
251
|
return if local_extra.zero?
|
|
252
252
|
|
|
253
|
-
raise render_error(
|
|
254
|
-
|
|
253
|
+
raise render_error("local_header_extra_field", schema_path(entry.normalized_path),
|
|
254
|
+
"raw-preserving ZIP renderer does not yet preserve local extra fields for #{entry.normalized_path}")
|
|
255
255
|
end
|
|
256
256
|
|
|
257
257
|
def unsafe_entries(entries, records)
|
|
@@ -260,19 +260,19 @@ module Zip
|
|
|
260
260
|
list = []
|
|
261
261
|
if escapes_root?(entry.path)
|
|
262
262
|
list << TreeHaver::ZipUnsafeEntry.new(path: entry.path, normalized_path: entry.normalized_path,
|
|
263
|
-
|
|
263
|
+
category: "path_traversal", reason: "entry escapes the archive root")
|
|
264
264
|
end
|
|
265
265
|
if seen[entry.normalized_path] && seen[entry.normalized_path] != entry.path
|
|
266
266
|
list << TreeHaver::ZipUnsafeEntry.new(path: entry.path, normalized_path: entry.normalized_path,
|
|
267
|
-
|
|
267
|
+
category: "duplicate_normalized_path", reason: "normalized path collides with an existing entry")
|
|
268
268
|
end
|
|
269
269
|
unless (records[entry.path][:flags] & 0x1).zero?
|
|
270
270
|
list << TreeHaver::ZipUnsafeEntry.new(path: entry.path, normalized_path: entry.normalized_path,
|
|
271
|
-
|
|
271
|
+
category: "encrypted_member", reason: "encrypted member cannot be rendered by the default provider")
|
|
272
272
|
end
|
|
273
273
|
if signing_sensitive?(entry.normalized_path)
|
|
274
274
|
list << TreeHaver::ZipUnsafeEntry.new(path: entry.path, normalized_path: entry.normalized_path,
|
|
275
|
-
|
|
275
|
+
category: "signing_sensitive_member", reason: "signature-bearing member mutation is not enabled")
|
|
276
276
|
end
|
|
277
277
|
seen[entry.normalized_path] = entry.path
|
|
278
278
|
list
|
|
@@ -280,24 +280,24 @@ module Zip
|
|
|
280
280
|
end
|
|
281
281
|
|
|
282
282
|
def rendered_local_record(entry, content, method, offset)
|
|
283
|
-
payload = method == 8 ? Zlib::Deflate.deflate(content) : content
|
|
283
|
+
payload = (method == 8) ? Zlib::Deflate.deflate(content) : content
|
|
284
284
|
crc = Zlib.crc32(content)
|
|
285
285
|
header = [LOCAL, 20, 0,
|
|
286
|
-
|
|
287
|
-
|
|
286
|
+
method].pack("Vvvv") + DOS_EPOCH + [crc, payload.bytesize, content.bytesize, entry.path.bytesize,
|
|
287
|
+
0].pack("VVVvv") + entry.path
|
|
288
288
|
[header + payload,
|
|
289
|
-
|
|
290
|
-
offset: offset, flags: 0
|
|
289
|
+
{name: entry.path, method: method, crc32: crc, compressed_size: payload.bytesize, uncompressed_size: content.bytesize,
|
|
290
|
+
offset: offset, flags: 0}]
|
|
291
291
|
end
|
|
292
292
|
|
|
293
293
|
def central_directory_record(record)
|
|
294
294
|
[CENTRAL, 20, 20, record[:flags],
|
|
295
|
-
|
|
296
|
-
|
|
295
|
+
record[:method]].pack("Vvvvv") + DOS_EPOCH + [record[:crc32], record[:compressed_size], record[:uncompressed_size],
|
|
296
|
+
record[:name].bytesize, 0, 0, 0, 0, 0, record[:offset]].pack("VVVvvvvvVV") + record[:name]
|
|
297
297
|
end
|
|
298
298
|
|
|
299
299
|
def eocd_record(entries, size, offset)
|
|
300
|
-
[EOCD, 0, 0, entries, entries, size, offset, 0].pack(
|
|
300
|
+
[EOCD, 0, 0, entries, entries, size, offset, 0].pack("VvvvvVVv")
|
|
301
301
|
end
|
|
302
302
|
|
|
303
303
|
def raw_local_record_ranges(_source, entries)
|
|
@@ -305,54 +305,54 @@ module Zip
|
|
|
305
305
|
ordered.each_with_index.to_h do |entry, index|
|
|
306
306
|
end_byte = ordered[index + 1]&.local_header_range&.start_byte || entry.central_directory_range.start_byte
|
|
307
307
|
[entry.normalized_path,
|
|
308
|
-
|
|
308
|
+
TreeHaver::ByteRange.new(start_byte: entry.local_header_range.start_byte, end_byte: end_byte)]
|
|
309
309
|
end
|
|
310
310
|
end
|
|
311
311
|
|
|
312
312
|
def central_record_from_entry(entry, offset)
|
|
313
|
-
{
|
|
314
|
-
|
|
313
|
+
{name: entry.path, method: (entry.compression == "deflate") ? 8 : 0, crc32: entry.crc32.to_i(16),
|
|
314
|
+
compressed_size: entry.compressed_size, uncompressed_size: entry.uncompressed_size, offset: offset, flags: 0}
|
|
315
315
|
end
|
|
316
316
|
|
|
317
317
|
def path_entry(name, content)
|
|
318
318
|
TreeHaver::ZipArchiveEntry.new(path: name, normalized_path: normalize_zip_path(name),
|
|
319
|
-
|
|
319
|
+
directory: name.end_with?("/"), compression: "stored", compressed_size: content.bytesize, uncompressed_size: content.bytesize, crc32: "%08x" % Zlib.crc32(content), local_header_range: TreeHaver::ByteRange.new(start_byte: 0, end_byte: 0), data_range: TreeHaver::ByteRange.new(start_byte: 0, end_byte: 0), central_directory_range: TreeHaver::ByteRange.new(start_byte: 0, end_byte: 0))
|
|
320
320
|
end
|
|
321
321
|
|
|
322
322
|
def decision(report, path, operation, disposition, reason)
|
|
323
323
|
report.member_decisions << TreeHaver::ZipMemberDecision.new(normalized_path: path, operation: operation,
|
|
324
|
-
|
|
324
|
+
disposition: disposition, reason: reason)
|
|
325
325
|
report.merge_report.rewritten_nodes << schema_path(path)
|
|
326
326
|
end
|
|
327
327
|
|
|
328
328
|
def normalize_zip_path(path)
|
|
329
|
-
path.tr(
|
|
330
|
-
unless part ==
|
|
331
|
-
part ==
|
|
329
|
+
path.tr("\\", "/").split("/").each_with_object([]) do |part, stack|
|
|
330
|
+
unless part == "."
|
|
331
|
+
(part == "..") ? stack.pop : stack << part
|
|
332
332
|
end
|
|
333
|
-
end.join(
|
|
333
|
+
end.join("/")
|
|
334
334
|
end
|
|
335
335
|
|
|
336
336
|
def compression_name(method)
|
|
337
337
|
case method
|
|
338
|
-
when 0 then
|
|
339
|
-
when 8 then
|
|
338
|
+
when 0 then "stored"
|
|
339
|
+
when 8 then "deflate"
|
|
340
340
|
else "method-#{method}"
|
|
341
341
|
end
|
|
342
342
|
end
|
|
343
343
|
|
|
344
344
|
def escapes_root?(path)
|
|
345
|
-
path.start_with?(
|
|
345
|
+
path.start_with?("/") || path.tr("\\", "/").split("/").then do |parts|
|
|
346
346
|
depth = 0
|
|
347
347
|
parts.any? do |part|
|
|
348
|
-
part ==
|
|
348
|
+
(part == "..") ? (depth -= 1) : (depth += 1 unless part == ".")
|
|
349
349
|
depth.negative?
|
|
350
350
|
end
|
|
351
351
|
end
|
|
352
352
|
end
|
|
353
353
|
|
|
354
354
|
def signing_sensitive?(path)
|
|
355
|
-
path.upcase.start_with?(
|
|
355
|
+
path.upcase.start_with?("META-INF/") && [".RSA", ".DSA", ".EC", ".SF"].any? do |suffix|
|
|
356
356
|
path.upcase.end_with?(suffix)
|
|
357
357
|
end
|
|
358
358
|
end
|
|
@@ -366,11 +366,11 @@ module Zip
|
|
|
366
366
|
end
|
|
367
367
|
|
|
368
368
|
def nested_family(path)
|
|
369
|
-
return
|
|
370
|
-
return
|
|
371
|
-
return
|
|
369
|
+
return "markdown" if path.match?(/\.m(?:d|arkdown)\z/i)
|
|
370
|
+
return "json" if path.end_with?(".json")
|
|
371
|
+
return "yaml" if path.match?(/\.ya?ml\z/i)
|
|
372
372
|
|
|
373
|
-
|
|
373
|
+
"xml" if path.end_with?(".xml")
|
|
374
374
|
end
|
|
375
375
|
|
|
376
376
|
def schema_path(path)
|
|
@@ -387,9 +387,9 @@ module Zip
|
|
|
387
387
|
end
|
|
388
388
|
end
|
|
389
389
|
|
|
390
|
-
require
|
|
391
|
-
require_relative
|
|
392
|
-
require_relative
|
|
390
|
+
require "binary/merge"
|
|
391
|
+
require_relative "merge/backend"
|
|
392
|
+
require_relative "merge/provider"
|
|
393
393
|
|
|
394
394
|
Zip::Merge.register_backend!
|
|
395
395
|
Zip::Merge.register_provider!
|
data/lib/zip-merge.rb
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require_relative
|
|
4
|
-
require
|
|
5
|
-
require_relative
|
|
3
|
+
require_relative "zip/merge"
|
|
4
|
+
require "version_gem"
|
|
5
|
+
require_relative "zip/merge/version"
|
|
6
6
|
|
|
7
7
|
Zip::Merge::Version.class_eval do
|
|
8
8
|
extend VersionGem::Basic
|
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: zip-merge
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 8.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Peter H. Boling
|
|
@@ -44,7 +44,7 @@ dependencies:
|
|
|
44
44
|
-
|
|
45
45
|
- "="
|
|
46
46
|
- !ruby/object:Gem::Version
|
|
47
|
-
version:
|
|
47
|
+
version: 8.0.0
|
|
48
48
|
type: :runtime
|
|
49
49
|
prerelease: false
|
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -52,7 +52,7 @@ dependencies:
|
|
|
52
52
|
-
|
|
53
53
|
- "="
|
|
54
54
|
- !ruby/object:Gem::Version
|
|
55
|
-
version:
|
|
55
|
+
version: 8.0.0
|
|
56
56
|
- !ruby/object:Gem::Dependency
|
|
57
57
|
name: tree_haver
|
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -60,7 +60,7 @@ dependencies:
|
|
|
60
60
|
-
|
|
61
61
|
- "="
|
|
62
62
|
- !ruby/object:Gem::Version
|
|
63
|
-
version:
|
|
63
|
+
version: 8.0.0
|
|
64
64
|
type: :runtime
|
|
65
65
|
prerelease: false
|
|
66
66
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -68,7 +68,7 @@ dependencies:
|
|
|
68
68
|
-
|
|
69
69
|
- "="
|
|
70
70
|
- !ruby/object:Gem::Version
|
|
71
|
-
version:
|
|
71
|
+
version: 8.0.0
|
|
72
72
|
- !ruby/object:Gem::Dependency
|
|
73
73
|
name: version_gem
|
|
74
74
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -104,7 +104,7 @@ dependencies:
|
|
|
104
104
|
-
|
|
105
105
|
- ">="
|
|
106
106
|
- !ruby/object:Gem::Version
|
|
107
|
-
version: 3.1.
|
|
107
|
+
version: 3.1.41
|
|
108
108
|
type: :development
|
|
109
109
|
prerelease: false
|
|
110
110
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -116,7 +116,7 @@ dependencies:
|
|
|
116
116
|
-
|
|
117
117
|
- ">="
|
|
118
118
|
- !ruby/object:Gem::Version
|
|
119
|
-
version: 3.1.
|
|
119
|
+
version: 3.1.41
|
|
120
120
|
- !ruby/object:Gem::Dependency
|
|
121
121
|
name: bundler-audit
|
|
122
122
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -232,7 +232,7 @@ dependencies:
|
|
|
232
232
|
-
|
|
233
233
|
- ">="
|
|
234
234
|
- !ruby/object:Gem::Version
|
|
235
|
-
version: 2.0.
|
|
235
|
+
version: 2.0.32
|
|
236
236
|
type: :development
|
|
237
237
|
prerelease: false
|
|
238
238
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -244,7 +244,7 @@ dependencies:
|
|
|
244
244
|
-
|
|
245
245
|
- ">="
|
|
246
246
|
- !ruby/object:Gem::Version
|
|
247
|
-
version: 2.0.
|
|
247
|
+
version: 2.0.32
|
|
248
248
|
- !ruby/object:Gem::Dependency
|
|
249
249
|
name: turbo_tests2
|
|
250
250
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -350,14 +350,13 @@ files:
|
|
|
350
350
|
- sig/zip/merge.rbs
|
|
351
351
|
homepage: "https://github.com/structuredmerge/structuredmerge-ruby"
|
|
352
352
|
licenses:
|
|
353
|
-
-
|
|
354
|
-
- PolyForm-Small-Business-1.0.0
|
|
353
|
+
- MIT
|
|
355
354
|
metadata:
|
|
356
355
|
homepage_uri: "https://structuredmerge.org"
|
|
357
|
-
source_code_uri: "https://github.com/structuredmerge/structuredmerge-ruby/tree/
|
|
358
|
-
changelog_uri: "https://github.com/structuredmerge/structuredmerge-ruby/blob/
|
|
356
|
+
source_code_uri: "https://github.com/structuredmerge/structuredmerge-ruby/tree/v8.0.0"
|
|
357
|
+
changelog_uri: "https://github.com/structuredmerge/structuredmerge-ruby/blob/v8.0.0/CHANGELOG.md"
|
|
359
358
|
bug_tracker_uri: "https://github.com/structuredmerge/structuredmerge-ruby/issues"
|
|
360
|
-
documentation_uri: "https://www.rubydoc.info/gems/zip-merge/
|
|
359
|
+
documentation_uri: "https://www.rubydoc.info/gems/zip-merge/8.0.0"
|
|
361
360
|
funding_uri: "https://github.com/sponsors/pboling"
|
|
362
361
|
wiki_uri: "https://github.com/structuredmerge/structuredmerge-ruby/wiki"
|
|
363
362
|
news_uri: "https://www.railsbling.com/tags/zip-merge"
|
metadata.gz.sig
CHANGED
|
Binary file
|