bundler 4.1.0.beta3 → 4.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
- data/bundler.gemspec +5 -3
- data/lib/bundler/build_metadata.rb +2 -2
- data/lib/bundler/checksum.rb +17 -2
- data/lib/bundler/cli/clean.rb +19 -3
- data/lib/bundler/cli/exec.rb +1 -1
- data/lib/bundler/cli/install.rb +1 -1
- data/lib/bundler/cli/lock.rb +12 -0
- data/lib/bundler/cli/outdated.rb +1 -4
- data/lib/bundler/cli/update.rb +1 -1
- data/lib/bundler/cli.rb +2 -0
- data/lib/bundler/definition.rb +152 -7
- data/lib/bundler/dependency.rb +17 -2
- data/lib/bundler/dsl.rb +9 -2
- data/lib/bundler/errors.rb +8 -0
- data/lib/bundler/fetcher/downloader.rb +7 -3
- data/lib/bundler/index.rb +7 -2
- data/lib/bundler/injector.rb +1 -1
- data/lib/bundler/inline.rb +19 -9
- data/lib/bundler/installer.rb +19 -0
- data/lib/bundler/lazy_specification.rb +46 -25
- data/lib/bundler/lockfile_generator.rb +21 -9
- data/lib/bundler/lockfile_parser.rb +21 -5
- data/lib/bundler/man/bundle-lock.1 +8 -2
- data/lib/bundler/man/bundle-lock.1.ronn +15 -1
- data/lib/bundler/man/bundle-plugin.1 +61 -0
- data/lib/bundler/man/bundle-plugin.1.ronn +84 -0
- data/lib/bundler/man/gemfile.5 +3 -1
- data/lib/bundler/man/gemfile.5.ronn +11 -3
- data/lib/bundler/match_platform.rb +3 -3
- data/lib/bundler/match_remote_metadata.rb +6 -0
- data/lib/bundler/mirror.rb +7 -5
- data/lib/bundler/plugin/index.rb +14 -11
- data/lib/bundler/remote_specification.rb +5 -0
- data/lib/bundler/resolver/candidate.rb +5 -0
- data/lib/bundler/resolver.rb +89 -7
- data/lib/bundler/ruby_dsl.rb +2 -1
- data/lib/bundler/rubygems_ext.rb +54 -9
- data/lib/bundler/rubygems_integration.rb +2 -4
- data/lib/bundler/runtime.rb +29 -11
- data/lib/bundler/settings.rb +2 -3
- data/lib/bundler/source/git/git_proxy.rb +18 -6
- data/lib/bundler/source/git.rb +0 -2
- data/lib/bundler/spec_set.rb +54 -14
- data/lib/bundler/stub_specification.rb +4 -0
- data/lib/bundler/vendored_securerandom.rb +5 -2
- data/lib/bundler/vendored_uri.rb +18 -3
- data/lib/bundler/version.rb +1 -1
- data/lib/bundler/worker.rb +4 -0
- data/lib/bundler.rb +1 -1
- data/lib/rubygems/compact_index_client/http_fetcher.rb +3 -1
- data/lib/rubygems/vendor/pub_grub/lib/pub_grub/term.rb +1 -1
- data/lib/rubygems/yaml_serializer/builder.rb +261 -0
- data/lib/rubygems/yaml_serializer/core.rb +41 -0
- data/lib/rubygems/yaml_serializer/emitter.rb +197 -0
- data/lib/rubygems/yaml_serializer/nodes.rb +10 -0
- data/lib/rubygems/yaml_serializer/parser.rb +531 -0
- data/lib/rubygems/yaml_serializer/psych_errors.rb +11 -0
- metadata +8 -4
- data/lib/rubygems/vendor/uri/lib/uri.rb +0 -108
- data/lib/rubygems/yaml_serializer.rb +0 -908
|
@@ -0,0 +1,531 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Gem
|
|
4
|
+
module YAMLSerializer
|
|
5
|
+
class Parser
|
|
6
|
+
# A plain (unquoted) mapping key followed by ":". "#" inside a key is
|
|
7
|
+
# literal unless preceded by a space (which would start a comment).
|
|
8
|
+
# Like Psych, spaces and tabs may separate the ":" from the value.
|
|
9
|
+
MAPPING_KEY_RE = /\G((?:[^#:\s]|:[^ \t])(?:[^#:]|:[^ \t]|(?<=[^ ])#)*):(?:[ \t]+(.*))?$/
|
|
10
|
+
# A quoted mapping key followed by ":". A whole-line quoted scalar
|
|
11
|
+
# cannot match because its closing quote is at the end of the line.
|
|
12
|
+
QUOTED_KEY_RE = /\G("(?:[^"\\]|\\.)*"|'(?:[^']|'')*'):(?:[ \t]+(.*))?$/
|
|
13
|
+
# An entry of a flow sequence. A quoted entry may contain commas.
|
|
14
|
+
FLOW_SEQUENCE_ENTRY_RE = /"(?:[^"\\]|\\.)*"|'(?:[^']|'')*'|[^,\s](?:[^,]*[^,\s])?/
|
|
15
|
+
SEQUENCE_ENTRY_RE = /\G-(?: |\z)/
|
|
16
|
+
# A quoted scalar whose closing quote is on a later line.
|
|
17
|
+
OPEN_QUOTED_RE = /\A(?:! )?(?:"(?>(?:[^"\\]|\\.)*)(\\)?|'(?>(?:[^']|'')*))\z/
|
|
18
|
+
RUBY_OBJECT_TAG_RE = %r{\G!ruby/object:}
|
|
19
|
+
LSTRIP_BYTES = [0, 9, 10, 11, 12, 13, 32].freeze
|
|
20
|
+
UTF8_BOM_BYTES = [0xEF, 0xBB, 0xBF].freeze
|
|
21
|
+
MAX_NESTING_DEPTH = 1_000
|
|
22
|
+
NULL_SCALARS = %w[~ null].freeze
|
|
23
|
+
BLANK_RE = /\A[\0\s]*\z/
|
|
24
|
+
BLANK_OR_COMMENT_RE = /\A[\0\s]*(?:#|\z)/
|
|
25
|
+
DOCUMENT_END_RE = /\A\.\.\.(?:[ \t]|\z)/
|
|
26
|
+
DOCUMENT_START_RE = /\A---(?:[ \t]|\z)/
|
|
27
|
+
|
|
28
|
+
STRING_UNESCAPES = {
|
|
29
|
+
"\\\\" => "\\",
|
|
30
|
+
"\\\"" => "\"",
|
|
31
|
+
"\\ " => " ",
|
|
32
|
+
"\\0" => "\0",
|
|
33
|
+
"\\a" => "\a",
|
|
34
|
+
"\\b" => "\b",
|
|
35
|
+
"\\t" => "\t",
|
|
36
|
+
"\\n" => "\n",
|
|
37
|
+
"\\v" => "\v",
|
|
38
|
+
"\\f" => "\f",
|
|
39
|
+
"\\r" => "\r",
|
|
40
|
+
"\\e" => "\e",
|
|
41
|
+
"\\N" => "\u0085",
|
|
42
|
+
"\\_" => "\u00A0",
|
|
43
|
+
"\\L" => "\u2028",
|
|
44
|
+
"\\P" => "\u2029",
|
|
45
|
+
}.freeze
|
|
46
|
+
|
|
47
|
+
def initialize(source)
|
|
48
|
+
raise TypeError, "no implicit conversion of nil into String" if source.nil?
|
|
49
|
+
|
|
50
|
+
source = strip_bom(source)
|
|
51
|
+
# Keep trailing empty lines, which a block scalar with keep chomping
|
|
52
|
+
# ("|+") preserves, but not the empty string after the final line
|
|
53
|
+
# break.
|
|
54
|
+
@lines = source.split(/\r?\n/, -1)
|
|
55
|
+
@lines.pop if @lines.last == ""
|
|
56
|
+
@lines.each(&:freeze)
|
|
57
|
+
@anchors = {}
|
|
58
|
+
@depth = 0
|
|
59
|
+
strip_document_end
|
|
60
|
+
strip_extra_documents
|
|
61
|
+
strip_document_prefix
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def parse
|
|
65
|
+
return nil if @lines.empty?
|
|
66
|
+
|
|
67
|
+
root = nil
|
|
68
|
+
while @lines.any?
|
|
69
|
+
before = @lines.size
|
|
70
|
+
node = parse_node(-1)
|
|
71
|
+
@lines.shift if @lines.size == before && @lines.any?
|
|
72
|
+
|
|
73
|
+
if root.is_a?(Mapping) && node.is_a?(Mapping)
|
|
74
|
+
root.pairs.concat(node.pairs)
|
|
75
|
+
elsif root.nil?
|
|
76
|
+
root = node
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
root
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
private
|
|
83
|
+
|
|
84
|
+
# Byte-wise, as checksums.yaml is read as binary unlike config files,
|
|
85
|
+
# and binary cannot be compared with a UTF-8 string holding the BOM.
|
|
86
|
+
def strip_bom(source)
|
|
87
|
+
return source unless UTF8_BOM_BYTES.each_with_index.all? {|byte, i| source.getbyte(i) == byte }
|
|
88
|
+
|
|
89
|
+
source.byteslice(UTF8_BOM_BYTES.size..)
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
def strip_document_end
|
|
93
|
+
index = @lines.index {|line| DOCUMENT_END_RE.match?(line) }
|
|
94
|
+
@lines.slice!(index..) if index
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
def strip_extra_documents
|
|
98
|
+
first_content_index = @lines.index {|line| !BLANK_OR_COMMENT_RE.match?(line) }
|
|
99
|
+
return unless first_content_index
|
|
100
|
+
|
|
101
|
+
if DOCUMENT_START_RE.match?(@lines[first_content_index])
|
|
102
|
+
# Keep the opening marker; strip_document_prefix consumes it afterward.
|
|
103
|
+
@lines.shift(first_content_index)
|
|
104
|
+
search_start = 1
|
|
105
|
+
else
|
|
106
|
+
search_start = first_content_index
|
|
107
|
+
end
|
|
108
|
+
index = (search_start...@lines.size).find {|i| DOCUMENT_START_RE.match?(@lines[i]) }
|
|
109
|
+
@lines.slice!(index..) if index
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
def strip_document_prefix
|
|
113
|
+
return if @lines.empty?
|
|
114
|
+
return unless @lines[0]&.start_with?("---")
|
|
115
|
+
|
|
116
|
+
if @lines[0].strip == "---"
|
|
117
|
+
@lines.shift
|
|
118
|
+
else
|
|
119
|
+
@lines[0] = @lines[0].sub(/^---\s*/, "")
|
|
120
|
+
end
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
def parse_node(base_indent)
|
|
124
|
+
@depth += 1
|
|
125
|
+
raise_max_nesting! if @depth > MAX_NESTING_DEPTH
|
|
126
|
+
|
|
127
|
+
skip_blank_and_comments
|
|
128
|
+
return nil if @lines.empty?
|
|
129
|
+
|
|
130
|
+
line = @lines[0]
|
|
131
|
+
indent = indent_of(line)
|
|
132
|
+
return nil if indent < base_indent
|
|
133
|
+
|
|
134
|
+
return parse_alias_ref if /\G\*/.match?(line, indent)
|
|
135
|
+
|
|
136
|
+
pos = indent
|
|
137
|
+
if /\G&/.match?(line, indent) && (anchor = consume_anchor)
|
|
138
|
+
# A lone anchor line, e.g. "--- &1", anchors the node on the next line.
|
|
139
|
+
skip_blank_and_comments
|
|
140
|
+
return register_anchor(anchor, nil) if @lines.empty? || current_indent < base_indent
|
|
141
|
+
line = @lines[0]
|
|
142
|
+
indent = pos = indent_of(line)
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
if SEQUENCE_ENTRY_RE.match?(line, pos)
|
|
146
|
+
parse_sequence(indent, anchor)
|
|
147
|
+
elsif QUOTED_KEY_RE.match?(line, pos)
|
|
148
|
+
# A mapping whose key is quoted, e.g. '"have: colon": value'.
|
|
149
|
+
parse_mapping(indent, anchor)
|
|
150
|
+
elsif (/\G"/.match?(line, pos) && line.end_with?("\"")) ||
|
|
151
|
+
(/\G'/.match?(line, pos) && line.end_with?("'"))
|
|
152
|
+
# A whole-line quoted scalar, e.g. '"system: foo: bar"'. It may
|
|
153
|
+
# contain ": ", so it must be checked before MAPPING_KEY_RE.
|
|
154
|
+
parse_plain_scalar(indent, anchor)
|
|
155
|
+
elsif MAPPING_KEY_RE.match?(line, pos) && !RUBY_OBJECT_TAG_RE.match?(line, pos)
|
|
156
|
+
parse_mapping(indent, anchor)
|
|
157
|
+
elsif RUBY_OBJECT_TAG_RE.match?(line, pos)
|
|
158
|
+
parse_tagged_node(indent, anchor)
|
|
159
|
+
elsif /\G\|/.match?(line, pos)
|
|
160
|
+
modifier = line[pos + 1, line.size].strip
|
|
161
|
+
@lines.shift
|
|
162
|
+
register_anchor(anchor, Scalar.new(parse_block_scalar(indent, modifier)))
|
|
163
|
+
else
|
|
164
|
+
parse_plain_scalar(indent, anchor)
|
|
165
|
+
end
|
|
166
|
+
ensure
|
|
167
|
+
@depth -= 1
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
def parse_sequence(indent, anchor)
|
|
171
|
+
items = []
|
|
172
|
+
while @lines.any?
|
|
173
|
+
skip_blank_and_comments
|
|
174
|
+
break if @lines.empty?
|
|
175
|
+
line = @lines[0]
|
|
176
|
+
break unless indent_of(line) == indent && SEQUENCE_ENTRY_RE.match?(line, indent)
|
|
177
|
+
@lines.shift
|
|
178
|
+
content = line[indent + 1, line.size]
|
|
179
|
+
content.strip!
|
|
180
|
+
item_anchor = nil
|
|
181
|
+
item_anchor, content = extract_anchor(content) if content.start_with?("&")
|
|
182
|
+
item = parse_sequence_item(content, indent)
|
|
183
|
+
items << register_anchor(item_anchor, item)
|
|
184
|
+
end
|
|
185
|
+
register_anchor(anchor, Sequence.new(items))
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
def parse_sequence_item(content, indent)
|
|
189
|
+
if content.start_with?("*")
|
|
190
|
+
parse_inline_alias(content)
|
|
191
|
+
elsif content.empty?
|
|
192
|
+
skip_blank_and_comments
|
|
193
|
+
@lines.any? && current_indent > indent ? parse_node(indent + 1) : nil
|
|
194
|
+
elsif content.start_with?("!ruby/object:")
|
|
195
|
+
parse_tagged_content(content.strip, indent)
|
|
196
|
+
elsif content.start_with?("!binary ")
|
|
197
|
+
parse_binary_value(content, indent)
|
|
198
|
+
elsif content.start_with?("-")
|
|
199
|
+
@lines.unshift("#{" " * (indent + 2)}#{content}")
|
|
200
|
+
parse_node(indent)
|
|
201
|
+
elsif QUOTED_KEY_RE.match?(content) ||
|
|
202
|
+
(MAPPING_KEY_RE.match?(content) && !content.start_with?("!ruby/object:") &&
|
|
203
|
+
!OPEN_QUOTED_RE.match?(content))
|
|
204
|
+
@lines.unshift("#{" " * (indent + 2)}#{content}")
|
|
205
|
+
parse_node(indent)
|
|
206
|
+
elsif content.start_with?("|")
|
|
207
|
+
Scalar.new(parse_block_scalar(indent, content[1..].to_s.strip))
|
|
208
|
+
else
|
|
209
|
+
parse_inline_scalar(content, indent)
|
|
210
|
+
end
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
def parse_mapping(indent, anchor)
|
|
214
|
+
pairs = []
|
|
215
|
+
while @lines.any?
|
|
216
|
+
skip_blank_and_comments
|
|
217
|
+
break if @lines.empty?
|
|
218
|
+
line = @lines[0]
|
|
219
|
+
break unless indent_of(line) == indent
|
|
220
|
+
|
|
221
|
+
if (match = QUOTED_KEY_RE.match(line, indent))
|
|
222
|
+
key = coerce(match[1])
|
|
223
|
+
elsif (match = MAPPING_KEY_RE.match(line, indent)) && !RUBY_OBJECT_TAG_RE.match?(line, indent)
|
|
224
|
+
key = match[1]
|
|
225
|
+
key.strip!
|
|
226
|
+
key = decode_binary_tag(key) if key.start_with?("!binary ")
|
|
227
|
+
else
|
|
228
|
+
break
|
|
229
|
+
end
|
|
230
|
+
@lines.shift
|
|
231
|
+
val = match[2]
|
|
232
|
+
val&.strip!
|
|
233
|
+
val = strip_comment(val || "")
|
|
234
|
+
|
|
235
|
+
val_anchor = nil
|
|
236
|
+
val_anchor, val = extract_anchor(val) if val.start_with?("&")
|
|
237
|
+
value = parse_mapping_value(val, indent)
|
|
238
|
+
value = register_anchor(val_anchor, value) if val_anchor
|
|
239
|
+
|
|
240
|
+
pairs << key << value
|
|
241
|
+
end
|
|
242
|
+
register_anchor(anchor, Mapping.new(pairs))
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
def parse_mapping_value(val, indent)
|
|
246
|
+
if val.start_with?("*")
|
|
247
|
+
parse_inline_alias(val)
|
|
248
|
+
elsif val.start_with?("!ruby/object:")
|
|
249
|
+
parse_tagged_content(val.strip, indent)
|
|
250
|
+
elsif val.start_with?("!binary ")
|
|
251
|
+
parse_binary_value(val, indent)
|
|
252
|
+
elsif val.empty?
|
|
253
|
+
skip_blank_and_comments
|
|
254
|
+
line = @lines[0]
|
|
255
|
+
if line && indent_of(line) == indent && SEQUENCE_ENTRY_RE.match?(line, indent)
|
|
256
|
+
parse_node(indent)
|
|
257
|
+
else
|
|
258
|
+
parse_node(indent + 1)
|
|
259
|
+
end
|
|
260
|
+
elsif val == "[]"
|
|
261
|
+
Sequence.new([])
|
|
262
|
+
elsif val == "{}"
|
|
263
|
+
Mapping.new([])
|
|
264
|
+
elsif val.start_with?("|")
|
|
265
|
+
Scalar.new(parse_block_scalar(indent, val[1..].to_s.strip))
|
|
266
|
+
else
|
|
267
|
+
parse_inline_scalar(val, indent)
|
|
268
|
+
end
|
|
269
|
+
end
|
|
270
|
+
|
|
271
|
+
def parse_tagged_node(indent, anchor)
|
|
272
|
+
tag = @lines.shift.strip
|
|
273
|
+
nested = parse_node(indent)
|
|
274
|
+
apply_tag(nested, tag, anchor)
|
|
275
|
+
end
|
|
276
|
+
|
|
277
|
+
def parse_tagged_content(tag, indent)
|
|
278
|
+
nested = parse_node(indent)
|
|
279
|
+
apply_tag(nested, tag, nil)
|
|
280
|
+
end
|
|
281
|
+
|
|
282
|
+
def apply_tag(node, tag, anchor)
|
|
283
|
+
if node.is_a?(Mapping)
|
|
284
|
+
node.tag = tag
|
|
285
|
+
node.anchor = anchor
|
|
286
|
+
node
|
|
287
|
+
else
|
|
288
|
+
Mapping.new(["value", node], tag, anchor)
|
|
289
|
+
end
|
|
290
|
+
end
|
|
291
|
+
|
|
292
|
+
def parse_block_scalar(base_indent, modifier)
|
|
293
|
+
parts = []
|
|
294
|
+
indentation = modifier[/\A[+-]?([1-9])/, 1]
|
|
295
|
+
chomping = modifier[/\A[1-9]?([+-])/, 1]
|
|
296
|
+
block_indent = indentation && base_indent + indentation.to_i
|
|
297
|
+
|
|
298
|
+
while @lines.any?
|
|
299
|
+
line = @lines[0]
|
|
300
|
+
if BLANK_RE.match?(line)
|
|
301
|
+
parts << line[block_indent..] if block_indent && line.size > block_indent
|
|
302
|
+
parts << "\n"
|
|
303
|
+
@lines.shift
|
|
304
|
+
else
|
|
305
|
+
line_indent = indent_of(line)
|
|
306
|
+
break if line_indent <= base_indent
|
|
307
|
+
block_indent ||= line_indent
|
|
308
|
+
parts << @lines.shift[block_indent..].to_s << "\n"
|
|
309
|
+
end
|
|
310
|
+
end
|
|
311
|
+
|
|
312
|
+
res = parts.join
|
|
313
|
+
unless chomping == "+"
|
|
314
|
+
res.delete_suffix!("\n") while res.end_with?("\n")
|
|
315
|
+
# Clipping keeps the final line break but drops trailing empty lines.
|
|
316
|
+
res << "\n" if chomping.nil? && !res.empty?
|
|
317
|
+
end
|
|
318
|
+
res
|
|
319
|
+
end
|
|
320
|
+
|
|
321
|
+
def parse_plain_scalar(indent, anchor)
|
|
322
|
+
val = @lines.shift.strip
|
|
323
|
+
result = coerce(val)
|
|
324
|
+
return register_anchor(anchor, result) if result.is_a?(Mapping) || result.is_a?(Sequence)
|
|
325
|
+
|
|
326
|
+
fold_continuation_lines(result, val, indent)
|
|
327
|
+
register_anchor(anchor, Scalar.new(result))
|
|
328
|
+
end
|
|
329
|
+
|
|
330
|
+
def parse_inline_scalar(val, indent)
|
|
331
|
+
result = coerce(val)
|
|
332
|
+
return result if result.is_a?(Mapping) || result.is_a?(Sequence)
|
|
333
|
+
|
|
334
|
+
fold_continuation_lines(result, val, indent)
|
|
335
|
+
Scalar.new(result)
|
|
336
|
+
end
|
|
337
|
+
|
|
338
|
+
def fold_continuation_lines(result, val, indent)
|
|
339
|
+
return unless result.is_a?(String)
|
|
340
|
+
|
|
341
|
+
return result.replace(fold_quoted_lines(val.delete_prefix("! "), indent)) if OPEN_QUOTED_RE.match?(val)
|
|
342
|
+
|
|
343
|
+
while @lines.any? && !BLANK_OR_COMMENT_RE.match?(@lines[0]) && current_indent > indent
|
|
344
|
+
result << " " << @lines.shift.strip
|
|
345
|
+
end
|
|
346
|
+
end
|
|
347
|
+
|
|
348
|
+
def fold_quoted_lines(val, indent)
|
|
349
|
+
open = OPEN_QUOTED_RE.match(val)
|
|
350
|
+
breaks = +""
|
|
351
|
+
while open && @lines.any? && (BLANK_RE.match?(@lines[0]) || current_indent > indent)
|
|
352
|
+
line = @lines.shift.strip
|
|
353
|
+
next breaks << "\n" if line.empty?
|
|
354
|
+
|
|
355
|
+
val.chop! if open[1]
|
|
356
|
+
val << (breaks.empty? && !open[1] ? " " : breaks) << line
|
|
357
|
+
breaks.clear
|
|
358
|
+
open = OPEN_QUOTED_RE.match("#{val[0]}#{line}")
|
|
359
|
+
end
|
|
360
|
+
coerce(val)
|
|
361
|
+
end
|
|
362
|
+
|
|
363
|
+
def coerce(val, depth = 0)
|
|
364
|
+
raise_max_nesting! if depth > MAX_NESTING_DEPTH
|
|
365
|
+
|
|
366
|
+
val = val.sub(/^! /, "") if val.start_with?("! ")
|
|
367
|
+
|
|
368
|
+
if val.size >= 2 && val.start_with?("\"") && val.end_with?("\"")
|
|
369
|
+
inner = val[1..-2]
|
|
370
|
+
return inner unless inner.include?("\\")
|
|
371
|
+
inner.gsub(/\\(?:["\\ 0abtnvfreN_LP]|x\h{2}|u\h{4}|U\h{8})/) do |m|
|
|
372
|
+
char = STRING_UNESCAPES[m] || unescape_code_point(m)
|
|
373
|
+
# Metadata is read as binary, where non-ASCII text stays as UTF-8 bytes.
|
|
374
|
+
Encoding.compatible?(inner, char) ? char : char.b
|
|
375
|
+
end
|
|
376
|
+
elsif val.size >= 2 && val.start_with?("'") && val.end_with?("'")
|
|
377
|
+
inner = val[1..-2]
|
|
378
|
+
inner.include?("''") ? inner.gsub("''", "'") : inner
|
|
379
|
+
elsif val == "true"
|
|
380
|
+
true
|
|
381
|
+
elsif val == "false"
|
|
382
|
+
false
|
|
383
|
+
elsif NULL_SCALARS.include?(val)
|
|
384
|
+
nil
|
|
385
|
+
elsif val == "{}"
|
|
386
|
+
Mapping.new([])
|
|
387
|
+
elsif val =~ /^\[(.*)\]$/
|
|
388
|
+
inner = $1.strip
|
|
389
|
+
return Sequence.new([]) if inner.empty?
|
|
390
|
+
items = inner.scan(FLOW_SEQUENCE_ENTRY_RE).map {|e| Scalar.new(coerce(e, depth + 1)) }
|
|
391
|
+
Sequence.new(items)
|
|
392
|
+
elsif /\A\d{4}-\d{2}-\d{2}([ T]\d{2}:\d{2}:\d{2})?/.match?(val)
|
|
393
|
+
begin
|
|
394
|
+
Time.new(val)
|
|
395
|
+
rescue ArgumentError
|
|
396
|
+
# date-only format like "2024-06-15" is not supported by Time.new
|
|
397
|
+
if /\A(\d{4})-(\d{2})-(\d{2})\z/.match(val)
|
|
398
|
+
Time.utc($1.to_i, $2.to_i, $3.to_i)
|
|
399
|
+
else
|
|
400
|
+
val
|
|
401
|
+
end
|
|
402
|
+
end
|
|
403
|
+
elsif /^-?\d+$/.match?(val)
|
|
404
|
+
val.to_i
|
|
405
|
+
else
|
|
406
|
+
val
|
|
407
|
+
end
|
|
408
|
+
end
|
|
409
|
+
|
|
410
|
+
def unescape_code_point(escape)
|
|
411
|
+
code = escape[2..].hex
|
|
412
|
+
return escape if code > 0x10FFFF || code.between?(0xD800, 0xDFFF)
|
|
413
|
+
code.chr(Encoding::UTF_8)
|
|
414
|
+
end
|
|
415
|
+
|
|
416
|
+
def decode_binary_tag(str)
|
|
417
|
+
content = str.sub(/\A!binary\s+/, "")
|
|
418
|
+
content = $1 if content =~ /\A"(.*)"\z/ || content =~ /\A'(.*)'\z/
|
|
419
|
+
content.unpack1("m")
|
|
420
|
+
end
|
|
421
|
+
|
|
422
|
+
def parse_binary_value(val, indent)
|
|
423
|
+
rest = val.sub(/\A!binary\s+/, "")
|
|
424
|
+
if rest.start_with?("|")
|
|
425
|
+
content = parse_block_scalar(indent, rest[1..].to_s.strip)
|
|
426
|
+
Scalar.new(content.unpack1("m"))
|
|
427
|
+
else
|
|
428
|
+
Scalar.new(decode_binary_tag(val))
|
|
429
|
+
end
|
|
430
|
+
end
|
|
431
|
+
|
|
432
|
+
def parse_alias_ref
|
|
433
|
+
AliasRef.new(@lines.shift.lstrip[1..].strip)
|
|
434
|
+
end
|
|
435
|
+
|
|
436
|
+
def parse_inline_alias(content)
|
|
437
|
+
AliasRef.new(content[1..].strip)
|
|
438
|
+
end
|
|
439
|
+
|
|
440
|
+
def current_indent
|
|
441
|
+
indent_of(@lines[0])
|
|
442
|
+
end
|
|
443
|
+
|
|
444
|
+
def indent_of(line)
|
|
445
|
+
i = 0
|
|
446
|
+
i += 1 while LSTRIP_BYTES.include?(line.getbyte(i))
|
|
447
|
+
i
|
|
448
|
+
end
|
|
449
|
+
|
|
450
|
+
def consume_anchor
|
|
451
|
+
line = @lines[0]
|
|
452
|
+
stripped = line.lstrip
|
|
453
|
+
return nil unless stripped.start_with?("&") && stripped =~ /^&(\S+)\s*/
|
|
454
|
+
|
|
455
|
+
anchor = $1
|
|
456
|
+
if $'.empty?
|
|
457
|
+
@lines.shift
|
|
458
|
+
else
|
|
459
|
+
@lines[0] = line.sub(/&#{Regexp.escape(anchor)}\s+/, "")
|
|
460
|
+
end
|
|
461
|
+
anchor
|
|
462
|
+
end
|
|
463
|
+
|
|
464
|
+
def extract_anchor(content)
|
|
465
|
+
return [nil, content] unless content =~ /^&(\S+)/
|
|
466
|
+
|
|
467
|
+
anchor = $1
|
|
468
|
+
[anchor, content.sub(/^&#{Regexp.escape(anchor)}\s*/, "")]
|
|
469
|
+
end
|
|
470
|
+
|
|
471
|
+
def register_anchor(name, node)
|
|
472
|
+
if name
|
|
473
|
+
# An anchored empty node still defines the anchor, as a null.
|
|
474
|
+
node ||= Scalar.new(nil)
|
|
475
|
+
@anchors[name] = node
|
|
476
|
+
node.anchor = name if node.respond_to?(:anchor=)
|
|
477
|
+
end
|
|
478
|
+
node
|
|
479
|
+
end
|
|
480
|
+
|
|
481
|
+
def raise_max_nesting!
|
|
482
|
+
message = "exceeded maximum nesting depth (#{MAX_NESTING_DEPTH})"
|
|
483
|
+
if defined?(Psych::VERSION)
|
|
484
|
+
raise Psych::SyntaxError.new(nil, 0, 0, 0, message, nil)
|
|
485
|
+
else
|
|
486
|
+
raise Psych::SyntaxError, message
|
|
487
|
+
end
|
|
488
|
+
end
|
|
489
|
+
|
|
490
|
+
def skip_blank_and_comments
|
|
491
|
+
@lines.shift while @lines.any? && BLANK_OR_COMMENT_RE.match?(@lines[0])
|
|
492
|
+
end
|
|
493
|
+
|
|
494
|
+
def strip_comment(val)
|
|
495
|
+
return val unless val.include?("#")
|
|
496
|
+
return "" if val.lstrip.start_with?("#")
|
|
497
|
+
|
|
498
|
+
in_single = false
|
|
499
|
+
in_double = false
|
|
500
|
+
escape = false
|
|
501
|
+
|
|
502
|
+
val.each_char.with_index do |ch, i|
|
|
503
|
+
if escape
|
|
504
|
+
escape = false
|
|
505
|
+
next
|
|
506
|
+
end
|
|
507
|
+
|
|
508
|
+
if in_single
|
|
509
|
+
in_single = false if ch == "'"
|
|
510
|
+
elsif in_double
|
|
511
|
+
if ch == "\\"
|
|
512
|
+
escape = true
|
|
513
|
+
elsif ch == '"'
|
|
514
|
+
in_double = false
|
|
515
|
+
end
|
|
516
|
+
else
|
|
517
|
+
case ch
|
|
518
|
+
when "'" then in_single = true
|
|
519
|
+
when '"' then in_double = true
|
|
520
|
+
when "#"
|
|
521
|
+
# A "#" starts a comment only when preceded by whitespace.
|
|
522
|
+
return val[0...i].rstrip if [" ", "\t"].include?(val[i - 1])
|
|
523
|
+
end
|
|
524
|
+
end
|
|
525
|
+
end
|
|
526
|
+
|
|
527
|
+
val
|
|
528
|
+
end
|
|
529
|
+
end
|
|
530
|
+
end
|
|
531
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
unless defined?(Psych::VERSION)
|
|
4
|
+
module Psych
|
|
5
|
+
class Exception < ::RuntimeError; end
|
|
6
|
+
class SyntaxError < Exception; end
|
|
7
|
+
class DisallowedClass < Exception; end
|
|
8
|
+
class BadAlias < Exception; end
|
|
9
|
+
class AliasesNotEnabled < BadAlias; end
|
|
10
|
+
end
|
|
11
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bundler
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.1.
|
|
4
|
+
version: 4.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Yehuda Katz
|
|
@@ -371,7 +371,6 @@ files:
|
|
|
371
371
|
- lib/rubygems/vendor/securerandom/COPYING
|
|
372
372
|
- lib/rubygems/vendor/securerandom/lib/securerandom.rb
|
|
373
373
|
- lib/rubygems/vendor/uri/COPYING
|
|
374
|
-
- lib/rubygems/vendor/uri/lib/uri.rb
|
|
375
374
|
- lib/rubygems/vendor/uri/lib/uri/common.rb
|
|
376
375
|
- lib/rubygems/vendor/uri/lib/uri/file.rb
|
|
377
376
|
- lib/rubygems/vendor/uri/lib/uri/ftp.rb
|
|
@@ -386,7 +385,12 @@ files:
|
|
|
386
385
|
- lib/rubygems/vendor/uri/lib/uri/version.rb
|
|
387
386
|
- lib/rubygems/vendor/uri/lib/uri/ws.rb
|
|
388
387
|
- lib/rubygems/vendor/uri/lib/uri/wss.rb
|
|
389
|
-
- lib/rubygems/yaml_serializer.rb
|
|
388
|
+
- lib/rubygems/yaml_serializer/builder.rb
|
|
389
|
+
- lib/rubygems/yaml_serializer/core.rb
|
|
390
|
+
- lib/rubygems/yaml_serializer/emitter.rb
|
|
391
|
+
- lib/rubygems/yaml_serializer/nodes.rb
|
|
392
|
+
- lib/rubygems/yaml_serializer/parser.rb
|
|
393
|
+
- lib/rubygems/yaml_serializer/psych_errors.rb
|
|
390
394
|
homepage: "https://bundler.io"
|
|
391
395
|
licenses:
|
|
392
396
|
- MIT
|
|
@@ -411,7 +415,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
411
415
|
- !ruby/object:Gem::Version
|
|
412
416
|
version: 3.4.1
|
|
413
417
|
requirements: []
|
|
414
|
-
rubygems_version: 4.1.
|
|
418
|
+
rubygems_version: 4.1.1
|
|
415
419
|
specification_version: 4
|
|
416
420
|
summary: The best way to manage your application's dependencies
|
|
417
421
|
test_files: []
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: false
|
|
2
|
-
# Gem::URI is a module providing classes to handle Uniform Resource Identifiers
|
|
3
|
-
# (RFC2396[https://www.rfc-editor.org/rfc/rfc2396]).
|
|
4
|
-
#
|
|
5
|
-
# == Features
|
|
6
|
-
#
|
|
7
|
-
# * Uniform way of handling URIs.
|
|
8
|
-
# * Flexibility to introduce custom Gem::URI schemes.
|
|
9
|
-
# * Flexibility to have an alternate Gem::URI::Parser (or just different patterns
|
|
10
|
-
# and regexp's).
|
|
11
|
-
#
|
|
12
|
-
# == Basic example
|
|
13
|
-
#
|
|
14
|
-
# require 'rubygems/vendor/uri/lib/uri'
|
|
15
|
-
#
|
|
16
|
-
# uri = Gem::URI("http://foo.com/posts?id=30&limit=5#time=1305298413")
|
|
17
|
-
# #=> #<Gem::URI::HTTP http://foo.com/posts?id=30&limit=5#time=1305298413>
|
|
18
|
-
#
|
|
19
|
-
# uri.scheme #=> "http"
|
|
20
|
-
# uri.host #=> "foo.com"
|
|
21
|
-
# uri.path #=> "/posts"
|
|
22
|
-
# uri.query #=> "id=30&limit=5"
|
|
23
|
-
# uri.fragment #=> "time=1305298413"
|
|
24
|
-
#
|
|
25
|
-
# uri.to_s #=> "http://foo.com/posts?id=30&limit=5#time=1305298413"
|
|
26
|
-
#
|
|
27
|
-
# == Adding custom URIs
|
|
28
|
-
#
|
|
29
|
-
# module Gem::URI
|
|
30
|
-
# class RSYNC < Generic
|
|
31
|
-
# DEFAULT_PORT = 873
|
|
32
|
-
# end
|
|
33
|
-
# register_scheme 'RSYNC', RSYNC
|
|
34
|
-
# end
|
|
35
|
-
# #=> Gem::URI::RSYNC
|
|
36
|
-
#
|
|
37
|
-
# Gem::URI.scheme_list
|
|
38
|
-
# #=> {"FILE"=>Gem::URI::File, "FTP"=>Gem::URI::FTP, "HTTP"=>Gem::URI::HTTP,
|
|
39
|
-
# # "HTTPS"=>Gem::URI::HTTPS, "LDAP"=>Gem::URI::LDAP, "LDAPS"=>Gem::URI::LDAPS,
|
|
40
|
-
# # "MAILTO"=>Gem::URI::MailTo, "RSYNC"=>Gem::URI::RSYNC}
|
|
41
|
-
#
|
|
42
|
-
# uri = Gem::URI("rsync://rsync.foo.com")
|
|
43
|
-
# #=> #<Gem::URI::RSYNC rsync://rsync.foo.com>
|
|
44
|
-
#
|
|
45
|
-
# == RFC References
|
|
46
|
-
#
|
|
47
|
-
# A good place to view an RFC spec is http://www.ietf.org/rfc.html.
|
|
48
|
-
#
|
|
49
|
-
# Here is a list of all related RFC's:
|
|
50
|
-
# - RFC822[https://www.rfc-editor.org/rfc/rfc822]
|
|
51
|
-
# - RFC1738[https://www.rfc-editor.org/rfc/rfc1738]
|
|
52
|
-
# - RFC2255[https://www.rfc-editor.org/rfc/rfc2255]
|
|
53
|
-
# - RFC2368[https://www.rfc-editor.org/rfc/rfc2368]
|
|
54
|
-
# - RFC2373[https://www.rfc-editor.org/rfc/rfc2373]
|
|
55
|
-
# - RFC2396[https://www.rfc-editor.org/rfc/rfc2396]
|
|
56
|
-
# - RFC2732[https://www.rfc-editor.org/rfc/rfc2732]
|
|
57
|
-
# - RFC3986[https://www.rfc-editor.org/rfc/rfc3986]
|
|
58
|
-
#
|
|
59
|
-
# == Class tree
|
|
60
|
-
#
|
|
61
|
-
# - Gem::URI::Generic (in uri/generic.rb)
|
|
62
|
-
# - Gem::URI::File - (in uri/file.rb)
|
|
63
|
-
# - Gem::URI::FTP - (in uri/ftp.rb)
|
|
64
|
-
# - Gem::URI::HTTP - (in uri/http.rb)
|
|
65
|
-
# - Gem::URI::HTTPS - (in uri/https.rb)
|
|
66
|
-
# - Gem::URI::LDAP - (in uri/ldap.rb)
|
|
67
|
-
# - Gem::URI::LDAPS - (in uri/ldaps.rb)
|
|
68
|
-
# - Gem::URI::MailTo - (in uri/mailto.rb)
|
|
69
|
-
# - Gem::URI::Parser - (in uri/common.rb)
|
|
70
|
-
# - Gem::URI::REGEXP - (in uri/common.rb)
|
|
71
|
-
# - Gem::URI::REGEXP::PATTERN - (in uri/common.rb)
|
|
72
|
-
# - Gem::URI::Util - (in uri/common.rb)
|
|
73
|
-
# - Gem::URI::Error - (in uri/common.rb)
|
|
74
|
-
# - Gem::URI::InvalidURIError - (in uri/common.rb)
|
|
75
|
-
# - Gem::URI::InvalidComponentError - (in uri/common.rb)
|
|
76
|
-
# - Gem::URI::BadURIError - (in uri/common.rb)
|
|
77
|
-
#
|
|
78
|
-
# == Copyright Info
|
|
79
|
-
#
|
|
80
|
-
# Author:: Akira Yamada <akira@ruby-lang.org>
|
|
81
|
-
# Documentation::
|
|
82
|
-
# Akira Yamada <akira@ruby-lang.org>
|
|
83
|
-
# Dmitry V. Sabanin <sdmitry@lrn.ru>
|
|
84
|
-
# Vincent Batts <vbatts@hashbangbash.com>
|
|
85
|
-
# License::
|
|
86
|
-
# Copyright (c) 2001 akira yamada <akira@ruby-lang.org>
|
|
87
|
-
# You can redistribute it and/or modify it under the same term as Ruby.
|
|
88
|
-
#
|
|
89
|
-
|
|
90
|
-
# Skip reloading when an identical copy (e.g. the one shipped inside the Bundler
|
|
91
|
-
# gem) was already required from a different path, to avoid redefinition warnings.
|
|
92
|
-
return if defined?(Gem::URI::VERSION)
|
|
93
|
-
|
|
94
|
-
module Gem::URI
|
|
95
|
-
end
|
|
96
|
-
|
|
97
|
-
require_relative 'uri/version'
|
|
98
|
-
require_relative 'uri/common'
|
|
99
|
-
require_relative 'uri/generic'
|
|
100
|
-
require_relative 'uri/file'
|
|
101
|
-
require_relative 'uri/ftp'
|
|
102
|
-
require_relative 'uri/http'
|
|
103
|
-
require_relative 'uri/https'
|
|
104
|
-
require_relative 'uri/ldap'
|
|
105
|
-
require_relative 'uri/ldaps'
|
|
106
|
-
require_relative 'uri/mailto'
|
|
107
|
-
require_relative 'uri/ws'
|
|
108
|
-
require_relative 'uri/wss'
|