bundler 4.1.0 → 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 +15 -6
- data/lib/bundler/cli/outdated.rb +1 -4
- data/lib/bundler/definition.rb +27 -4
- data/lib/bundler/dependency.rb +17 -2
- data/lib/bundler/dsl.rb +3 -0
- data/lib/bundler/injector.rb +1 -1
- data/lib/bundler/inline.rb +3 -1
- data/lib/bundler/lazy_specification.rb +4 -0
- data/lib/bundler/man/bundle-lock.1 +1 -1
- data/lib/bundler/man/bundle-lock.1.ronn +5 -1
- data/lib/bundler/match_remote_metadata.rb +6 -0
- 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 +87 -7
- data/lib/bundler/rubygems_ext.rb +13 -0
- data/lib/bundler/runtime.rb +5 -1
- data/lib/bundler/settings.rb +2 -3
- data/lib/bundler/spec_set.rb +28 -7
- 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/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.rb → yaml_serializer/parser.rb} +17 -476
- data/lib/rubygems/yaml_serializer/psych_errors.rb +11 -0
- metadata +8 -4
- data/lib/rubygems/vendor/uri/lib/uri.rb +0 -108
|
@@ -1,26 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Skip reloading when an identical copy (e.g. the one shipped inside the Bundler
|
|
4
|
-
# gem) was already required from a different path, to avoid redefinition warnings.
|
|
5
|
-
return if defined?(Gem::YAMLSerializer)
|
|
6
|
-
|
|
7
|
-
unless defined?(Psych::VERSION)
|
|
8
|
-
module Psych
|
|
9
|
-
class Exception < ::RuntimeError; end
|
|
10
|
-
class SyntaxError < Exception; end
|
|
11
|
-
class DisallowedClass < Exception; end
|
|
12
|
-
class BadAlias < Exception; end
|
|
13
|
-
class AliasesNotEnabled < BadAlias; end
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
|
|
17
3
|
module Gem
|
|
18
4
|
module YAMLSerializer
|
|
19
|
-
Scalar = Struct.new(:value, :tag, :anchor)
|
|
20
|
-
Mapping = Struct.new(:pairs, :tag, :anchor)
|
|
21
|
-
Sequence = Struct.new(:items, :tag, :anchor)
|
|
22
|
-
AliasRef = Struct.new(:name)
|
|
23
|
-
|
|
24
5
|
class Parser
|
|
25
6
|
# A plain (unquoted) mapping key followed by ":". "#" inside a key is
|
|
26
7
|
# literal unless preceded by a space (which would start a comment).
|
|
@@ -42,6 +23,7 @@ module Gem
|
|
|
42
23
|
BLANK_RE = /\A[\0\s]*\z/
|
|
43
24
|
BLANK_OR_COMMENT_RE = /\A[\0\s]*(?:#|\z)/
|
|
44
25
|
DOCUMENT_END_RE = /\A\.\.\.(?:[ \t]|\z)/
|
|
26
|
+
DOCUMENT_START_RE = /\A---(?:[ \t]|\z)/
|
|
45
27
|
|
|
46
28
|
STRING_UNESCAPES = {
|
|
47
29
|
"\\\\" => "\\",
|
|
@@ -75,6 +57,7 @@ module Gem
|
|
|
75
57
|
@anchors = {}
|
|
76
58
|
@depth = 0
|
|
77
59
|
strip_document_end
|
|
60
|
+
strip_extra_documents
|
|
78
61
|
strip_document_prefix
|
|
79
62
|
end
|
|
80
63
|
|
|
@@ -111,6 +94,21 @@ module Gem
|
|
|
111
94
|
@lines.slice!(index..) if index
|
|
112
95
|
end
|
|
113
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
|
+
|
|
114
112
|
def strip_document_prefix
|
|
115
113
|
return if @lines.empty?
|
|
116
114
|
return unless @lines[0]&.start_with?("---")
|
|
@@ -529,462 +527,5 @@ module Gem
|
|
|
529
527
|
val
|
|
530
528
|
end
|
|
531
529
|
end
|
|
532
|
-
|
|
533
|
-
class Builder
|
|
534
|
-
VALID_OPS = %w[= != > < >= <= ~>].freeze
|
|
535
|
-
ARRAY_FIELDS = %w[files test_files executables extra_rdoc_files].freeze
|
|
536
|
-
MAX_ALIAS_EXPANSION = 100_000
|
|
537
|
-
|
|
538
|
-
def initialize(permitted_classes: [], permitted_symbols: [], aliases: true)
|
|
539
|
-
@permitted_classes = permitted_classes.map {|c| "!ruby/object:#{c}" }
|
|
540
|
-
@permitted_symbols = permitted_symbols
|
|
541
|
-
@aliases = aliases
|
|
542
|
-
@anchor_values = {}
|
|
543
|
-
@anchor_sizes = {}
|
|
544
|
-
@expanded_size = 0
|
|
545
|
-
@alias_expansion = 0
|
|
546
|
-
end
|
|
547
|
-
|
|
548
|
-
def build(node)
|
|
549
|
-
return nil if node.nil?
|
|
550
|
-
|
|
551
|
-
result = build_node(node)
|
|
552
|
-
|
|
553
|
-
if result.is_a?(Hash) && result[:tag] == "!ruby/object:Gem::Specification"
|
|
554
|
-
build_specification(result)
|
|
555
|
-
else
|
|
556
|
-
result
|
|
557
|
-
end
|
|
558
|
-
end
|
|
559
|
-
|
|
560
|
-
private
|
|
561
|
-
|
|
562
|
-
def build_node(node)
|
|
563
|
-
start = @expanded_size
|
|
564
|
-
case node
|
|
565
|
-
when nil then nil
|
|
566
|
-
when AliasRef then resolve_alias(node)
|
|
567
|
-
when Scalar then store_anchor(node.anchor, node.value, start)
|
|
568
|
-
when Mapping then store_anchor(node.anchor, build_mapping(node), start)
|
|
569
|
-
when Sequence then store_anchor(node.anchor, node.items.map {|item| build_node(item) }, start)
|
|
570
|
-
else node # already a Ruby object
|
|
571
|
-
end
|
|
572
|
-
end
|
|
573
|
-
|
|
574
|
-
def resolve_alias(node)
|
|
575
|
-
raise Psych::AliasesNotEnabled unless @aliases
|
|
576
|
-
unless @anchor_values.key?(node.name)
|
|
577
|
-
raise Psych::AnchorNotDefined, node.name if defined?(Psych::AnchorNotDefined)
|
|
578
|
-
raise Psych::BadAlias, "An alias referenced an unknown anchor: #{node.name}"
|
|
579
|
-
end
|
|
580
|
-
# Charge the expanded size of the anchor, weighing scalars by length,
|
|
581
|
-
# so neither nested aliases nor aliases to a long string blow up.
|
|
582
|
-
size = @anchor_sizes.fetch(node.name)
|
|
583
|
-
@expanded_size += size
|
|
584
|
-
@alias_expansion += size
|
|
585
|
-
if @alias_expansion > MAX_ALIAS_EXPANSION
|
|
586
|
-
raise Psych::BadAlias, "exceeded maximum alias expansion (#{MAX_ALIAS_EXPANSION})"
|
|
587
|
-
end
|
|
588
|
-
@anchor_values.fetch(node.name)
|
|
589
|
-
end
|
|
590
|
-
|
|
591
|
-
def store_anchor(name, value, start)
|
|
592
|
-
@expanded_size += value.is_a?(String) ? 1 + value.bytesize : 1
|
|
593
|
-
if name
|
|
594
|
-
@anchor_values[name] = value
|
|
595
|
-
@anchor_sizes[name] = @expanded_size - start
|
|
596
|
-
end
|
|
597
|
-
value
|
|
598
|
-
end
|
|
599
|
-
|
|
600
|
-
def build_mapping(node)
|
|
601
|
-
validate_tag!(node.tag) if node.tag
|
|
602
|
-
|
|
603
|
-
result = case node.tag
|
|
604
|
-
when "!ruby/object:Gem::Version"
|
|
605
|
-
build_version(node)
|
|
606
|
-
when "!ruby/object:Gem::Platform"
|
|
607
|
-
build_platform(node)
|
|
608
|
-
when "!ruby/object:Gem::Requirement", "!ruby/object:Gem::Version::Requirement"
|
|
609
|
-
build_requirement(node)
|
|
610
|
-
when "!ruby/object:Gem::Dependency"
|
|
611
|
-
build_dependency(node)
|
|
612
|
-
when nil
|
|
613
|
-
build_hash(node)
|
|
614
|
-
when "!ruby/object:Gem::Specification"
|
|
615
|
-
hash = build_hash(node)
|
|
616
|
-
hash[:tag] = node.tag
|
|
617
|
-
hash
|
|
618
|
-
else
|
|
619
|
-
raise ArgumentError, "undefined class/module #{node.tag.sub("!ruby/object:", "")}"
|
|
620
|
-
end
|
|
621
|
-
|
|
622
|
-
result
|
|
623
|
-
end
|
|
624
|
-
|
|
625
|
-
def build_hash(node)
|
|
626
|
-
result = {}
|
|
627
|
-
each_pair(node) do |key, value_node|
|
|
628
|
-
value = build_node(value_node)
|
|
629
|
-
|
|
630
|
-
if ARRAY_FIELDS.include?(key)
|
|
631
|
-
value = normalize_array_field(value)
|
|
632
|
-
end
|
|
633
|
-
|
|
634
|
-
result[key] = value
|
|
635
|
-
end
|
|
636
|
-
result
|
|
637
|
-
end
|
|
638
|
-
|
|
639
|
-
def build_version(node)
|
|
640
|
-
hash = pairs_to_hash(node)
|
|
641
|
-
Gem::Version.new((hash["version"] || hash["value"]).to_s)
|
|
642
|
-
end
|
|
643
|
-
|
|
644
|
-
PLATFORM_FIELDS = %w[cpu os version].freeze
|
|
645
|
-
PLATFORM_ALLOWED_IVARS = %w[cpu os version value].freeze
|
|
646
|
-
|
|
647
|
-
def build_platform(node)
|
|
648
|
-
hash = pairs_to_hash(node)
|
|
649
|
-
if (hash.keys & PLATFORM_FIELDS).any?
|
|
650
|
-
Gem::Platform.new([hash["cpu"], hash["os"], hash["version"]])
|
|
651
|
-
elsif hash["value"].is_a?(Array)
|
|
652
|
-
# Malformed platform (e.g. sequence instead of mapping).
|
|
653
|
-
# Return the raw value so yaml_initialize handles it like Psych does.
|
|
654
|
-
hash["value"]
|
|
655
|
-
else
|
|
656
|
-
plat = Gem::Platform.allocate
|
|
657
|
-
hash.each do |k, v|
|
|
658
|
-
plat.instance_variable_set(:"@#{k}", v) if PLATFORM_ALLOWED_IVARS.include?(k)
|
|
659
|
-
end
|
|
660
|
-
plat
|
|
661
|
-
end
|
|
662
|
-
end
|
|
663
|
-
|
|
664
|
-
def build_requirement(node)
|
|
665
|
-
r = Gem::Requirement.allocate
|
|
666
|
-
hash = pairs_to_hash(node)
|
|
667
|
-
reqs = hash["requirements"] || hash["value"]
|
|
668
|
-
|
|
669
|
-
if reqs.is_a?(Array) && !reqs.empty?
|
|
670
|
-
safe_reqs = []
|
|
671
|
-
reqs.each do |item|
|
|
672
|
-
if item.is_a?(Array) && item.size == 2
|
|
673
|
-
op = item[0].to_s
|
|
674
|
-
ver = item[1]
|
|
675
|
-
if VALID_OPS.include?(op)
|
|
676
|
-
version_obj = ver.is_a?(Gem::Version) ? ver : Gem::Version.new(ver.to_s)
|
|
677
|
-
safe_reqs << [op, version_obj]
|
|
678
|
-
end
|
|
679
|
-
elsif item.is_a?(String)
|
|
680
|
-
parsed = Gem::Requirement.parse(item)
|
|
681
|
-
safe_reqs << parsed
|
|
682
|
-
end
|
|
683
|
-
rescue Gem::Requirement::BadRequirementError, Gem::Version::BadVersionError
|
|
684
|
-
# Skip malformed items silently
|
|
685
|
-
end
|
|
686
|
-
reqs = safe_reqs unless safe_reqs.empty?
|
|
687
|
-
end
|
|
688
|
-
|
|
689
|
-
r.instance_variable_set(:@requirements, reqs)
|
|
690
|
-
r
|
|
691
|
-
end
|
|
692
|
-
|
|
693
|
-
def build_dependency(node)
|
|
694
|
-
hash = pairs_to_hash(node)
|
|
695
|
-
d = Gem::Dependency.allocate
|
|
696
|
-
d.instance_variable_set(:@name, hash["name"])
|
|
697
|
-
|
|
698
|
-
d.instance_variable_set(:@requirement, hash["requirement"] || hash["version_requirements"])
|
|
699
|
-
|
|
700
|
-
raw_type = hash["type"]
|
|
701
|
-
if raw_type
|
|
702
|
-
name = raw_type.to_s.sub(/^:/, "")
|
|
703
|
-
validate_symbol!(name)
|
|
704
|
-
type = name.to_sym
|
|
705
|
-
else
|
|
706
|
-
type = :runtime
|
|
707
|
-
end
|
|
708
|
-
d.instance_variable_set(:@type, type)
|
|
709
|
-
|
|
710
|
-
d.instance_variable_set(:@prerelease, ["true", true].include?(hash["prerelease"]))
|
|
711
|
-
d.instance_variable_set(:@version_requirements, d.instance_variable_get(:@requirement))
|
|
712
|
-
d
|
|
713
|
-
end
|
|
714
|
-
|
|
715
|
-
def build_specification(hash)
|
|
716
|
-
spec = Gem::Specification.allocate
|
|
717
|
-
|
|
718
|
-
normalize_specification_version!(hash)
|
|
719
|
-
normalize_array_fields!(hash)
|
|
720
|
-
|
|
721
|
-
spec.yaml_initialize("!ruby/object:Gem::Specification", hash)
|
|
722
|
-
spec
|
|
723
|
-
end
|
|
724
|
-
|
|
725
|
-
def pairs_to_hash(node)
|
|
726
|
-
result = {}
|
|
727
|
-
each_pair(node) do |key, value_node|
|
|
728
|
-
result[key] = build_node(value_node)
|
|
729
|
-
end
|
|
730
|
-
result
|
|
731
|
-
end
|
|
732
|
-
|
|
733
|
-
def each_pair(node)
|
|
734
|
-
pairs = node.pairs
|
|
735
|
-
i = 0
|
|
736
|
-
while i < pairs.size
|
|
737
|
-
yield pairs[i], pairs[i + 1]
|
|
738
|
-
i += 2
|
|
739
|
-
end
|
|
740
|
-
end
|
|
741
|
-
|
|
742
|
-
def validate_tag!(tag)
|
|
743
|
-
return if @permitted_classes.include?(tag)
|
|
744
|
-
raise_disallowed_class!(tag)
|
|
745
|
-
end
|
|
746
|
-
|
|
747
|
-
def raise_disallowed_class!(tag)
|
|
748
|
-
if defined?(Psych::VERSION)
|
|
749
|
-
raise Psych::DisallowedClass.new("load", tag)
|
|
750
|
-
else
|
|
751
|
-
raise Psych::DisallowedClass, "Tried to load unspecified class: #{tag}"
|
|
752
|
-
end
|
|
753
|
-
end
|
|
754
|
-
|
|
755
|
-
def validate_symbol!(name)
|
|
756
|
-
return if @permitted_symbols.empty? || @permitted_symbols.include?(name)
|
|
757
|
-
|
|
758
|
-
label = ":#{name}"
|
|
759
|
-
if defined?(Psych::VERSION)
|
|
760
|
-
raise Psych::DisallowedClass.new("load", label)
|
|
761
|
-
else
|
|
762
|
-
raise Psych::DisallowedClass, "Tried to load unspecified class: #{label}"
|
|
763
|
-
end
|
|
764
|
-
end
|
|
765
|
-
|
|
766
|
-
def normalize_specification_version!(hash)
|
|
767
|
-
val = hash["specification_version"]
|
|
768
|
-
return unless val && !val.is_a?(Integer)
|
|
769
|
-
hash["specification_version"] = val.to_i if val.is_a?(String) && /\A\d+\z/.match?(val)
|
|
770
|
-
end
|
|
771
|
-
|
|
772
|
-
def normalize_array_fields!(hash)
|
|
773
|
-
ARRAY_FIELDS.each do |field|
|
|
774
|
-
hash[field] = normalize_array_field(hash[field]) if hash[field]
|
|
775
|
-
end
|
|
776
|
-
end
|
|
777
|
-
|
|
778
|
-
def normalize_array_field(value)
|
|
779
|
-
if value.is_a?(Hash)
|
|
780
|
-
value.values.flatten.compact
|
|
781
|
-
elsif !value.is_a?(Array) && value
|
|
782
|
-
[value].flatten.compact
|
|
783
|
-
else
|
|
784
|
-
value
|
|
785
|
-
end
|
|
786
|
-
end
|
|
787
|
-
end
|
|
788
|
-
|
|
789
|
-
class Emitter
|
|
790
|
-
STRING_ESCAPES = {
|
|
791
|
-
"\\" => "\\\\",
|
|
792
|
-
"\"" => "\\\"",
|
|
793
|
-
"\0" => "\\0",
|
|
794
|
-
"\a" => "\\a",
|
|
795
|
-
"\b" => "\\b",
|
|
796
|
-
"\t" => "\\t",
|
|
797
|
-
"\n" => "\\n",
|
|
798
|
-
"\v" => "\\v",
|
|
799
|
-
"\f" => "\\f",
|
|
800
|
-
"\r" => "\\r",
|
|
801
|
-
"\e" => "\\e",
|
|
802
|
-
}.freeze
|
|
803
|
-
|
|
804
|
-
def emit(obj)
|
|
805
|
-
res = "---#{emit_node(obj, 0)}"
|
|
806
|
-
res << "...\n" if @open_ended
|
|
807
|
-
res
|
|
808
|
-
end
|
|
809
|
-
|
|
810
|
-
private
|
|
811
|
-
|
|
812
|
-
def emit_node(obj, indent, quote: false)
|
|
813
|
-
case obj
|
|
814
|
-
when Gem::Specification then emit_specification(obj, indent)
|
|
815
|
-
when Gem::Version then emit_version(obj, indent)
|
|
816
|
-
when Gem::Platform then emit_platform(obj, indent)
|
|
817
|
-
when Gem::Requirement then emit_requirement(obj, indent)
|
|
818
|
-
when Gem::Dependency then emit_dependency(obj, indent)
|
|
819
|
-
when Hash then emit_hash(obj, indent)
|
|
820
|
-
when Array then emit_array(obj, indent)
|
|
821
|
-
when Time then emit_time(obj)
|
|
822
|
-
when String then emit_string(obj, indent, quote: quote)
|
|
823
|
-
when NilClass
|
|
824
|
-
"\n"
|
|
825
|
-
when Numeric, Symbol, TrueClass, FalseClass
|
|
826
|
-
" #{obj.inspect}\n"
|
|
827
|
-
else
|
|
828
|
-
" #{quote_string(obj.to_s)}\n"
|
|
829
|
-
end
|
|
830
|
-
end
|
|
831
|
-
|
|
832
|
-
def emit_specification(spec, indent)
|
|
833
|
-
parts = [" !ruby/object:Gem::Specification\n"]
|
|
834
|
-
parts << "#{pad(indent)}name:#{emit_node(spec.name, indent + 2)}"
|
|
835
|
-
parts << "#{pad(indent)}version:#{emit_node(spec.version, indent + 2)}"
|
|
836
|
-
parts << "#{pad(indent)}platform: #{spec.platform}\n"
|
|
837
|
-
if spec.platform.to_s != spec.original_platform.to_s
|
|
838
|
-
parts << "#{pad(indent)}original_platform: #{spec.original_platform}\n"
|
|
839
|
-
end
|
|
840
|
-
|
|
841
|
-
attributes = Gem::Specification.attribute_names.map(&:to_s).sort - %w[name version platform]
|
|
842
|
-
attributes.each do |name|
|
|
843
|
-
val = spec.instance_variable_get("@#{name}")
|
|
844
|
-
next if val.nil?
|
|
845
|
-
parts << "#{pad(indent)}#{name}:#{emit_node(val, indent + 2)}"
|
|
846
|
-
end
|
|
847
|
-
|
|
848
|
-
res = parts.join
|
|
849
|
-
res << "\n" unless res.end_with?("\n")
|
|
850
|
-
res
|
|
851
|
-
end
|
|
852
|
-
|
|
853
|
-
def emit_version(ver, indent)
|
|
854
|
-
" !ruby/object:Gem::Version\n" \
|
|
855
|
-
"#{pad(indent)}version: #{emit_node(ver.version.to_s, indent + 2).lstrip}"
|
|
856
|
-
end
|
|
857
|
-
|
|
858
|
-
def emit_platform(plat, indent)
|
|
859
|
-
" !ruby/object:Gem::Platform\n" \
|
|
860
|
-
"#{pad(indent)}cpu:#{emit_node(plat.cpu, indent + 2)}" \
|
|
861
|
-
"#{pad(indent)}os:#{emit_node(plat.os, indent + 2)}" \
|
|
862
|
-
"#{pad(indent)}version:#{emit_node(plat.version, indent + 2)}"
|
|
863
|
-
end
|
|
864
|
-
|
|
865
|
-
def emit_requirement(req, indent)
|
|
866
|
-
" !ruby/object:Gem::Requirement\n" \
|
|
867
|
-
"#{pad(indent)}requirements:#{emit_node(req.requirements, indent + 2)}"
|
|
868
|
-
end
|
|
869
|
-
|
|
870
|
-
def emit_dependency(dep, indent)
|
|
871
|
-
[
|
|
872
|
-
" !ruby/object:Gem::Dependency\n",
|
|
873
|
-
"#{pad(indent)}name: #{emit_node(dep.name, indent + 2).lstrip}",
|
|
874
|
-
"#{pad(indent)}requirement:#{emit_node(dep.requirement, indent + 2)}",
|
|
875
|
-
"#{pad(indent)}type: #{emit_node(dep.type, indent + 2).lstrip}",
|
|
876
|
-
"#{pad(indent)}prerelease: #{emit_node(dep.prerelease?, indent + 2).lstrip}",
|
|
877
|
-
"#{pad(indent)}version_requirements:#{emit_node(dep.requirement, indent + 2)}",
|
|
878
|
-
].join
|
|
879
|
-
end
|
|
880
|
-
|
|
881
|
-
def emit_hash(hash, indent)
|
|
882
|
-
if hash.empty?
|
|
883
|
-
" {}\n"
|
|
884
|
-
else
|
|
885
|
-
parts = ["\n"]
|
|
886
|
-
hash.each do |k, v|
|
|
887
|
-
is_symbol = k.is_a?(Symbol) || (k.is_a?(String) && k.start_with?(":"))
|
|
888
|
-
key_str = k.is_a?(Symbol) ? k.inspect : k.to_s
|
|
889
|
-
key_str = quote_string(key_str) if !is_symbol && needs_quoting?(key_str)
|
|
890
|
-
parts << "#{pad(indent)}#{key_str}:#{emit_node(v, indent + 2, quote: is_symbol)}"
|
|
891
|
-
end
|
|
892
|
-
parts.join
|
|
893
|
-
end
|
|
894
|
-
end
|
|
895
|
-
|
|
896
|
-
def emit_array(arr, indent)
|
|
897
|
-
if arr.empty?
|
|
898
|
-
" []\n"
|
|
899
|
-
else
|
|
900
|
-
parts = ["\n"]
|
|
901
|
-
arr.each do |v|
|
|
902
|
-
parts << "#{pad(indent)}-#{emit_node(v, indent + 2)}"
|
|
903
|
-
end
|
|
904
|
-
parts.join
|
|
905
|
-
end
|
|
906
|
-
end
|
|
907
|
-
|
|
908
|
-
def emit_time(time)
|
|
909
|
-
" #{time.utc.strftime("%Y-%m-%d %H:%M:%S.%N Z")}\n"
|
|
910
|
-
end
|
|
911
|
-
|
|
912
|
-
def emit_string(str, indent, quote: false)
|
|
913
|
-
# A CR cannot be represented in a block scalar because parsing
|
|
914
|
-
# normalizes CRLF line breaks to LF, so quote and escape instead.
|
|
915
|
-
if str.include?("\n") && !str.include?("\r")
|
|
916
|
-
emit_block_scalar(str, indent)
|
|
917
|
-
elsif needs_quoting?(str, quote)
|
|
918
|
-
" #{quote_string(str)}\n"
|
|
919
|
-
else
|
|
920
|
-
" #{str}\n"
|
|
921
|
-
end
|
|
922
|
-
end
|
|
923
|
-
|
|
924
|
-
def emit_block_scalar(str, indent)
|
|
925
|
-
# The root node has no parent to be indented from, so indent its
|
|
926
|
-
# content by one level like libyaml does.
|
|
927
|
-
indent = 2 if indent.zero?
|
|
928
|
-
parts = [" |#{block_scalar_header(str)}\n"]
|
|
929
|
-
str.each_line do |line|
|
|
930
|
-
parts << (line == "\n" ? line : "#{pad(indent)}#{line}")
|
|
931
|
-
end
|
|
932
|
-
res = parts.join
|
|
933
|
-
res << "\n" unless res.end_with?("\n")
|
|
934
|
-
res
|
|
935
|
-
end
|
|
936
|
-
|
|
937
|
-
# Mirrors libyaml: an explicit indentation indicator when the first
|
|
938
|
-
# line is empty or starts with a space (a parser would otherwise take
|
|
939
|
-
# that whitespace as the block indentation and drop it), "-" when the
|
|
940
|
-
# content does not end with a line break and "+" when it ends with
|
|
941
|
-
# more than one, which also requires a document end marker.
|
|
942
|
-
def block_scalar_header(str)
|
|
943
|
-
header = +""
|
|
944
|
-
header << "2" if str.start_with?(" ", "\n")
|
|
945
|
-
if !str.end_with?("\n")
|
|
946
|
-
header << "-"
|
|
947
|
-
elsif str.end_with?("\n\n") || str == "\n"
|
|
948
|
-
header << "+"
|
|
949
|
-
@open_ended = true
|
|
950
|
-
end
|
|
951
|
-
header
|
|
952
|
-
end
|
|
953
|
-
|
|
954
|
-
def needs_quoting?(str, quote = false)
|
|
955
|
-
quote || str.empty? || str != str.strip || str =~ /[[:cntrl:]]/ ||
|
|
956
|
-
str =~ /^[!*&:@%$"'|`]/ || str =~ /^-?\d+(\.\d+)?$/ || str =~ /^[<>=-]/ ||
|
|
957
|
-
str == "true" || str == "false" || str == "nil" || str == "null" || str == "~" ||
|
|
958
|
-
str.include?(":") || str.include?("#") || str.include?("[") || str.include?("]") ||
|
|
959
|
-
str.include?("{") || str.include?("}") || str.include?(",")
|
|
960
|
-
end
|
|
961
|
-
|
|
962
|
-
def quote_string(str)
|
|
963
|
-
%("#{str.gsub(/[\\"]|[[:cntrl:]]/) {|c| STRING_ESCAPES[c] || format("\\x%02X", c.ord) }}")
|
|
964
|
-
end
|
|
965
|
-
|
|
966
|
-
def pad(indent)
|
|
967
|
-
" " * indent
|
|
968
|
-
end
|
|
969
|
-
end
|
|
970
|
-
|
|
971
|
-
module_function
|
|
972
|
-
|
|
973
|
-
def dump(obj)
|
|
974
|
-
Emitter.new.emit(obj)
|
|
975
|
-
end
|
|
976
|
-
|
|
977
|
-
def load(str, permitted_classes: [], permitted_symbols: [], aliases: true)
|
|
978
|
-
ast = Parser.new(str).parse
|
|
979
|
-
result = Builder.new(
|
|
980
|
-
permitted_classes: permitted_classes,
|
|
981
|
-
permitted_symbols: permitted_symbols,
|
|
982
|
-
aliases: aliases
|
|
983
|
-
).build(ast)
|
|
984
|
-
# Bundler 4.0 and older call Hash methods on what this returns for
|
|
985
|
-
# .bundle/config, which is just "---" once its last key is unset, so
|
|
986
|
-
# nil stays a Hash here as it did in RubyGems 4.0.
|
|
987
|
-
result.nil? ? {} : result
|
|
988
|
-
end
|
|
989
530
|
end
|
|
990
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'
|