psych-merge 7.1.11 → 7.1.13
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/lib/psych/merge/file_analysis.rb +78 -0
- data/lib/psych/merge/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +10 -10
- 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: 320cdcce004fbc0446fc6f71614f8b7b11c75887ab4e60c63b1b9836c7b4f6a5
|
|
4
|
+
data.tar.gz: bfc74c41ba5910d183319c7465846e4421df0e8e11027374388f198a5901deef
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5e006acf817d9f8e426658e3791279814f85674b765109d7adf37f55a8e9e9809aef5d7d43b2bf90ecfc8e8f39116ac206ee444c91a0d340a4ea4af44f7eced8
|
|
7
|
+
data.tar.gz: 5ebf449ba1e64dda87a3d32ec244ac3cf8b07cf30c1bb476a8b29181e73176520f0a17ef4bf5d83609ba655f2d6f157ec50d3c8203a72383a21773de69fe057d
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
|
@@ -194,6 +194,42 @@ module Psych
|
|
|
194
194
|
wrap_root_node(root)
|
|
195
195
|
end
|
|
196
196
|
|
|
197
|
+
# Return each nested YAML mapping/sequence's direct structural owners as
|
|
198
|
+
# its own sibling group. Keeping groups separate is essential: layout
|
|
199
|
+
# gaps are meaningful only relative to siblings with the same parent.
|
|
200
|
+
#
|
|
201
|
+
# @return [Array<Array<NodeWrapper>>]
|
|
202
|
+
def structural_owner_groups
|
|
203
|
+
@structural_owner_groups ||= begin
|
|
204
|
+
root = root_node
|
|
205
|
+
groups = []
|
|
206
|
+
@structural_owner_metadata = {}
|
|
207
|
+
collect_structural_owner_groups(root, [], groups) if root
|
|
208
|
+
groups
|
|
209
|
+
end
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
# Metadata describing a wrapper's parent-level structural ownership.
|
|
213
|
+
#
|
|
214
|
+
# @param owner [NodeWrapper]
|
|
215
|
+
# @return [Hash, nil]
|
|
216
|
+
def structural_owner_metadata_for(owner)
|
|
217
|
+
structural_owner_groups
|
|
218
|
+
@structural_owner_metadata[owner.object_id]
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
# Return a layout attachment calculated against the owner's actual YAML
|
|
222
|
+
# siblings, including nested mapping values and sequence items.
|
|
223
|
+
#
|
|
224
|
+
# @param owner [NodeWrapper] structural YAML owner
|
|
225
|
+
# @return [Ast::Merge::Layout::Attachment]
|
|
226
|
+
def layout_attachment_for(owner, **options)
|
|
227
|
+
siblings = structural_owner_groups.find { |group| group.any? { |candidate| candidate.equal?(owner) } }
|
|
228
|
+
return super unless siblings
|
|
229
|
+
|
|
230
|
+
structural_layout_attachment_for(owner, siblings, **options)
|
|
231
|
+
end
|
|
232
|
+
|
|
197
233
|
# Build a passive shared comment attachment for an owner.
|
|
198
234
|
#
|
|
199
235
|
# @param owner [Object] Structural owner for the attachment
|
|
@@ -233,6 +269,48 @@ module Psych
|
|
|
233
269
|
end
|
|
234
270
|
|
|
235
271
|
private
|
|
272
|
+
def structural_layout_attachment_for(owner, siblings, **options)
|
|
273
|
+
custom_end_line_for = options.key?(:end_line_for)
|
|
274
|
+
end_line_for = options.delete(:end_line_for) { method(:structural_layout_end_line_for) }
|
|
275
|
+
return layout_augmenter(owners: siblings, end_line_for: end_line_for, **options).attachment_for(owner) if
|
|
276
|
+
custom_end_line_for || !options.empty?
|
|
277
|
+
|
|
278
|
+
@structural_layout_augmenters ||= {}.compare_by_identity
|
|
279
|
+
augmenter = @structural_layout_augmenters[siblings] ||=
|
|
280
|
+
layout_augmenter(owners: siblings, end_line_for: end_line_for)
|
|
281
|
+
augmenter.attachment_for(owner)
|
|
282
|
+
end
|
|
283
|
+
|
|
284
|
+
def structural_layout_end_line_for(candidate)
|
|
285
|
+
end_line = candidate.node.end_line
|
|
286
|
+
end_line -= 1 while end_line > candidate.start_line && lines[end_line - 1].to_s.strip.empty?
|
|
287
|
+
end_line
|
|
288
|
+
end
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
def collect_structural_owner_groups(wrapper, parent_path, groups)
|
|
292
|
+
return unless wrapper
|
|
293
|
+
|
|
294
|
+
group_kind, children = if wrapper.mapping?
|
|
295
|
+
[:mapping_entry, wrapper.mapping_entries(comment_tracker: @comment_tracker).map(&:last)]
|
|
296
|
+
elsif wrapper.sequence?
|
|
297
|
+
[:sequence_item, wrapper.sequence_items(comment_tracker: @comment_tracker)]
|
|
298
|
+
else
|
|
299
|
+
[nil, []]
|
|
300
|
+
end
|
|
301
|
+
return if children.empty?
|
|
302
|
+
|
|
303
|
+
groups << children
|
|
304
|
+
children.each_with_index do |child, index|
|
|
305
|
+
path = if group_kind == :mapping_entry
|
|
306
|
+
parent_path + [child.key.to_s]
|
|
307
|
+
else
|
|
308
|
+
parent_path + [index]
|
|
309
|
+
end
|
|
310
|
+
@structural_owner_metadata[child.object_id] = { kind: group_kind, index: (index if group_kind == :sequence_item), path: path.freeze }
|
|
311
|
+
collect_structural_owner_groups(child, path, groups)
|
|
312
|
+
end
|
|
313
|
+
end
|
|
236
314
|
|
|
237
315
|
def mapping_entry_attachment(owner)
|
|
238
316
|
augmenter_attachment = comment_augmenter(owners: [owner]).attachment_for(owner)
|
data/lib/psych/merge/version.rb
CHANGED
|
@@ -5,7 +5,7 @@ module Psych
|
|
|
5
5
|
# Version namespace for this gem.
|
|
6
6
|
module Version
|
|
7
7
|
# Current gem version.
|
|
8
|
-
VERSION = '7.1.
|
|
8
|
+
VERSION = '7.1.13'
|
|
9
9
|
end
|
|
10
10
|
# Current gem version exposed at the traditional constant location.
|
|
11
11
|
VERSION = Version::VERSION # Traditional Constant Location
|
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: psych-merge
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 7.1.
|
|
4
|
+
version: 7.1.13
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Peter H. Boling
|
|
@@ -43,28 +43,28 @@ dependencies:
|
|
|
43
43
|
requirements:
|
|
44
44
|
- - '='
|
|
45
45
|
- !ruby/object:Gem::Version
|
|
46
|
-
version: 7.1.
|
|
46
|
+
version: 7.1.13
|
|
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.13
|
|
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.1.
|
|
60
|
+
version: 7.1.13
|
|
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.1.
|
|
67
|
+
version: 7.1.13
|
|
68
68
|
- !ruby/object:Gem::Dependency
|
|
69
69
|
name: version_gem
|
|
70
70
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -91,14 +91,14 @@ dependencies:
|
|
|
91
91
|
requirements:
|
|
92
92
|
- - '='
|
|
93
93
|
- !ruby/object:Gem::Version
|
|
94
|
-
version: 7.1.
|
|
94
|
+
version: 7.1.13
|
|
95
95
|
type: :runtime
|
|
96
96
|
prerelease: false
|
|
97
97
|
version_requirements: !ruby/object:Gem::Requirement
|
|
98
98
|
requirements:
|
|
99
99
|
- - '='
|
|
100
100
|
- !ruby/object:Gem::Version
|
|
101
|
-
version: 7.1.
|
|
101
|
+
version: 7.1.13
|
|
102
102
|
- !ruby/object:Gem::Dependency
|
|
103
103
|
name: kettle-dev
|
|
104
104
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -338,10 +338,10 @@ licenses:
|
|
|
338
338
|
- PolyForm-Small-Business-1.0.0
|
|
339
339
|
metadata:
|
|
340
340
|
homepage_uri: https://structuredmerge.org
|
|
341
|
-
source_code_uri: https://github.com/structuredmerge/structuredmerge-ruby/tree/v7.1.
|
|
342
|
-
changelog_uri: https://github.com/structuredmerge/structuredmerge-ruby/blob/v7.1.
|
|
341
|
+
source_code_uri: https://github.com/structuredmerge/structuredmerge-ruby/tree/v7.1.13
|
|
342
|
+
changelog_uri: https://github.com/structuredmerge/structuredmerge-ruby/blob/v7.1.13/CHANGELOG.md
|
|
343
343
|
bug_tracker_uri: https://github.com/structuredmerge/structuredmerge-ruby/issues
|
|
344
|
-
documentation_uri: https://www.rubydoc.info/gems/psych-merge/7.1.
|
|
344
|
+
documentation_uri: https://www.rubydoc.info/gems/psych-merge/7.1.13
|
|
345
345
|
funding_uri: https://github.com/sponsors/pboling
|
|
346
346
|
wiki_uri: https://github.com/structuredmerge/structuredmerge-ruby/wiki
|
|
347
347
|
news_uri: https://www.railsbling.com/tags/psych-merge
|
metadata.gz.sig
CHANGED
|
Binary file
|