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