rust-merge 7.0.0 → 7.1.1
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 +13 -0
- data/README.md +294 -0
- data/lib/rust/merge/version.rb +5 -3
- data/lib/rust/merge.rb +148 -37
- data/lib/rust-merge.rb +7 -1
- data/sig/rust/merge.rbs +8 -0
- data.tar.gz.sig +0 -0
- metadata +251 -15
- 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: 1dfc835a820ae028e33c90465264b92dc88cd4cdf34438a2f0ba6764cce2767f
|
|
4
|
+
data.tar.gz: a93887e99883c9407d844fff137fd1481ba63ab0954c0323e5083239f6180d9e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5c5322b6242de321539d64c67357d99c14de95da18869a06c1580d58dbc42b827589ae0d7e45ab58c0f8bfba66139f137eea095ae848f7bad7ec07bbbb425664
|
|
7
|
+
data.tar.gz: 7be12db8ca09e406f25efbccdc4d72440955eecc1567694678b4798e09a9afd8d1da68eceef3de4e3e22c135820ce062b0c069b7a8a55ad6ab54cfd397001374
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/LICENSE.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# License
|
|
2
|
+
|
|
3
|
+
This project is made available under the following licenses.
|
|
4
|
+
Choose the option that best fits your use case:
|
|
5
|
+
|
|
6
|
+
- [AGPL-3.0-only](https://github.com/structuredmerge/structuredmerge-ruby/blob/main/AGPL-3.0-only.md)
|
|
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.
|
|
10
|
+
|
|
11
|
+
## Copyright Notice
|
|
12
|
+
|
|
13
|
+
- Required Notice: Copyright (c) 2026 Peter H. Boling
|
data/README.md
ADDED
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
<a href="https://github.com/structuredmerge"><img alt="structuredmerge Logo by GitHub" src="https://github.com/structuredmerge.png?size=192" width="14%" align="right"/></a>
|
|
2
|
+
|
|
3
|
+
# ☯️ Rust::Merge
|
|
4
|
+
|
|
5
|
+
[![Version][👽versioni]][👽version] [![Ruby Users Forum][✉️ruby-forum-top-img]][✉️ruby-forum] [![GitHub tag (latest SemVer)][⛳️tag-img]][⛳️tag] [![License: AGPL-3.0-only OR PolyForm-Small-Business-1.0.0][📄license-img]][📄license] [![Total downloads][👽dl-ranki]][👽dl-rank] [![CI Current][🚎11-c-wfi]][🚎11-c-wf]
|
|
6
|
+
|
|
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
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
`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
|
+
|
|
13
|
+
[![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
|
+
|
|
15
|
+
<details markdown="1">
|
|
16
|
+
<summary>👣 How will this project approach the September 2025 hostile takeover of RubyGems? 🚑️</summary>
|
|
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>
|
|
21
|
+
|
|
22
|
+
## 🌻 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
|
+
|
|
24
|
+
`Rust::Merge` merges Rust source files by top-level items through the shared tree-sitter language-pack backend. It preserves destination items and appends template-only items when they do not already exist by structural path.
|
|
25
|
+
|
|
26
|
+
### Key Features
|
|
27
|
+
|
|
28
|
+
- Rust dialect feature profile and backend capability reporting.
|
|
29
|
+
- Item ownership for functions, modules, structs, enums, impl blocks, traits, and use items as exposed by the language pack.
|
|
30
|
+
- Destination parse diagnostics with the common result shape.
|
|
31
|
+
- Module-level APIs for fixture runners and Git integrations.
|
|
32
|
+
|
|
33
|
+
## 💡 Info you can shake a stick at
|
|
34
|
+
|
|
35
|
+
| Tokens to Remember | [![Gem name][⛳️name-img]][⛳️gem-name] [![Gem namespace][⛳️namespace-img]][⛳️gem-namespace] |
|
|
36
|
+
|-------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
37
|
+
| Works with MRI Ruby 4 | [![Ruby current Compat][💎ruby-c-i]][🚎11-c-wf]|
|
|
38
|
+
| 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] |
|
|
39
|
+
| 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] |
|
|
40
|
+
| 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] |
|
|
41
|
+
| 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] |
|
|
42
|
+
| 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] |
|
|
43
|
+
| 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] |
|
|
44
|
+
| `...` 💖 | [![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] |
|
|
45
|
+
|
|
46
|
+
### Compatibility
|
|
47
|
+
|
|
48
|
+
Compatible with MRI Ruby 4.0.0+, and concordant releases of JRuby, and TruffleRuby.
|
|
49
|
+
CI workflows and Appraisals are generated for MRI Ruby 4.0.0+.
|
|
50
|
+
This test floor is configured by `ruby.test_minimum` in `.kettle-jem.yml` and
|
|
51
|
+
may be higher than the gem's runtime compatibility floor when legacy Rubies are
|
|
52
|
+
not practical for the current toolchain.
|
|
53
|
+
|
|
54
|
+
<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>
|
|
55
|
+
|
|
56
|
+
The _amazing_ test matrix is powered by the kettle-dev stack.
|
|
57
|
+
|
|
58
|
+
<details markdown="1">
|
|
59
|
+
<summary>How kettle-dev manages complexity in tests</summary>
|
|
60
|
+
|
|
61
|
+
| Gem | Source | Role | Total downloads |
|
|
62
|
+
|-----|--------|------|---------------------|
|
|
63
|
+
| [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) |
|
|
64
|
+
| [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) |
|
|
65
|
+
| [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) |
|
|
66
|
+
| [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) |
|
|
67
|
+
| [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) |
|
|
68
|
+
| [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) |
|
|
69
|
+
| [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) |
|
|
70
|
+
| [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) |
|
|
71
|
+
|
|
72
|
+
</details>
|
|
73
|
+
|
|
74
|
+
## ✨ Installation
|
|
75
|
+
|
|
76
|
+
Install the gem and add to the application's Gemfile by executing:
|
|
77
|
+
|
|
78
|
+
```console
|
|
79
|
+
bundle add rust-merge
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
If bundler is not being used to manage dependencies, install the gem by executing:
|
|
83
|
+
|
|
84
|
+
```console
|
|
85
|
+
gem install rust-merge
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## ⚙️ Configuration
|
|
89
|
+
|
|
90
|
+
```ruby
|
|
91
|
+
profile = Rust::Merge.rust_backend_feature_profile
|
|
92
|
+
context = Rust::Merge.rust_plan_context
|
|
93
|
+
backends = Rust::Merge.available_rust_backends
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
The Ruby implementation uses the shared language-pack backend and returns diagnostics for unsupported dialects or unavailable parsers.
|
|
97
|
+
|
|
98
|
+
## 🔧 Basic Usage
|
|
99
|
+
|
|
100
|
+
```ruby
|
|
101
|
+
require "rust/merge"
|
|
102
|
+
|
|
103
|
+
result = Rust::Merge.merge_rust(
|
|
104
|
+
File.read("template.rs"),
|
|
105
|
+
File.read("lib.rs"),
|
|
106
|
+
"rust",
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
abort result.fetch(:diagnostics).inspect unless result.fetch(:ok)
|
|
110
|
+
File.write("lib.rs", result.fetch(:output))
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Most module-level merge methods return a Hash with `:ok`, `:diagnostics`, `:output`, and `:policies`. Check `:ok` before writing the result; diagnostics are structured for CI output and fixture conformance reports.
|
|
114
|
+
|
|
115
|
+
## 🔐 Security
|
|
116
|
+
|
|
117
|
+
See [SECURITY.md][🔐security].
|
|
118
|
+
|
|
119
|
+
## 🤝 Contributing
|
|
120
|
+
|
|
121
|
+
If you need some ideas of where to help, you could work on adding more code coverage,
|
|
122
|
+
or if it is already 💯 (see [below](#code-coverage)) check [issues][🤝gh-issues] or [PRs][🤝gh-pulls],
|
|
123
|
+
or use the gem and think about how it could be better.
|
|
124
|
+
|
|
125
|
+
We [![Keep A Changelog][📗keep-changelog-img]][📗keep-changelog] so if you make changes, remember to update it.
|
|
126
|
+
|
|
127
|
+
See [CONTRIBUTING.md][🤝contributing] for more detailed instructions.
|
|
128
|
+
|
|
129
|
+
### Code Coverage
|
|
130
|
+
|
|
131
|
+
<details markdown="1">
|
|
132
|
+
<summary>Coverage service badges</summary>
|
|
133
|
+
|
|
134
|
+
</details>
|
|
135
|
+
|
|
136
|
+
## 📌 Versioning
|
|
137
|
+
|
|
138
|
+
This library follows [![Semantic Versioning 2.0.0][📌semver-img]][📌semver] for its public API where practical.
|
|
139
|
+
For most applications, prefer the [Pessimistic Version Constraint][📌pvc] with two digits of precision.
|
|
140
|
+
|
|
141
|
+
For example:
|
|
142
|
+
|
|
143
|
+
```ruby
|
|
144
|
+
spec.add_dependency("rust-merge", "~> 7.0")
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
<details markdown="1">
|
|
148
|
+
<summary>📌 Is "Platform Support" part of the public API? More details inside.</summary>
|
|
149
|
+
|
|
150
|
+
Dropping support for a platform can be a breaking change for affected users.
|
|
151
|
+
If a release changes supported platforms, it should be called out clearly in the changelog and versioned with that impact in mind.
|
|
152
|
+
|
|
153
|
+
To get a better understanding of how SemVer is intended to work over a project's lifetime,
|
|
154
|
+
read this article from the creator of SemVer:
|
|
155
|
+
|
|
156
|
+
- ["Major Version Numbers are Not Sacred"][📌major-versions-not-sacred]
|
|
157
|
+
|
|
158
|
+
</details>
|
|
159
|
+
|
|
160
|
+
See [CHANGELOG.md][📌changelog] for a list of releases.
|
|
161
|
+
|
|
162
|
+
## 📄 License
|
|
163
|
+
|
|
164
|
+
The gem is available under the following licenses: [AGPL-3.0-only](https://github.com/structuredmerge/structuredmerge-ruby/blob/main/AGPL-3.0-only.md), [PolyForm-Small-Business-1.0.0](https://github.com/structuredmerge/structuredmerge-ruby/blob/main/PolyForm-Small-Business-1.0.0.md).
|
|
165
|
+
See [LICENSE.md][📄license] for details.
|
|
166
|
+
|
|
167
|
+
If none of the available licenses suit your use case, please [contact us](mailto:floss@galtzo.com) to discuss a custom commercial license.
|
|
168
|
+
|
|
169
|
+
[⛳liberapay-img]: https://img.shields.io/liberapay/goal/pboling.svg?logo=liberapay&color=a51611&style=flat
|
|
170
|
+
[⛳liberapay-bottom-img]: https://img.shields.io/liberapay/goal/pboling.svg?style=for-the-badge&logo=liberapay&color=a51611
|
|
171
|
+
[⛳liberapay]: https://liberapay.com/pboling/donate
|
|
172
|
+
[🖇sponsor-img]: https://img.shields.io/badge/Sponsor_Me!-pboling.svg?style=social&logo=github
|
|
173
|
+
[🖇sponsor-bottom-img]: https://img.shields.io/badge/Sponsor_Me!-pboling-blue?style=for-the-badge&logo=github
|
|
174
|
+
[🖇sponsor]: https://github.com/sponsors/pboling
|
|
175
|
+
[🖇kofi-img]: https://img.shields.io/badge/ko--fi-%E2%9C%93-a51611.svg?style=flat
|
|
176
|
+
[🖇kofi]: https://ko-fi.com/pboling
|
|
177
|
+
[🖇buyme-small-img]: https://img.shields.io/badge/buy_me_a_coffee-%E2%9C%93-a51611.svg?style=flat
|
|
178
|
+
[🖇buyme-img]: https://img.buymeacoffee.com/button-api/?text=Buy%20me%20a%20latte&emoji=&slug=pboling&button_colour=FFDD00&font_colour=000000&font_family=Cookie&outline_colour=000000&coffee_colour=ffffff
|
|
179
|
+
[🖇buyme]: https://www.buymeacoffee.com/pboling
|
|
180
|
+
[🖇paypal-img]: https://img.shields.io/badge/donate-paypal-a51611.svg?style=flat&logo=paypal
|
|
181
|
+
[🖇paypal-bottom-img]: https://img.shields.io/badge/donate-paypal-a51611.svg?style=for-the-badge&logo=paypal&color=0A0A0A
|
|
182
|
+
[🖇paypal]: https://www.paypal.com/paypalme/peterboling
|
|
183
|
+
[🖇floss-funding.dev]: https://floss-funding.dev
|
|
184
|
+
[🖇floss-funding-gem]: https://github.com/galtzo-floss/floss_funding
|
|
185
|
+
[✉️discord-invite]: https://discord.gg/3qme4XHNKN
|
|
186
|
+
[✉️discord-invite-img-ftb]: https://img.shields.io/discord/1373797679469170758?style=for-the-badge&logo=discord
|
|
187
|
+
[✉️ruby-friends-img]: https://img.shields.io/badge/daily.dev-%F0%9F%92%8E_Ruby_Friends-0A0A0A?style=for-the-badge&logo=dailydotdev&logoColor=white
|
|
188
|
+
[✉️ruby-friends]: https://app.daily.dev/squads/rubyfriends
|
|
189
|
+
[✉️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
|
|
190
|
+
[✉️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
|
|
191
|
+
[✉️ruby-forum]: https://www.rubyforum.org/tag/structuredmerge
|
|
192
|
+
[✇bundle-group-pattern]: https://gist.github.com/pboling/4564780
|
|
193
|
+
[⛳️gem-namespace]: https://github.com/structuredmerge/structuredmerge-ruby/tree/main/gems/rust-merge
|
|
194
|
+
[⛳️namespace-img]: https://img.shields.io/badge/namespace-Rust::Merge-3C2D2D.svg?style=square&logo=ruby&logoColor=white
|
|
195
|
+
[⛳️gem-name]: https://clickgems.clickhouse.com/dashboard/rust-merge
|
|
196
|
+
[⛳️name-img]: https://img.shields.io/badge/name-rust--merge-3C2D2D.svg?style=square&logo=rubygems&logoColor=red
|
|
197
|
+
[⛳️tag-img]: https://img.shields.io/github/tag/structuredmerge/structuredmerge-ruby.svg
|
|
198
|
+
[⛳️tag]: https://github.com/structuredmerge/structuredmerge-ruby/releases
|
|
199
|
+
[🚂maint-blog]: http://www.railsbling.com/tags/rust-merge
|
|
200
|
+
[🚂maint-blog-img]: https://img.shields.io/badge/blog-railsbling-0093D0.svg?style=for-the-badge&logo=rubyonrails&logoColor=orange
|
|
201
|
+
[🚂maint-contact]: http://www.railsbling.com/contact
|
|
202
|
+
[🚂maint-contact-img]: https://img.shields.io/badge/Contact-Maintainer-0093D0.svg?style=flat&logo=rubyonrails&logoColor=red
|
|
203
|
+
[💖🖇linkedin]: http://www.linkedin.com/in/peterboling
|
|
204
|
+
[💖🖇linkedin-img]: https://img.shields.io/badge/LinkedIn-Profile-0B66C2?style=flat&logo=newjapanprowrestling
|
|
205
|
+
[💖✌️wellfound]: https://wellfound.com/u/peter-boling
|
|
206
|
+
[💖✌️wellfound-img]: https://img.shields.io/badge/peter--boling-orange?style=flat&logo=wellfound
|
|
207
|
+
[💖💲crunchbase]: https://www.crunchbase.com/person/peter-boling
|
|
208
|
+
[💖💲crunchbase-img]: https://img.shields.io/badge/peter--boling-purple?style=flat&logo=crunchbase
|
|
209
|
+
[💖🐘ruby-mast]: https://ruby.social/@galtzo
|
|
210
|
+
[💖🐘ruby-mast-img]: https://img.shields.io/mastodon/follow/109447111526622197?domain=https://ruby.social&style=flat&logo=mastodon&label=Ruby%20@galtzo
|
|
211
|
+
[💖🦋bluesky]: https://bsky.app/profile/galtzo.com
|
|
212
|
+
[💖🦋bluesky-img]: https://img.shields.io/badge/@galtzo.com-0285FF?style=flat&logo=bluesky&logoColor=white
|
|
213
|
+
[💖🌳linktree]: https://linktr.ee/galtzo
|
|
214
|
+
[💖🌳linktree-img]: https://img.shields.io/badge/galtzo-purple?style=flat&logo=linktree
|
|
215
|
+
[💖💁🏼♂️devto]: https://dev.to/galtzo
|
|
216
|
+
[💖💁🏼♂️devto-img]: https://img.shields.io/badge/dev.to-0A0A0A?style=flat&logo=devdotto&logoColor=white
|
|
217
|
+
[💖💁🏼♂️aboutme]: https://about.me/peter.boling
|
|
218
|
+
[💖💁🏼♂️aboutme-img]: https://img.shields.io/badge/about.me-0A0A0A?style=flat&logo=aboutme&logoColor=white
|
|
219
|
+
[💖🧊berg]: https://codeberg.org/pboling
|
|
220
|
+
[💖🐙hub]: https://github.org/pboling
|
|
221
|
+
[💖🛖hut]: https://sr.ht/~galtzo/
|
|
222
|
+
[💖🧪lab]: https://gitlab.com/pboling
|
|
223
|
+
[👨🏼🏫expsup-upwork]: https://www.upwork.com/freelancers/~014942e9b056abdf86?mp_source=share
|
|
224
|
+
[👨🏼🏫expsup-upwork-img]: https://img.shields.io/badge/UpWork-13544E?style=for-the-badge&logo=Upwork&logoColor=white
|
|
225
|
+
[👨🏼🏫expsup-codementor]: https://www.codementor.io/peterboling?utm_source=github&utm_medium=button&utm_term=peterboling&utm_campaign=github
|
|
226
|
+
[👨🏼🏫expsup-codementor-img]: https://img.shields.io/badge/CodeMentor-Get_Help-1abc9c?style=for-the-badge&logo=CodeMentor&logoColor=white
|
|
227
|
+
[🏙️entsup-tidelift]: https://tidelift.com/subscription/pkg/rubygems-rust-merge?utm_source=rubygems-rust-merge&utm_medium=referral&utm_campaign=readme
|
|
228
|
+
[🏙️entsup-tidelift-img]: https://img.shields.io/badge/Tidelift_and_Sonar-Enterprise_Support-FD3456?style=for-the-badge&logo=sonar&logoColor=white
|
|
229
|
+
[🏙️entsup-tidelift-sonar]: https://blog.tidelift.com/tidelift-joins-sonar
|
|
230
|
+
[💁🏼♂️peterboling]: http://www.peterboling.com
|
|
231
|
+
[🚂railsbling]: http://www.railsbling.com
|
|
232
|
+
[📜src-gl-img]: https://img.shields.io/badge/GitLab-FBA326?style=for-the-badge&logo=Gitlab&logoColor=orange
|
|
233
|
+
[📜src-gl]: https://gitlab.com/structuredmerge/structuredmerge-ruby/-/tree/main/gems/rust-merge
|
|
234
|
+
[📜src-cb-img]: https://img.shields.io/badge/CodeBerg-4893CC?style=for-the-badge&logo=CodeBerg&logoColor=blue
|
|
235
|
+
[📜src-cb]: https://codeberg.org/structuredmerge/structuredmerge-ruby/src/branch/main/gems/rust-merge
|
|
236
|
+
[📜src-gh-img]: https://img.shields.io/badge/GitHub-238636?style=for-the-badge&logo=GitHub&logoColor=green
|
|
237
|
+
[📜src-gh]: https://github.com/structuredmerge/structuredmerge-ruby/tree/main/gems/rust-merge
|
|
238
|
+
[📜docs-cr-rd-img]: https://img.shields.io/badge/RubyDoc-Current_Release-943CD2?style=for-the-badge&logo=readthedocs&logoColor=white
|
|
239
|
+
[📜docs-head-rd-img]: https://img.shields.io/badge/YARD_on_Galtzo.com-HEAD-943CD2?style=for-the-badge&logo=readthedocs&logoColor=white
|
|
240
|
+
[📜gl-wiki]: https://gitlab.com/structuredmerge/structuredmerge-ruby/-/wikis/home
|
|
241
|
+
[📜gh-wiki]: https://github.com/structuredmerge/structuredmerge-ruby/wiki
|
|
242
|
+
[📜gl-wiki-img]: https://img.shields.io/badge/wiki-gitlab-943CD2.svg?style=for-the-badge&logo=gitlab&logoColor=white
|
|
243
|
+
[📜gh-wiki-img]: https://img.shields.io/badge/wiki-github-943CD2.svg?style=for-the-badge&logo=github&logoColor=white
|
|
244
|
+
[👽dl-rank]: https://clickgems.clickhouse.com/dashboard/rust-merge
|
|
245
|
+
[👽dl-ranki]: https://img.shields.io/gem/dt/rust-merge.svg
|
|
246
|
+
[👽version]: https://clickgems.clickhouse.com/dashboard/rust-merge
|
|
247
|
+
[👽versioni]: https://img.shields.io/gem/v/rust-merge.svg
|
|
248
|
+
[🚎11-c-wf]: https://github.com/structuredmerge/structuredmerge-ruby/actions/workflows/current.yml
|
|
249
|
+
[🚎11-c-wfi]: https://github.com/structuredmerge/structuredmerge-ruby/actions/workflows/current.yml/badge.svg
|
|
250
|
+
[💎ruby-c-i]: https://img.shields.io/badge/Ruby-current-CC342D?style=for-the-badge&logo=ruby&logoColor=green
|
|
251
|
+
[🤝gh-issues]: https://github.com/structuredmerge/structuredmerge-ruby/issues
|
|
252
|
+
[🤝gh-pulls]: https://github.com/structuredmerge/structuredmerge-ruby/pulls
|
|
253
|
+
[🤝gl-issues]: https://gitlab.com/structuredmerge/structuredmerge-ruby/-/issues
|
|
254
|
+
[🤝gl-pulls]: https://gitlab.com/structuredmerge/structuredmerge-ruby/-/merge_requests
|
|
255
|
+
[🤝cb-issues]: https://codeberg.org/structuredmerge/structuredmerge-ruby/issues
|
|
256
|
+
[🤝cb-pulls]: https://codeberg.org/structuredmerge/structuredmerge-ruby/pulls
|
|
257
|
+
[🤝cb-donate]: https://donate.codeberg.org/
|
|
258
|
+
[🤝contributing]: https://github.com/structuredmerge/structuredmerge-ruby/blob/main/CONTRIBUTING.md
|
|
259
|
+
[🖐contrib-rocks]: https://contrib.rocks
|
|
260
|
+
[🖐contributors]: https://github.com/structuredmerge/structuredmerge-ruby/graphs/contributors
|
|
261
|
+
[🖐contributors-img]: https://contrib.rocks/image?repo=structuredmerge/structuredmerge-ruby
|
|
262
|
+
[🪇conduct]: https://github.com/structuredmerge/structuredmerge-ruby/blob/main/CODE_OF_CONDUCT.md
|
|
263
|
+
[🪇conduct-img]: https://img.shields.io/badge/Contributor_Covenant-2.1-259D6C.svg
|
|
264
|
+
[📌pvc]: http://guides.rubygems.org/patterns/#pessimistic-version-constraint
|
|
265
|
+
[📌semver]: https://semver.org/spec/v2.0.0.html
|
|
266
|
+
[📌semver-img]: https://img.shields.io/badge/semver-2.0.0-259D6C.svg?style=flat
|
|
267
|
+
[📌semver-breaking]: https://github.com/semver/semver/issues/716#issuecomment-869336139
|
|
268
|
+
[📌major-versions-not-sacred]: https://tom.preston-werner.com/2022/05/23/major-version-numbers-are-not-sacred.html
|
|
269
|
+
[📌changelog]: https://github.com/structuredmerge/structuredmerge-ruby/blob/main/CHANGELOG.md
|
|
270
|
+
[📗keep-changelog]: https://keepachangelog.com/en/1.0.0/
|
|
271
|
+
[📗keep-changelog-img]: https://img.shields.io/badge/keep--a--changelog-1.0.0-34495e.svg?style=flat
|
|
272
|
+
[📌gitmoji]: https://gitmoji.dev
|
|
273
|
+
[📌gitmoji-img]: https://img.shields.io/badge/gitmoji_commits-%20%F0%9F%98%9C%20%F0%9F%98%8D-34495e.svg?style=flat-square
|
|
274
|
+
[🧮kloc]: https://www.youtube.com/watch?v=dQw4w9WgXcQ
|
|
275
|
+
[🧮kloc-img]: https://img.shields.io/badge/KLOC-0.127-FFDD67.svg?style=for-the-badge&logo=YouTube&logoColor=blue
|
|
276
|
+
[🔐security]: https://github.com/structuredmerge/structuredmerge-ruby/blob/main/SECURITY.md
|
|
277
|
+
[🔐security-img]: https://img.shields.io/badge/security-policy-259D6C.svg?style=flat
|
|
278
|
+
[📄copyright-notice-explainer]: https://opensource.stackexchange.com/questions/5778/why-do-licenses-such-as-the-mit-license-specify-a-single-year
|
|
279
|
+
[📄license]: LICENSE.md
|
|
280
|
+
[📄license-ref]: LICENSE.md
|
|
281
|
+
[📄license-img]: https://img.shields.io/badge/License-AGPL--3.0--only_OR_PolyForm--Small--Business--1.0.0-259D6C.svg
|
|
282
|
+
[📄license-compat]: https://www.apache.org/legal/resolved.html#category-x
|
|
283
|
+
[📄license-compat-img]: https://img.shields.io/badge/Apache_Incompatible:_Category_X-%E2%9C%97-C0392B.svg?style=flat&logo=Apache
|
|
284
|
+
[📄ilo-declaration]: https://www.ilo.org/declaration/lang--en/index.htm
|
|
285
|
+
[📄ilo-declaration-img]: https://img.shields.io/badge/ILO_Fundamental_Principles-✓-259D6C.svg?style=flat
|
|
286
|
+
[🚎yard-current]: http://rubydoc.info/gems/rust-merge
|
|
287
|
+
[🚎yard-head]: https://rust-merge.galtzo.com
|
|
288
|
+
[💎stone_checksums]: https://github.com/galtzo-floss/stone_checksums
|
|
289
|
+
[💎SHA_checksums]: https://gitlab.com/structuredmerge/structuredmerge-ruby/-/tree/main/checksums
|
|
290
|
+
[💎rlts]: https://github.com/rubocop-lts/rubocop-lts
|
|
291
|
+
[💎rlts-img]: https://img.shields.io/badge/code_style_&_linting-rubocop--lts-34495e.svg?plastic&logo=ruby&logoColor=white
|
|
292
|
+
[💎appraisal2]: https://github.com/appraisal-rb/appraisal2
|
|
293
|
+
[💎appraisal2-img]: https://img.shields.io/badge/appraised_by-appraisal2-34495e.svg?plastic&logo=ruby&logoColor=white
|
|
294
|
+
[💎d-in-dvcs]: https://railsbling.com/posts/dvcs/put_the_d_in_dvcs/
|
data/lib/rust/merge/version.rb
CHANGED
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
module Rust
|
|
4
4
|
module Merge
|
|
5
|
+
# Version namespace for this gem.
|
|
5
6
|
module Version
|
|
6
|
-
|
|
7
|
+
# Current gem version.
|
|
8
|
+
VERSION = '7.1.1'
|
|
7
9
|
end
|
|
8
|
-
|
|
9
|
-
VERSION = Version::VERSION
|
|
10
|
+
# Current gem version exposed at the traditional constant location.
|
|
11
|
+
VERSION = Version::VERSION # Traditional Constant Location
|
|
10
12
|
end
|
|
11
13
|
end
|
data/lib/rust/merge.rb
CHANGED
|
@@ -1,26 +1,44 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require
|
|
3
|
+
require 'tree_haver'
|
|
4
|
+
require 'ast/merge'
|
|
5
|
+
require_relative 'merge/version'
|
|
4
6
|
|
|
5
7
|
module Rust
|
|
6
8
|
module Merge
|
|
7
|
-
PACKAGE_NAME =
|
|
9
|
+
PACKAGE_NAME = 'rust-merge'
|
|
8
10
|
TREE_SITTER_BACKEND = TreeHaver::KREUZBERG_LANGUAGE_PACK_BACKEND
|
|
9
|
-
DESTINATION_WINS_ARRAY_POLICY = { surface:
|
|
11
|
+
DESTINATION_WINS_ARRAY_POLICY = { surface: 'array', name: 'destination_wins_array' }.freeze
|
|
12
|
+
BACKEND_REGISTRY = Struct.new(:registered, :mutex).new(false, Mutex.new)
|
|
10
13
|
|
|
11
14
|
module_function
|
|
12
15
|
|
|
16
|
+
def register_backend!
|
|
17
|
+
BACKEND_REGISTRY.mutex.synchronize do
|
|
18
|
+
return if BACKEND_REGISTRY.registered
|
|
19
|
+
|
|
20
|
+
TreeHaver::BackendRegistry.register(TREE_SITTER_BACKEND)
|
|
21
|
+
|
|
22
|
+
grammar_finder = TreeHaver::GrammarFinder.new(:rust)
|
|
23
|
+
grammar_finder.register! if grammar_finder.available?
|
|
24
|
+
|
|
25
|
+
BACKEND_REGISTRY.registered = true
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
13
29
|
def rust_feature_profile
|
|
14
|
-
{ family:
|
|
30
|
+
{ family: 'rust', supported_dialects: ['rust'], supported_policies: [DESTINATION_WINS_ARRAY_POLICY] }
|
|
15
31
|
end
|
|
16
32
|
|
|
17
33
|
def available_rust_backends
|
|
18
|
-
[TREE_SITTER_BACKEND]
|
|
34
|
+
rust_backend_available_for_analysis?(TREE_SITTER_BACKEND.id) ? [TREE_SITTER_BACKEND] : []
|
|
19
35
|
end
|
|
20
36
|
|
|
21
37
|
def rust_backend_feature_profile(backend: nil)
|
|
22
|
-
requested = backend
|
|
23
|
-
|
|
38
|
+
requested = requested_tree_sitter_backend_id(backend)
|
|
39
|
+
unless rust_backend_available_for_analysis?(requested)
|
|
40
|
+
return unsupported_feature_result("Unsupported Rust backend #{requested}.")
|
|
41
|
+
end
|
|
24
42
|
|
|
25
43
|
rust_feature_profile.merge(
|
|
26
44
|
backend: requested,
|
|
@@ -44,81 +62,172 @@ module Rust
|
|
|
44
62
|
end
|
|
45
63
|
|
|
46
64
|
def parse_rust(source, dialect)
|
|
47
|
-
|
|
65
|
+
unless rust_backend_available_for_analysis?(nil)
|
|
66
|
+
diagnostic_backend = TreeHaver.current_backend_id || 'tree-sitter'
|
|
67
|
+
return unsupported_feature_result("Unsupported Rust backend #{diagnostic_backend}.")
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
return analyze_rust_module(source) if dialect == 'rust'
|
|
71
|
+
|
|
72
|
+
{ ok: false,
|
|
73
|
+
diagnostics: [{ severity: 'error', category: 'unsupported_feature', message: "Unsupported Rust dialect #{dialect}." }], policies: [] }
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
def rust_backend_available_for_analysis?(backend_id)
|
|
77
|
+
register_backend!
|
|
78
|
+
|
|
79
|
+
if backend_id.to_s.empty?
|
|
80
|
+
TreeHaver.parser_for(:rust, backend_type: :tree_sitter)
|
|
81
|
+
else
|
|
82
|
+
TreeHaver.with_backend(backend_id) { TreeHaver.parser_for(:rust, backend_type: :tree_sitter) }
|
|
83
|
+
end
|
|
84
|
+
true
|
|
85
|
+
rescue TreeHaver::Error, ArgumentError
|
|
86
|
+
false
|
|
87
|
+
end
|
|
48
88
|
|
|
49
|
-
|
|
89
|
+
def requested_tree_sitter_backend_id(backend)
|
|
90
|
+
return backend.to_s unless backend.to_s.empty?
|
|
91
|
+
|
|
92
|
+
contextual = TreeHaver.current_backend_id || ENV['TREE_HAVER_BACKEND']
|
|
93
|
+
contextual.to_s.empty? || contextual.to_s == 'auto' ? TREE_SITTER_BACKEND.id : contextual.to_s
|
|
50
94
|
end
|
|
95
|
+
private_class_method :requested_tree_sitter_backend_id
|
|
51
96
|
|
|
52
97
|
def match_rust_owners(template, destination)
|
|
53
|
-
|
|
54
|
-
template_paths = template[:owners].to_h { |owner| [owner[:path], true] }
|
|
55
|
-
{
|
|
56
|
-
matched: template[:owners].filter { |owner| destination_paths[owner[:path]] }.map { |owner| { template_path: owner[:path], destination_path: owner[:path] } },
|
|
57
|
-
unmatched_template: template[:owners].map { |owner| owner[:path] }.reject { |path| destination_paths[path] },
|
|
58
|
-
unmatched_destination: destination[:owners].map { |owner| owner[:path] }.reject { |path| template_paths[path] }
|
|
59
|
-
}
|
|
98
|
+
Ast::Merge::OwnerSelection.match_by_path(template, destination)
|
|
60
99
|
end
|
|
61
100
|
|
|
62
101
|
def merge_rust(template_source, destination_source, dialect)
|
|
63
102
|
template = parse_rust(template_source, dialect)
|
|
64
103
|
return { ok: false, diagnostics: template[:diagnostics], policies: [] } unless template[:ok]
|
|
104
|
+
|
|
65
105
|
destination = parse_rust(destination_source, dialect)
|
|
66
106
|
unless destination[:ok]
|
|
67
107
|
return {
|
|
68
108
|
ok: false,
|
|
69
|
-
diagnostics: destination[:diagnostics].map
|
|
109
|
+
diagnostics: destination[:diagnostics].map do |diagnostic|
|
|
110
|
+
diagnostic[:category] == 'parse_error' ? diagnostic.merge(category: 'destination_parse_error') : diagnostic
|
|
111
|
+
end,
|
|
70
112
|
policies: []
|
|
71
113
|
}
|
|
72
114
|
end
|
|
73
115
|
|
|
74
116
|
destination_declarations = destination.dig(:analysis, :declarations).to_h { |item| [item[:path], item] }
|
|
75
117
|
merged_declaration_texts = destination.dig(:analysis, :declarations).map { |item| item[:text] } +
|
|
76
|
-
|
|
118
|
+
template.dig(:analysis, :declarations).reject do |item|
|
|
119
|
+
destination_declarations[item[:path]]
|
|
120
|
+
end.map { |item| item[:text] }
|
|
77
121
|
import_block = destination.dig(:analysis, :imports).map { |item| item[:text] }.join
|
|
78
122
|
declaration_block = merged_declaration_texts.join("\n").rstrip
|
|
79
123
|
sections = [import_block.rstrip, declaration_block].reject(&:empty?)
|
|
80
|
-
{ ok: true, diagnostics: [], output: "#{sections.join("\n\n").rstrip}\n",
|
|
124
|
+
{ ok: true, diagnostics: [], output: "#{sections.join("\n\n").rstrip}\n",
|
|
125
|
+
policies: [DESTINATION_WINS_ARRAY_POLICY] }
|
|
81
126
|
end
|
|
82
127
|
|
|
83
128
|
def analyze_rust_module(source)
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
129
|
+
parser = TreeHaver.parser_for(:rust, backend_type: :tree_sitter)
|
|
130
|
+
tree = parser.parse(source)
|
|
131
|
+
collect_parse_errors(tree.root_node)
|
|
132
|
+
|
|
133
|
+
imports = []
|
|
134
|
+
declarations = []
|
|
135
|
+
tree.root_node.children.each do |node|
|
|
136
|
+
case node.type
|
|
137
|
+
when 'use_declaration'
|
|
138
|
+
import_source = line_anchored_slice(source, node)
|
|
139
|
+
imports << {
|
|
140
|
+
path: "/imports/#{imports.length}",
|
|
141
|
+
owner_kind: 'import',
|
|
142
|
+
match_key: normalize_rust_import_path(import_source),
|
|
143
|
+
text: import_text(source, node)
|
|
144
|
+
}
|
|
145
|
+
when 'function_item', 'struct_item', 'enum_item', 'trait_item', 'impl_item', 'const_item', 'static_item',
|
|
146
|
+
'type_item', 'mod_item'
|
|
147
|
+
name = first_named_descendant_text(source, node, %w[identifier type_identifier])
|
|
148
|
+
next unless name
|
|
149
|
+
|
|
150
|
+
declarations << {
|
|
151
|
+
path: "/declarations/#{name}",
|
|
152
|
+
owner_kind: 'declaration',
|
|
153
|
+
match_key: name,
|
|
154
|
+
text: declaration_text(source, node)
|
|
155
|
+
}
|
|
156
|
+
end
|
|
91
157
|
end
|
|
92
|
-
declarations = processed[:analysis].structure
|
|
93
|
-
.select { |item| item.name }
|
|
94
|
-
.map { |item| { path: "/declarations/#{item.name}", match_key: item.name, text: declaration_text(source, item.span) } }
|
|
95
|
-
.sort_by { |item| item[:path] }
|
|
96
158
|
|
|
97
159
|
{
|
|
98
160
|
ok: true,
|
|
99
161
|
diagnostics: [],
|
|
100
162
|
analysis: {
|
|
101
|
-
kind:
|
|
102
|
-
dialect:
|
|
103
|
-
source: source,
|
|
104
|
-
owners: imports.map { |item| { path: item[:path], owner_kind: "import", match_key: item[:match_key] } } +
|
|
105
|
-
declarations.map { |item| { path: item[:path], owner_kind: "declaration", match_key: item[:match_key] } },
|
|
163
|
+
kind: 'rust',
|
|
164
|
+
dialect: 'rust',
|
|
106
165
|
imports: imports,
|
|
107
|
-
declarations: declarations
|
|
166
|
+
declarations: declarations,
|
|
167
|
+
owners: owner_views(imports + declarations)
|
|
108
168
|
},
|
|
109
169
|
policies: []
|
|
110
170
|
}
|
|
171
|
+
rescue TreeHaver::Error, StandardError => e
|
|
172
|
+
parse_failure_result(e)
|
|
111
173
|
end
|
|
112
174
|
private_class_method :analyze_rust_module
|
|
113
175
|
|
|
176
|
+
def collect_parse_errors(node)
|
|
177
|
+
raise TreeHaver::NotAvailable, 'Rust parse returned no root node' unless node
|
|
178
|
+
return unless node.respond_to?(:has_error?) && node.has_error?
|
|
179
|
+
|
|
180
|
+
raise TreeHaver::NotAvailable,
|
|
181
|
+
'Rust parse contains syntax errors'
|
|
182
|
+
end
|
|
183
|
+
private_class_method :collect_parse_errors
|
|
184
|
+
|
|
185
|
+
def parse_failure_result(error)
|
|
186
|
+
{ ok: false,
|
|
187
|
+
diagnostics: [{ severity: 'error', category: 'parse_error', message: error.message }],
|
|
188
|
+
policies: [] }
|
|
189
|
+
end
|
|
190
|
+
private_class_method :parse_failure_result
|
|
191
|
+
|
|
192
|
+
def unsupported_feature_result(message)
|
|
193
|
+
{
|
|
194
|
+
ok: false,
|
|
195
|
+
diagnostics: [{ severity: 'error', category: 'unsupported_feature', message: message }],
|
|
196
|
+
policies: []
|
|
197
|
+
}
|
|
198
|
+
end
|
|
199
|
+
private_class_method :unsupported_feature_result
|
|
200
|
+
|
|
114
201
|
def normalize_rust_import_path(import_source)
|
|
115
|
-
import_source.sub(/\Ause\s+/,
|
|
202
|
+
import_source.sub(/\Ause\s+/, '').sub(/;\z/, '').strip
|
|
116
203
|
end
|
|
117
204
|
private_class_method :normalize_rust_import_path
|
|
118
205
|
|
|
206
|
+
def first_named_descendant_text(source, node, types)
|
|
207
|
+
return slice_span(source, node) if types.include?(node.type)
|
|
208
|
+
|
|
209
|
+
node.children.each do |child|
|
|
210
|
+
value = first_named_descendant_text(source, child, types)
|
|
211
|
+
return value if value && !value.empty?
|
|
212
|
+
end
|
|
213
|
+
nil
|
|
214
|
+
end
|
|
215
|
+
private_class_method :first_named_descendant_text
|
|
216
|
+
|
|
217
|
+
def owner_view(item)
|
|
218
|
+
item.slice(:path, :owner_kind, :match_key)
|
|
219
|
+
end
|
|
220
|
+
private_class_method :owner_view
|
|
221
|
+
|
|
222
|
+
def owner_views(items)
|
|
223
|
+
items.map { |item| owner_view(item) }
|
|
224
|
+
end
|
|
225
|
+
private_class_method :owner_views
|
|
226
|
+
|
|
119
227
|
def import_text(source, span) = "#{slice_span(source, span)}\n"
|
|
120
228
|
def declaration_text(source, span) = "#{line_anchored_slice(source, span)}\n"
|
|
121
229
|
def slice_span(source, span) = source[span.start_byte...span.end_byte].strip
|
|
230
|
+
|
|
122
231
|
def line_anchored_slice(source, span)
|
|
123
232
|
line_start = source.rindex("\n", [span.start_byte - 1, 0].max)
|
|
124
233
|
line_start = line_start ? line_start + 1 : 0
|
|
@@ -127,3 +236,5 @@ module Rust
|
|
|
127
236
|
private_class_method :import_text, :declaration_text, :slice_span, :line_anchored_slice
|
|
128
237
|
end
|
|
129
238
|
end
|
|
239
|
+
|
|
240
|
+
Rust::Merge.register_backend!
|
data/lib/rust-merge.rb
CHANGED
data/sig/rust/merge.rbs
ADDED
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rust-merge
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 7.
|
|
4
|
+
version: 7.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Peter H. Boling
|
|
8
|
-
bindir:
|
|
8
|
+
bindir: exe
|
|
9
9
|
cert_chain:
|
|
10
10
|
- |
|
|
11
11
|
-----BEGIN CERTIFICATE-----
|
|
@@ -43,54 +43,290 @@ dependencies:
|
|
|
43
43
|
requirements:
|
|
44
44
|
- - '='
|
|
45
45
|
- !ruby/object:Gem::Version
|
|
46
|
-
version: 7.
|
|
46
|
+
version: 7.1.1
|
|
47
47
|
type: :runtime
|
|
48
48
|
prerelease: false
|
|
49
49
|
version_requirements: !ruby/object:Gem::Requirement
|
|
50
50
|
requirements:
|
|
51
51
|
- - '='
|
|
52
52
|
- !ruby/object:Gem::Version
|
|
53
|
-
version: 7.
|
|
53
|
+
version: 7.1.1
|
|
54
54
|
- !ruby/object:Gem::Dependency
|
|
55
55
|
name: tree_haver
|
|
56
56
|
requirement: !ruby/object:Gem::Requirement
|
|
57
57
|
requirements:
|
|
58
58
|
- - '='
|
|
59
59
|
- !ruby/object:Gem::Version
|
|
60
|
-
version: 7.
|
|
60
|
+
version: 7.1.1
|
|
61
61
|
type: :runtime
|
|
62
62
|
prerelease: false
|
|
63
63
|
version_requirements: !ruby/object:Gem::Requirement
|
|
64
64
|
requirements:
|
|
65
65
|
- - '='
|
|
66
66
|
- !ruby/object:Gem::Version
|
|
67
|
-
version: 7.
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
version: 7.1.1
|
|
68
|
+
- !ruby/object:Gem::Dependency
|
|
69
|
+
name: version_gem
|
|
70
|
+
requirement: !ruby/object:Gem::Requirement
|
|
71
|
+
requirements:
|
|
72
|
+
- - "~>"
|
|
73
|
+
- !ruby/object:Gem::Version
|
|
74
|
+
version: '1.1'
|
|
75
|
+
- - ">="
|
|
76
|
+
- !ruby/object:Gem::Version
|
|
77
|
+
version: 1.1.15
|
|
78
|
+
type: :runtime
|
|
79
|
+
prerelease: false
|
|
80
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
81
|
+
requirements:
|
|
82
|
+
- - "~>"
|
|
83
|
+
- !ruby/object:Gem::Version
|
|
84
|
+
version: '1.1'
|
|
85
|
+
- - ">="
|
|
86
|
+
- !ruby/object:Gem::Version
|
|
87
|
+
version: 1.1.15
|
|
88
|
+
- !ruby/object:Gem::Dependency
|
|
89
|
+
name: kettle-dev
|
|
90
|
+
requirement: !ruby/object:Gem::Requirement
|
|
91
|
+
requirements:
|
|
92
|
+
- - "~>"
|
|
93
|
+
- !ruby/object:Gem::Version
|
|
94
|
+
version: '2.5'
|
|
95
|
+
- - ">="
|
|
96
|
+
- !ruby/object:Gem::Version
|
|
97
|
+
version: 2.5.17
|
|
98
|
+
type: :development
|
|
99
|
+
prerelease: false
|
|
100
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
101
|
+
requirements:
|
|
102
|
+
- - "~>"
|
|
103
|
+
- !ruby/object:Gem::Version
|
|
104
|
+
version: '2.5'
|
|
105
|
+
- - ">="
|
|
106
|
+
- !ruby/object:Gem::Version
|
|
107
|
+
version: 2.5.17
|
|
108
|
+
- !ruby/object:Gem::Dependency
|
|
109
|
+
name: bundler-audit
|
|
110
|
+
requirement: !ruby/object:Gem::Requirement
|
|
111
|
+
requirements:
|
|
112
|
+
- - "~>"
|
|
113
|
+
- !ruby/object:Gem::Version
|
|
114
|
+
version: 0.9.3
|
|
115
|
+
type: :development
|
|
116
|
+
prerelease: false
|
|
117
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
118
|
+
requirements:
|
|
119
|
+
- - "~>"
|
|
120
|
+
- !ruby/object:Gem::Version
|
|
121
|
+
version: 0.9.3
|
|
122
|
+
- !ruby/object:Gem::Dependency
|
|
123
|
+
name: rake
|
|
124
|
+
requirement: !ruby/object:Gem::Requirement
|
|
125
|
+
requirements:
|
|
126
|
+
- - "~>"
|
|
127
|
+
- !ruby/object:Gem::Version
|
|
128
|
+
version: '13.0'
|
|
129
|
+
type: :development
|
|
130
|
+
prerelease: false
|
|
131
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
132
|
+
requirements:
|
|
133
|
+
- - "~>"
|
|
134
|
+
- !ruby/object:Gem::Version
|
|
135
|
+
version: '13.0'
|
|
136
|
+
- !ruby/object:Gem::Dependency
|
|
137
|
+
name: require_bench
|
|
138
|
+
requirement: !ruby/object:Gem::Requirement
|
|
139
|
+
requirements:
|
|
140
|
+
- - "~>"
|
|
141
|
+
- !ruby/object:Gem::Version
|
|
142
|
+
version: '1.0'
|
|
143
|
+
- - ">="
|
|
144
|
+
- !ruby/object:Gem::Version
|
|
145
|
+
version: 1.0.4
|
|
146
|
+
type: :development
|
|
147
|
+
prerelease: false
|
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
149
|
+
requirements:
|
|
150
|
+
- - "~>"
|
|
151
|
+
- !ruby/object:Gem::Version
|
|
152
|
+
version: '1.0'
|
|
153
|
+
- - ">="
|
|
154
|
+
- !ruby/object:Gem::Version
|
|
155
|
+
version: 1.0.4
|
|
156
|
+
- !ruby/object:Gem::Dependency
|
|
157
|
+
name: anonymous_loader
|
|
158
|
+
requirement: !ruby/object:Gem::Requirement
|
|
159
|
+
requirements:
|
|
160
|
+
- - "~>"
|
|
161
|
+
- !ruby/object:Gem::Version
|
|
162
|
+
version: '0.1'
|
|
163
|
+
- - ">="
|
|
164
|
+
- !ruby/object:Gem::Version
|
|
165
|
+
version: 0.1.3
|
|
166
|
+
type: :development
|
|
167
|
+
prerelease: false
|
|
168
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
169
|
+
requirements:
|
|
170
|
+
- - "~>"
|
|
171
|
+
- !ruby/object:Gem::Version
|
|
172
|
+
version: '0.1'
|
|
173
|
+
- - ">="
|
|
174
|
+
- !ruby/object:Gem::Version
|
|
175
|
+
version: 0.1.3
|
|
176
|
+
- !ruby/object:Gem::Dependency
|
|
177
|
+
name: appraisal2
|
|
178
|
+
requirement: !ruby/object:Gem::Requirement
|
|
179
|
+
requirements:
|
|
180
|
+
- - "~>"
|
|
181
|
+
- !ruby/object:Gem::Version
|
|
182
|
+
version: '3.2'
|
|
183
|
+
- - ">="
|
|
184
|
+
- !ruby/object:Gem::Version
|
|
185
|
+
version: 3.2.0
|
|
186
|
+
type: :development
|
|
187
|
+
prerelease: false
|
|
188
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
189
|
+
requirements:
|
|
190
|
+
- - "~>"
|
|
191
|
+
- !ruby/object:Gem::Version
|
|
192
|
+
version: '3.2'
|
|
193
|
+
- - ">="
|
|
194
|
+
- !ruby/object:Gem::Version
|
|
195
|
+
version: 3.2.0
|
|
196
|
+
- !ruby/object:Gem::Dependency
|
|
197
|
+
name: kettle-test
|
|
198
|
+
requirement: !ruby/object:Gem::Requirement
|
|
199
|
+
requirements:
|
|
200
|
+
- - "~>"
|
|
201
|
+
- !ruby/object:Gem::Version
|
|
202
|
+
version: '2.0'
|
|
203
|
+
- - ">="
|
|
204
|
+
- !ruby/object:Gem::Version
|
|
205
|
+
version: 2.0.19
|
|
206
|
+
type: :development
|
|
207
|
+
prerelease: false
|
|
208
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
209
|
+
requirements:
|
|
210
|
+
- - "~>"
|
|
211
|
+
- !ruby/object:Gem::Version
|
|
212
|
+
version: '2.0'
|
|
213
|
+
- - ">="
|
|
214
|
+
- !ruby/object:Gem::Version
|
|
215
|
+
version: 2.0.19
|
|
216
|
+
- !ruby/object:Gem::Dependency
|
|
217
|
+
name: turbo_tests2
|
|
218
|
+
requirement: !ruby/object:Gem::Requirement
|
|
219
|
+
requirements:
|
|
220
|
+
- - "~>"
|
|
221
|
+
- !ruby/object:Gem::Version
|
|
222
|
+
version: '3.2'
|
|
223
|
+
- - ">="
|
|
224
|
+
- !ruby/object:Gem::Version
|
|
225
|
+
version: 3.2.4
|
|
226
|
+
type: :development
|
|
227
|
+
prerelease: false
|
|
228
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
229
|
+
requirements:
|
|
230
|
+
- - "~>"
|
|
231
|
+
- !ruby/object:Gem::Version
|
|
232
|
+
version: '3.2'
|
|
233
|
+
- - ">="
|
|
234
|
+
- !ruby/object:Gem::Version
|
|
235
|
+
version: 3.2.4
|
|
236
|
+
- !ruby/object:Gem::Dependency
|
|
237
|
+
name: ruby-progressbar
|
|
238
|
+
requirement: !ruby/object:Gem::Requirement
|
|
239
|
+
requirements:
|
|
240
|
+
- - "~>"
|
|
241
|
+
- !ruby/object:Gem::Version
|
|
242
|
+
version: '1.13'
|
|
243
|
+
type: :development
|
|
244
|
+
prerelease: false
|
|
245
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
246
|
+
requirements:
|
|
247
|
+
- - "~>"
|
|
248
|
+
- !ruby/object:Gem::Version
|
|
249
|
+
version: '1.13'
|
|
250
|
+
- !ruby/object:Gem::Dependency
|
|
251
|
+
name: stone_checksums
|
|
252
|
+
requirement: !ruby/object:Gem::Requirement
|
|
253
|
+
requirements:
|
|
254
|
+
- - "~>"
|
|
255
|
+
- !ruby/object:Gem::Version
|
|
256
|
+
version: '1.0'
|
|
257
|
+
- - ">="
|
|
258
|
+
- !ruby/object:Gem::Version
|
|
259
|
+
version: 1.0.8
|
|
260
|
+
type: :development
|
|
261
|
+
prerelease: false
|
|
262
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
263
|
+
requirements:
|
|
264
|
+
- - "~>"
|
|
265
|
+
- !ruby/object:Gem::Version
|
|
266
|
+
version: '1.0'
|
|
267
|
+
- - ">="
|
|
268
|
+
- !ruby/object:Gem::Version
|
|
269
|
+
version: 1.0.8
|
|
270
|
+
- !ruby/object:Gem::Dependency
|
|
271
|
+
name: gitmoji-regex
|
|
272
|
+
requirement: !ruby/object:Gem::Requirement
|
|
273
|
+
requirements:
|
|
274
|
+
- - "~>"
|
|
275
|
+
- !ruby/object:Gem::Version
|
|
276
|
+
version: '2.0'
|
|
277
|
+
- - ">="
|
|
278
|
+
- !ruby/object:Gem::Version
|
|
279
|
+
version: 2.0.11
|
|
280
|
+
type: :development
|
|
281
|
+
prerelease: false
|
|
282
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
283
|
+
requirements:
|
|
284
|
+
- - "~>"
|
|
285
|
+
- !ruby/object:Gem::Version
|
|
286
|
+
version: '2.0'
|
|
287
|
+
- - ">="
|
|
288
|
+
- !ruby/object:Gem::Version
|
|
289
|
+
version: 2.0.11
|
|
290
|
+
description: "☯️ Portable Rust module owner analysis and merge behavior for Structured
|
|
291
|
+
Merge."
|
|
70
292
|
email:
|
|
71
|
-
-
|
|
293
|
+
- floss@galtzo.com
|
|
72
294
|
executables: []
|
|
73
295
|
extensions: []
|
|
74
296
|
extra_rdoc_files: []
|
|
75
297
|
files:
|
|
298
|
+
- LICENSE.md
|
|
299
|
+
- README.md
|
|
76
300
|
- lib/rust-merge.rb
|
|
77
301
|
- lib/rust/merge.rb
|
|
78
302
|
- lib/rust/merge/version.rb
|
|
303
|
+
- sig/rust/merge.rbs
|
|
79
304
|
homepage: https://github.com/structuredmerge/structuredmerge-ruby
|
|
80
305
|
licenses:
|
|
81
306
|
- AGPL-3.0-only
|
|
82
307
|
- PolyForm-Small-Business-1.0.0
|
|
83
308
|
metadata:
|
|
84
309
|
homepage_uri: https://structuredmerge.org
|
|
85
|
-
source_code_uri: https://github.com/structuredmerge/structuredmerge-ruby/tree/v7.
|
|
86
|
-
changelog_uri: https://github.com/structuredmerge/structuredmerge-ruby/blob/v7.
|
|
310
|
+
source_code_uri: https://github.com/structuredmerge/structuredmerge-ruby/tree/v7.1.1
|
|
311
|
+
changelog_uri: https://github.com/structuredmerge/structuredmerge-ruby/blob/v7.1.1/CHANGELOG.md
|
|
87
312
|
bug_tracker_uri: https://github.com/structuredmerge/structuredmerge-ruby/issues
|
|
88
|
-
documentation_uri: https://www.rubydoc.info/gems/rust-merge/7.
|
|
313
|
+
documentation_uri: https://www.rubydoc.info/gems/rust-merge/7.1.1
|
|
89
314
|
funding_uri: https://github.com/sponsors/pboling
|
|
90
315
|
wiki_uri: https://github.com/structuredmerge/structuredmerge-ruby/wiki
|
|
316
|
+
news_uri: https://www.railsbling.com/tags/rust-merge
|
|
91
317
|
discord_uri: https://discord.gg/3qme4XHNKN
|
|
318
|
+
mailing_list_uri: https://www.rubyforum.org/tag/structuredmerge
|
|
92
319
|
rubygems_mfa_required: 'true'
|
|
93
|
-
rdoc_options:
|
|
320
|
+
rdoc_options:
|
|
321
|
+
- "--title"
|
|
322
|
+
- rust-merge - ☯️ Structured Merge Rust module analysis and merge for Ruby
|
|
323
|
+
- "--main"
|
|
324
|
+
- README.md
|
|
325
|
+
- "--exclude"
|
|
326
|
+
- "^sig/"
|
|
327
|
+
- "--line-numbers"
|
|
328
|
+
- "--inline-source"
|
|
329
|
+
- "--quiet"
|
|
94
330
|
require_paths:
|
|
95
331
|
- lib
|
|
96
332
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
@@ -104,7 +340,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
104
340
|
- !ruby/object:Gem::Version
|
|
105
341
|
version: '0'
|
|
106
342
|
requirements: []
|
|
107
|
-
rubygems_version: 4.0.
|
|
343
|
+
rubygems_version: 4.0.17
|
|
108
344
|
specification_version: 4
|
|
109
|
-
summary: Structured Merge Rust module analysis and merge for Ruby
|
|
345
|
+
summary: "☯️ Structured Merge Rust module analysis and merge for Ruby"
|
|
110
346
|
test_files: []
|
metadata.gz.sig
CHANGED
|
Binary file
|