yaml-merge 7.1.1 → 7.1.3
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/README.md +2 -10
- data/lib/yaml/merge/provider.rb +78 -0
- data/lib/yaml/merge/version.rb +1 -1
- data/lib/yaml/merge.rb +5 -29
- data/sig/yaml/merge.rbs +13 -0
- data.tar.gz.sig +3 -3
- metadata +31 -16
- 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: 861dc2bba17b21e44e3e46b947e458d7e5114c376f1076648cf14f15793e9a7d
|
|
4
|
+
data.tar.gz: 246f068f78244935250454a8f5c4ca38e1735286f48252f17f023083aaeedb0e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d87a3509a72a8c7ab1d37e098ff47bd689d1c600228e740cca1dd08565062b17e978d8ffb985d74ef4037227354cf9e75b11f84a392fc672ac97ada2bd11bb29
|
|
7
|
+
data.tar.gz: 49e729482712daec1b3a62fd3851d4e91a728bbeed26ec5af4533adf1c8a7bc1a5f155700099a0fe6ddbf526ab7d059ea738b7d8b79cd946141e7f9652206e64
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/README.md
CHANGED
|
@@ -57,7 +57,7 @@ ranges, comments, and edit plans rather than native Ruby Hash/Array round-trips.
|
|
|
57
57
|
|
|
58
58
|
### Compatibility
|
|
59
59
|
|
|
60
|
-
Compatible with MRI Ruby 4.0.0+,
|
|
60
|
+
Compatible with MRI Ruby 4.0.0+, JRuby, and TruffleRuby.
|
|
61
61
|
CI workflows and Appraisals are generated for MRI Ruby 4.0.0+.
|
|
62
62
|
This test floor is configured by `ruby.test_minimum` in `.kettle-jem.yml` and
|
|
63
63
|
may be higher than the gem's runtime compatibility floor when legacy Rubies are
|
|
@@ -132,20 +132,12 @@ See [SECURITY.md][🔐security].
|
|
|
132
132
|
## 🤝 Contributing
|
|
133
133
|
|
|
134
134
|
If you need some ideas of where to help, you could work on adding more code coverage,
|
|
135
|
-
|
|
136
|
-
or use the gem and think about how it could be better.
|
|
135
|
+
check [issues][🤝gh-issues] or [PRs][🤝gh-pulls], or use the gem and think about how it could be better.
|
|
137
136
|
|
|
138
137
|
We [![Keep A Changelog][📗keep-changelog-img]][📗keep-changelog] so if you make changes, remember to update it.
|
|
139
138
|
|
|
140
139
|
See [CONTRIBUTING.md][🤝contributing] for more detailed instructions.
|
|
141
140
|
|
|
142
|
-
### Code Coverage
|
|
143
|
-
|
|
144
|
-
<details markdown="1">
|
|
145
|
-
<summary>Coverage service badges</summary>
|
|
146
|
-
|
|
147
|
-
</details>
|
|
148
|
-
|
|
149
141
|
## 📌 Versioning
|
|
150
142
|
|
|
151
143
|
This library follows [![Semantic Versioning 2.0.0][📌semver-img]][📌semver] for its public API where practical.
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Yaml
|
|
4
|
+
# Portable YAML workflow integration.
|
|
5
|
+
module Merge
|
|
6
|
+
# YAML workflow selector delegating source-preserving operations to Psych.
|
|
7
|
+
class Provider
|
|
8
|
+
BACKEND = :'kreuzberg-language-pack'
|
|
9
|
+
DELEGATED_BACKEND = :psych
|
|
10
|
+
DELEGATED_PROVIDER_ID = 'ruby.yaml.psych'
|
|
11
|
+
DEFAULT_PROFILE = :source_preserving
|
|
12
|
+
|
|
13
|
+
def provider_id = 'ruby.yaml'
|
|
14
|
+
def family = 'yaml'
|
|
15
|
+
|
|
16
|
+
def capabilities
|
|
17
|
+
{
|
|
18
|
+
operations: Ast::Merge::ProviderContract::OPERATIONS,
|
|
19
|
+
dialects: %i[yaml],
|
|
20
|
+
backends: [BACKEND],
|
|
21
|
+
profiles: [DEFAULT_PROFILE],
|
|
22
|
+
role: :workflow,
|
|
23
|
+
source_preservation: Psych::Merge.merge_provider.capabilities.fetch(:source_preservation)
|
|
24
|
+
}.freeze
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
Ast::Merge::ProviderContract::OPERATIONS.each do |operation|
|
|
28
|
+
define_method(operation) do |request|
|
|
29
|
+
delegated = Ast::Merge.dispatch_provider(operation, delegated_request(request))
|
|
30
|
+
delegated.merge(provider: workflow_identity(request, delegated))
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
private
|
|
35
|
+
|
|
36
|
+
def delegated_request(request)
|
|
37
|
+
request.merge(
|
|
38
|
+
provider_id: DELEGATED_PROVIDER_ID,
|
|
39
|
+
family: :yaml,
|
|
40
|
+
dialect: :yaml,
|
|
41
|
+
backend: DELEGATED_BACKEND,
|
|
42
|
+
profile_id: DEFAULT_PROFILE
|
|
43
|
+
)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def workflow_identity(request, delegated)
|
|
47
|
+
{
|
|
48
|
+
provider_id: provider_id,
|
|
49
|
+
family: family,
|
|
50
|
+
dialect: request[:dialect] || :yaml,
|
|
51
|
+
backend: request[:backend] || BACKEND,
|
|
52
|
+
package: PACKAGE_NAME,
|
|
53
|
+
package_version: Yaml::Merge::Version::VERSION,
|
|
54
|
+
delegated_provider: delegated_identity(delegated.fetch(:provider))
|
|
55
|
+
}
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def delegated_identity(identity)
|
|
59
|
+
{
|
|
60
|
+
provider_id: identity.fetch(:provider_id),
|
|
61
|
+
backend: identity.fetch(:backend),
|
|
62
|
+
package: identity[:package],
|
|
63
|
+
package_version: identity[:package_version]
|
|
64
|
+
}.compact
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
class << self
|
|
69
|
+
def merge_provider
|
|
70
|
+
@merge_provider ||= Provider.new
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def register_provider!(replace: false)
|
|
74
|
+
Ast::Merge.register_provider(merge_provider, replace: replace)
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
end
|
data/lib/yaml/merge/version.rb
CHANGED
|
@@ -5,7 +5,7 @@ module Yaml
|
|
|
5
5
|
# Version namespace for this gem.
|
|
6
6
|
module Version
|
|
7
7
|
# Current gem version.
|
|
8
|
-
VERSION = '7.1.
|
|
8
|
+
VERSION = '7.1.3'
|
|
9
9
|
end
|
|
10
10
|
# Current gem version exposed at the traditional constant location.
|
|
11
11
|
VERSION = Version::VERSION # Traditional Constant Location
|
data/lib/yaml/merge.rb
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
require 'json'
|
|
4
4
|
require 'tree_haver'
|
|
5
5
|
require 'ast/merge'
|
|
6
|
+
require 'psych/merge'
|
|
6
7
|
require_relative 'merge/version'
|
|
7
8
|
|
|
8
9
|
module Yaml
|
|
@@ -98,38 +99,11 @@ module Yaml
|
|
|
98
99
|
end
|
|
99
100
|
|
|
100
101
|
def analyze_yaml_document(parsed, dialect)
|
|
101
|
-
|
|
102
|
-
return parse_error_result('YAML documents must parse to a mapping root.') unless parsed.is_a?(Hash)
|
|
103
|
-
|
|
104
|
-
validated = validate_yaml_node(parsed, '')
|
|
105
|
-
return { ok: false, diagnostics: [validated[:diagnostic]], policies: [] } unless validated[:ok]
|
|
106
|
-
|
|
107
|
-
{
|
|
108
|
-
ok: true,
|
|
109
|
-
diagnostics: [],
|
|
110
|
-
analysis: {
|
|
111
|
-
kind: 'yaml',
|
|
112
|
-
dialect: 'yaml',
|
|
113
|
-
normalized_source: canonical_yaml(validated[:value]),
|
|
114
|
-
document: validated[:value],
|
|
115
|
-
root_kind: 'mapping',
|
|
116
|
-
owners: collect_yaml_owners(validated[:value])
|
|
117
|
-
},
|
|
118
|
-
policies: []
|
|
119
|
-
}
|
|
102
|
+
Ast::Merge::YamlDocument.analyze(parsed, dialect)
|
|
120
103
|
end
|
|
121
104
|
|
|
122
105
|
def match_yaml_owners(template, destination)
|
|
123
|
-
|
|
124
|
-
template_paths = template[:owners].to_h { |owner| [owner[:path], true] }
|
|
125
|
-
|
|
126
|
-
{
|
|
127
|
-
matched: template[:owners]
|
|
128
|
-
.filter { |owner| destination_paths[owner[:path]] }
|
|
129
|
-
.map { |owner| { template_path: owner[:path], destination_path: owner[:path] } },
|
|
130
|
-
unmatched_template: template[:owners].map { |owner| owner[:path] }.reject { |path| destination_paths[path] },
|
|
131
|
-
unmatched_destination: destination[:owners].map { |owner| owner[:path] }.reject { |path| template_paths[path] }
|
|
132
|
-
}
|
|
106
|
+
Ast::Merge::YamlDocument.match_owners(template, destination)
|
|
133
107
|
end
|
|
134
108
|
|
|
135
109
|
def merge_yaml(template_source, destination_source, dialect, backend: nil)
|
|
@@ -482,3 +456,5 @@ module Yaml
|
|
|
482
456
|
end
|
|
483
457
|
|
|
484
458
|
Yaml::Merge.register_backend!
|
|
459
|
+
require_relative 'merge/provider'
|
|
460
|
+
Yaml::Merge.register_provider!
|
data/sig/yaml/merge.rbs
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
module Yaml
|
|
2
2
|
module Merge
|
|
3
|
+
class Provider
|
|
4
|
+
def provider_id: () -> String
|
|
5
|
+
def family: () -> String
|
|
6
|
+
def capabilities: () -> Hash[Symbol, untyped]
|
|
7
|
+
def analyze: (Hash[Symbol, untyped] request) -> Hash[Symbol, untyped]
|
|
8
|
+
def diff2: (Hash[Symbol, untyped] request) -> Hash[Symbol, untyped]
|
|
9
|
+
def merge2: (Hash[Symbol, untyped] request) -> Hash[Symbol, untyped]
|
|
10
|
+
def merge3: (Hash[Symbol, untyped] request) -> Hash[Symbol, untyped]
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def self.merge_provider: () -> Provider
|
|
14
|
+
def self.register_provider!: (?replace: bool) -> untyped
|
|
15
|
+
|
|
3
16
|
module Version
|
|
4
17
|
VERSION: String
|
|
5
18
|
end
|
data.tar.gz.sig
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
���
|
|
2
|
-
|
|
3
|
-
�
|
|
1
|
+
fU���t�����B�[٤��
|
|
2
|
+
B�L���4�_b�i"B�<r2C� [��5�`�'&�����9�&���OjV!��@+�����=�[��(������gc]�9l�SQ�S)���s���<�B6>xK��m^�����Io�+�b+�k1� ����$/��JYz��W���*��{K�e���a��tV�8cn�$��j������~4I��|�,�:r�h�P�35�����+��'x�g����-��1v���M����<*��鬶�]Q�cA=���N�P� -2Q]��'L��f��T4���<ӭ���H������L6��$�0C� �5�j���_�U���
|
|
3
|
+
���\�U���qH��&b�E�|憰��y#D�
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: yaml-merge
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 7.1.
|
|
4
|
+
version: 7.1.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Peter H. Boling
|
|
@@ -43,28 +43,42 @@ dependencies:
|
|
|
43
43
|
requirements:
|
|
44
44
|
- - '='
|
|
45
45
|
- !ruby/object:Gem::Version
|
|
46
|
-
version: 7.1.
|
|
46
|
+
version: 7.1.3
|
|
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.1.
|
|
53
|
+
version: 7.1.3
|
|
54
|
+
- !ruby/object:Gem::Dependency
|
|
55
|
+
name: psych-merge
|
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
|
57
|
+
requirements:
|
|
58
|
+
- - '='
|
|
59
|
+
- !ruby/object:Gem::Version
|
|
60
|
+
version: 7.1.3
|
|
61
|
+
type: :runtime
|
|
62
|
+
prerelease: false
|
|
63
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
64
|
+
requirements:
|
|
65
|
+
- - '='
|
|
66
|
+
- !ruby/object:Gem::Version
|
|
67
|
+
version: 7.1.3
|
|
54
68
|
- !ruby/object:Gem::Dependency
|
|
55
69
|
name: tree_haver
|
|
56
70
|
requirement: !ruby/object:Gem::Requirement
|
|
57
71
|
requirements:
|
|
58
72
|
- - '='
|
|
59
73
|
- !ruby/object:Gem::Version
|
|
60
|
-
version: 7.1.
|
|
74
|
+
version: 7.1.3
|
|
61
75
|
type: :runtime
|
|
62
76
|
prerelease: false
|
|
63
77
|
version_requirements: !ruby/object:Gem::Requirement
|
|
64
78
|
requirements:
|
|
65
79
|
- - '='
|
|
66
80
|
- !ruby/object:Gem::Version
|
|
67
|
-
version: 7.1.
|
|
81
|
+
version: 7.1.3
|
|
68
82
|
- !ruby/object:Gem::Dependency
|
|
69
83
|
name: version_gem
|
|
70
84
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -91,20 +105,20 @@ dependencies:
|
|
|
91
105
|
requirements:
|
|
92
106
|
- - "~>"
|
|
93
107
|
- !ruby/object:Gem::Version
|
|
94
|
-
version: '
|
|
108
|
+
version: '3.0'
|
|
95
109
|
- - ">="
|
|
96
110
|
- !ruby/object:Gem::Version
|
|
97
|
-
version:
|
|
111
|
+
version: 3.0.0
|
|
98
112
|
type: :development
|
|
99
113
|
prerelease: false
|
|
100
114
|
version_requirements: !ruby/object:Gem::Requirement
|
|
101
115
|
requirements:
|
|
102
116
|
- - "~>"
|
|
103
117
|
- !ruby/object:Gem::Version
|
|
104
|
-
version: '
|
|
118
|
+
version: '3.0'
|
|
105
119
|
- - ">="
|
|
106
120
|
- !ruby/object:Gem::Version
|
|
107
|
-
version:
|
|
121
|
+
version: 3.0.0
|
|
108
122
|
- !ruby/object:Gem::Dependency
|
|
109
123
|
name: bundler-audit
|
|
110
124
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -182,7 +196,7 @@ dependencies:
|
|
|
182
196
|
version: '3.2'
|
|
183
197
|
- - ">="
|
|
184
198
|
- !ruby/object:Gem::Version
|
|
185
|
-
version: 3.2.
|
|
199
|
+
version: 3.2.2
|
|
186
200
|
type: :development
|
|
187
201
|
prerelease: false
|
|
188
202
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -192,7 +206,7 @@ dependencies:
|
|
|
192
206
|
version: '3.2'
|
|
193
207
|
- - ">="
|
|
194
208
|
- !ruby/object:Gem::Version
|
|
195
|
-
version: 3.2.
|
|
209
|
+
version: 3.2.2
|
|
196
210
|
- !ruby/object:Gem::Dependency
|
|
197
211
|
name: kettle-test
|
|
198
212
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -222,7 +236,7 @@ dependencies:
|
|
|
222
236
|
version: '3.2'
|
|
223
237
|
- - ">="
|
|
224
238
|
- !ruby/object:Gem::Version
|
|
225
|
-
version: 3.2.
|
|
239
|
+
version: 3.2.5
|
|
226
240
|
type: :development
|
|
227
241
|
prerelease: false
|
|
228
242
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -232,7 +246,7 @@ dependencies:
|
|
|
232
246
|
version: '3.2'
|
|
233
247
|
- - ">="
|
|
234
248
|
- !ruby/object:Gem::Version
|
|
235
|
-
version: 3.2.
|
|
249
|
+
version: 3.2.5
|
|
236
250
|
- !ruby/object:Gem::Dependency
|
|
237
251
|
name: ruby-progressbar
|
|
238
252
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -304,6 +318,7 @@ files:
|
|
|
304
318
|
- lib/yaml/merge/file_analysis.rb
|
|
305
319
|
- lib/yaml/merge/merge_result.rb
|
|
306
320
|
- lib/yaml/merge/node_wrapper.rb
|
|
321
|
+
- lib/yaml/merge/provider.rb
|
|
307
322
|
- lib/yaml/merge/smart_merger.rb
|
|
308
323
|
- lib/yaml/merge/version.rb
|
|
309
324
|
- sig/yaml/merge.rbs
|
|
@@ -313,10 +328,10 @@ licenses:
|
|
|
313
328
|
- PolyForm-Small-Business-1.0.0
|
|
314
329
|
metadata:
|
|
315
330
|
homepage_uri: https://structuredmerge.org
|
|
316
|
-
source_code_uri: https://github.com/structuredmerge/structuredmerge-ruby/tree/v7.1.
|
|
317
|
-
changelog_uri: https://github.com/structuredmerge/structuredmerge-ruby/blob/v7.1.
|
|
331
|
+
source_code_uri: https://github.com/structuredmerge/structuredmerge-ruby/tree/v7.1.3
|
|
332
|
+
changelog_uri: https://github.com/structuredmerge/structuredmerge-ruby/blob/v7.1.3/CHANGELOG.md
|
|
318
333
|
bug_tracker_uri: https://github.com/structuredmerge/structuredmerge-ruby/issues
|
|
319
|
-
documentation_uri: https://www.rubydoc.info/gems/yaml-merge/7.1.
|
|
334
|
+
documentation_uri: https://www.rubydoc.info/gems/yaml-merge/7.1.3
|
|
320
335
|
funding_uri: https://github.com/sponsors/pboling
|
|
321
336
|
wiki_uri: https://github.com/structuredmerge/structuredmerge-ruby/wiki
|
|
322
337
|
news_uri: https://www.railsbling.com/tags/yaml-merge
|
metadata.gz.sig
CHANGED
|
Binary file
|