bundler 2.5.16 → 2.6.2

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.
Files changed (170) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +194 -0
  3. data/bundler.gemspec +2 -2
  4. data/lib/bundler/build_metadata.rb +2 -2
  5. data/lib/bundler/cli/add.rb +3 -1
  6. data/lib/bundler/cli/check.rb +3 -3
  7. data/lib/bundler/cli/console.rb +0 -4
  8. data/lib/bundler/cli/doctor.rb +4 -4
  9. data/lib/bundler/cli/exec.rb +1 -0
  10. data/lib/bundler/cli/gem.rb +6 -3
  11. data/lib/bundler/cli/info.rb +2 -2
  12. data/lib/bundler/cli/inject.rb +1 -1
  13. data/lib/bundler/cli/install.rb +13 -4
  14. data/lib/bundler/cli/lock.rb +25 -6
  15. data/lib/bundler/cli/outdated.rb +16 -18
  16. data/lib/bundler/cli/pristine.rb +1 -1
  17. data/lib/bundler/cli/show.rb +2 -2
  18. data/lib/bundler/cli.rb +38 -68
  19. data/lib/bundler/compact_index_client/cache_file.rb +0 -5
  20. data/lib/bundler/compact_index_client/updater.rb +0 -11
  21. data/lib/bundler/definition.rb +186 -119
  22. data/lib/bundler/dependency.rb +1 -1
  23. data/lib/bundler/dsl.rb +67 -52
  24. data/lib/bundler/endpoint_specification.rb +10 -1
  25. data/lib/bundler/errors.rb +17 -5
  26. data/lib/bundler/feature_flag.rb +1 -0
  27. data/lib/bundler/fetcher/compact_index.rb +1 -1
  28. data/lib/bundler/fetcher.rb +12 -5
  29. data/lib/bundler/force_platform.rb +0 -2
  30. data/lib/bundler/gem_helpers.rb +21 -5
  31. data/lib/bundler/injector.rb +2 -2
  32. data/lib/bundler/inline.rb +42 -17
  33. data/lib/bundler/installer/gem_installer.rb +4 -2
  34. data/lib/bundler/installer/parallel_installer.rb +3 -2
  35. data/lib/bundler/installer/standalone.rb +2 -2
  36. data/lib/bundler/installer.rb +11 -47
  37. data/lib/bundler/lazy_specification.rb +74 -26
  38. data/lib/bundler/lockfile_generator.rb +1 -1
  39. data/lib/bundler/lockfile_parser.rb +10 -2
  40. data/lib/bundler/man/bundle-add.1 +42 -25
  41. data/lib/bundler/man/bundle-add.1.ronn +52 -23
  42. data/lib/bundler/man/bundle-binstubs.1 +7 -4
  43. data/lib/bundler/man/bundle-binstubs.1.ronn +6 -3
  44. data/lib/bundler/man/bundle-cache.1 +30 -2
  45. data/lib/bundler/man/bundle-cache.1.ronn +31 -2
  46. data/lib/bundler/man/bundle-check.1 +3 -3
  47. data/lib/bundler/man/bundle-check.1.ronn +4 -2
  48. data/lib/bundler/man/bundle-clean.1 +1 -1
  49. data/lib/bundler/man/bundle-config.1 +3 -5
  50. data/lib/bundler/man/bundle-config.1.ronn +2 -7
  51. data/lib/bundler/man/bundle-console.1 +2 -4
  52. data/lib/bundler/man/bundle-console.1.ronn +2 -7
  53. data/lib/bundler/man/bundle-doctor.1 +2 -2
  54. data/lib/bundler/man/bundle-doctor.1.ronn +1 -1
  55. data/lib/bundler/man/bundle-env.1 +9 -0
  56. data/lib/bundler/man/bundle-env.1.ronn +10 -0
  57. data/lib/bundler/man/bundle-exec.1 +5 -2
  58. data/lib/bundler/man/bundle-exec.1.ronn +4 -1
  59. data/lib/bundler/man/bundle-fund.1 +22 -0
  60. data/lib/bundler/man/bundle-fund.1.ronn +25 -0
  61. data/lib/bundler/man/bundle-gem.1 +17 -5
  62. data/lib/bundler/man/bundle-gem.1.ronn +27 -6
  63. data/lib/bundler/man/bundle-help.1 +1 -1
  64. data/lib/bundler/man/bundle-info.1 +5 -2
  65. data/lib/bundler/man/bundle-info.1.ronn +6 -2
  66. data/lib/bundler/man/bundle-init.1 +3 -3
  67. data/lib/bundler/man/bundle-init.1.ronn +3 -2
  68. data/lib/bundler/man/bundle-inject.1 +10 -2
  69. data/lib/bundler/man/bundle-inject.1.ronn +9 -1
  70. data/lib/bundler/man/bundle-install.1 +15 -12
  71. data/lib/bundler/man/bundle-install.1.ronn +22 -18
  72. data/lib/bundler/man/bundle-issue.1 +45 -0
  73. data/lib/bundler/man/bundle-issue.1.ronn +37 -0
  74. data/lib/bundler/man/bundle-licenses.1 +9 -0
  75. data/lib/bundler/man/bundle-licenses.1.ronn +10 -0
  76. data/lib/bundler/man/bundle-list.1 +1 -1
  77. data/lib/bundler/man/bundle-list.1.ronn +4 -1
  78. data/lib/bundler/man/bundle-lock.1 +21 -6
  79. data/lib/bundler/man/bundle-lock.1.ronn +25 -4
  80. data/lib/bundler/man/bundle-open.1 +2 -2
  81. data/lib/bundler/man/bundle-open.1.ronn +2 -1
  82. data/lib/bundler/man/bundle-outdated.1 +8 -5
  83. data/lib/bundler/man/bundle-outdated.1.ronn +8 -4
  84. data/lib/bundler/man/bundle-platform.1 +1 -1
  85. data/lib/bundler/man/bundle-plugin.1 +1 -1
  86. data/lib/bundler/man/bundle-pristine.1 +1 -1
  87. data/lib/bundler/man/bundle-pristine.1.ronn +1 -1
  88. data/lib/bundler/man/bundle-remove.1 +1 -1
  89. data/lib/bundler/man/bundle-remove.1.ronn +1 -1
  90. data/lib/bundler/man/bundle-show.1 +5 -2
  91. data/lib/bundler/man/bundle-show.1.ronn +4 -0
  92. data/lib/bundler/man/bundle-update.1 +13 -7
  93. data/lib/bundler/man/bundle-update.1.ronn +14 -6
  94. data/lib/bundler/man/bundle-version.1 +1 -1
  95. data/lib/bundler/man/bundle-viz.1 +4 -4
  96. data/lib/bundler/man/bundle-viz.1.ronn +7 -3
  97. data/lib/bundler/man/bundle.1 +1 -1
  98. data/lib/bundler/man/gemfile.5 +3 -1
  99. data/lib/bundler/man/gemfile.5.ronn +6 -0
  100. data/lib/bundler/man/index.txt +4 -0
  101. data/lib/bundler/materialization.rb +59 -0
  102. data/lib/bundler/plugin/api/source.rb +2 -1
  103. data/lib/bundler/plugin/events.rb +24 -0
  104. data/lib/bundler/plugin/installer.rb +1 -1
  105. data/lib/bundler/plugin.rb +20 -1
  106. data/lib/bundler/process_lock.rb +10 -14
  107. data/lib/bundler/remote_specification.rb +6 -1
  108. data/lib/bundler/resolver/base.rb +12 -6
  109. data/lib/bundler/resolver/candidate.rb +2 -2
  110. data/lib/bundler/resolver/package.rb +10 -1
  111. data/lib/bundler/resolver/spec_group.rb +4 -3
  112. data/lib/bundler/resolver.rb +36 -14
  113. data/lib/bundler/retry.rb +1 -1
  114. data/lib/bundler/ruby_version.rb +7 -1
  115. data/lib/bundler/rubygems_ext.rb +104 -51
  116. data/lib/bundler/rubygems_gem_installer.rb +7 -5
  117. data/lib/bundler/rubygems_integration.rb +23 -62
  118. data/lib/bundler/runtime.rb +22 -7
  119. data/lib/bundler/self_manager.rb +7 -7
  120. data/lib/bundler/settings.rb +6 -1
  121. data/lib/bundler/shared_helpers.rb +29 -17
  122. data/lib/bundler/source/git/git_proxy.rb +0 -2
  123. data/lib/bundler/source/git.rb +93 -40
  124. data/lib/bundler/source/metadata.rb +2 -3
  125. data/lib/bundler/source/path.rb +5 -3
  126. data/lib/bundler/source/rubygems.rb +6 -16
  127. data/lib/bundler/source_list.rb +1 -1
  128. data/lib/bundler/spec_set.rb +82 -57
  129. data/lib/bundler/stub_specification.rb +21 -2
  130. data/lib/bundler/templates/newgem/Gemfile.tt +0 -3
  131. data/lib/bundler/templates/newgem/README.md.tt +7 -3
  132. data/lib/bundler/templates/newgem/github/workflows/main.yml.tt +15 -15
  133. data/lib/bundler/templates/newgem/newgem.gemspec.tt +4 -4
  134. data/lib/bundler/ui/shell.rb +24 -2
  135. data/lib/bundler/ui/silent.rb +12 -1
  136. data/lib/bundler/uri_credentials_filter.rb +1 -1
  137. data/lib/bundler/vendor/fileutils/COPYING +56 -0
  138. data/lib/bundler/vendor/fileutils/lib/fileutils.rb +15 -13
  139. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +46 -8
  140. data/lib/bundler/vendor/securerandom/.document +1 -0
  141. data/lib/bundler/vendor/securerandom/COPYING +56 -0
  142. data/lib/bundler/vendor/securerandom/lib/securerandom.rb +102 -0
  143. data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +3 -5
  144. data/lib/bundler/vendor/thor/lib/thor/group.rb +11 -0
  145. data/lib/bundler/vendor/thor/lib/thor/parser/argument.rb +1 -4
  146. data/lib/bundler/vendor/thor/lib/thor/parser/option.rb +2 -2
  147. data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +2 -1
  148. data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +9 -9
  149. data/lib/bundler/vendor/thor/lib/thor/shell/html.rb +1 -1
  150. data/lib/bundler/vendor/thor/lib/thor/shell/table_printer.rb +5 -21
  151. data/lib/bundler/vendor/thor/lib/thor/util.rb +1 -1
  152. data/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
  153. data/lib/bundler/vendor/thor/lib/thor.rb +11 -0
  154. data/lib/bundler/vendor/uri/COPYING +56 -0
  155. data/lib/bundler/vendor/uri/lib/uri/common.rb +37 -14
  156. data/lib/bundler/vendor/uri/lib/uri/file.rb +3 -3
  157. data/lib/bundler/vendor/uri/lib/uri/ftp.rb +1 -1
  158. data/lib/bundler/vendor/uri/lib/uri/generic.rb +16 -26
  159. data/lib/bundler/vendor/uri/lib/uri/http.rb +2 -2
  160. data/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +10 -3
  161. data/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +26 -3
  162. data/lib/bundler/vendor/uri/lib/uri/version.rb +1 -1
  163. data/lib/bundler/vendor/uri/lib/uri.rb +9 -9
  164. data/lib/bundler/vendored_securerandom.rb +12 -0
  165. data/lib/bundler/version.rb +1 -1
  166. data/lib/bundler/yaml_serializer.rb +1 -1
  167. data/lib/bundler.rb +68 -36
  168. metadata +20 -10
  169. data/lib/bundler/vendor/fileutils/LICENSE.txt +0 -22
  170. data/lib/bundler/vendor/uri/LICENSE.txt +0 -22
@@ -250,7 +250,8 @@ class Bundler::Thor
250
250
  @parsing_options
251
251
  end
252
252
 
253
- # Parse boolean values which can be given as --foo=true, --foo or --no-foo.
253
+ # Parse boolean values which can be given as --foo=true or --foo for true values, or
254
+ # --foo=false, --no-foo or --skip-foo for false values.
254
255
  #
255
256
  def parse_boolean(switch)
256
257
  if current_is_value?
@@ -67,15 +67,15 @@ class Bundler::Thor
67
67
  # Readline.
68
68
  #
69
69
  # ==== Example
70
- # ask("What is your name?")
70
+ # ask("What is your name?")
71
71
  #
72
- # ask("What is the planet furthest from the sun?", :default => "Pluto")
72
+ # ask("What is the planet furthest from the sun?", :default => "Neptune")
73
73
  #
74
- # ask("What is your favorite Neopolitan flavor?", :limited_to => ["strawberry", "chocolate", "vanilla"])
74
+ # ask("What is your favorite Neopolitan flavor?", :limited_to => ["strawberry", "chocolate", "vanilla"])
75
75
  #
76
- # ask("What is your password?", :echo => false)
76
+ # ask("What is your password?", :echo => false)
77
77
  #
78
- # ask("Where should the file be saved?", :path => true)
78
+ # ask("Where should the file be saved?", :path => true)
79
79
  #
80
80
  def ask(statement, *args)
81
81
  options = args.last.is_a?(Hash) ? args.pop : {}
@@ -93,7 +93,7 @@ class Bundler::Thor
93
93
  # are passed straight to puts (behavior got from Highline).
94
94
  #
95
95
  # ==== Example
96
- # say("I know you knew that.")
96
+ # say("I know you knew that.")
97
97
  #
98
98
  def say(message = "", color = nil, force_new_line = (message.to_s !~ /( |\t)\Z/))
99
99
  return if quiet?
@@ -110,7 +110,7 @@ class Bundler::Thor
110
110
  # are passed straight to puts (behavior got from Highline).
111
111
  #
112
112
  # ==== Example
113
- # say_error("error: something went wrong")
113
+ # say_error("error: something went wrong")
114
114
  #
115
115
  def say_error(message = "", color = nil, force_new_line = (message.to_s !~ /( |\t)\Z/))
116
116
  return if quiet?
@@ -143,14 +143,14 @@ class Bundler::Thor
143
143
  stdout.flush
144
144
  end
145
145
 
146
- # Make a question the to user and returns true if the user replies "y" or
146
+ # Asks the user a question and returns true if the user replies "y" or
147
147
  # "yes".
148
148
  #
149
149
  def yes?(statement, color = nil)
150
150
  !!(ask(statement, color, add_to_history: false) =~ is?(:yes))
151
151
  end
152
152
 
153
- # Make a question the to user and returns true if the user replies "n" or
153
+ # Asks the user a question and returns true if the user replies "n" or
154
154
  # "no".
155
155
  #
156
156
  def no?(statement, color = nil)
@@ -64,7 +64,7 @@ class Bundler::Thor
64
64
  # Ask something to the user and receives a response.
65
65
  #
66
66
  # ==== Example
67
- # ask("What is your name?")
67
+ # ask("What is your name?")
68
68
  #
69
69
  # TODO: Implement #ask for Bundler::Thor::Shell::HTML
70
70
  def ask(statement, color = nil)
@@ -102,33 +102,17 @@ class Bundler::Thor
102
102
 
103
103
  def truncate(string)
104
104
  return string unless @truncate
105
- as_unicode do
106
- chars = string.chars.to_a
107
- if chars.length <= @truncate
108
- chars.join
109
- else
110
- chars[0, @truncate - 3 - @indent].join + "..."
111
- end
105
+ chars = string.chars.to_a
106
+ if chars.length <= @truncate
107
+ chars.join
108
+ else
109
+ chars[0, @truncate - 3 - @indent].join + "..."
112
110
  end
113
111
  end
114
112
 
115
113
  def indentation
116
114
  " " * @indent
117
115
  end
118
-
119
- if "".respond_to?(:encode)
120
- def as_unicode
121
- yield
122
- end
123
- else
124
- def as_unicode
125
- old = $KCODE # rubocop:disable Style/GlobalVars
126
- $KCODE = "U" # rubocop:disable Style/GlobalVars
127
- yield
128
- ensure
129
- $KCODE = old # rubocop:disable Style/GlobalVars
130
- end
131
- end
132
116
  end
133
117
  end
134
118
  end
@@ -133,7 +133,7 @@ class Bundler::Thor
133
133
  *pieces, command = namespace.split(":")
134
134
  namespace = pieces.join(":")
135
135
  namespace = "default" if namespace.empty?
136
- klass = Bundler::Thor::Base.subclasses.detect { |thor| thor.namespace == namespace && thor.commands.keys.include?(command) }
136
+ klass = Bundler::Thor::Base.subclasses.detect { |thor| thor.namespace == namespace && thor.command_exists?(command) }
137
137
  end
138
138
  unless klass # look for a Bundler::Thor::Group with the right name
139
139
  klass = Bundler::Thor::Util.find_by_namespace(namespace)
@@ -1,3 +1,3 @@
1
1
  class Bundler::Thor
2
- VERSION = "1.3.0"
2
+ VERSION = "1.3.2"
3
3
  end
@@ -439,6 +439,17 @@ class Bundler::Thor
439
439
  command && disable_required_check.include?(command.name.to_sym)
440
440
  end
441
441
 
442
+ # Checks if a specified command exists.
443
+ #
444
+ # ==== Parameters
445
+ # command_name<String>:: The name of the command to check for existence.
446
+ #
447
+ # ==== Returns
448
+ # Boolean:: +true+ if the command exists, +false+ otherwise.
449
+ def command_exists?(command_name) #:nodoc:
450
+ commands.keys.include?(normalize_command_name(command_name))
451
+ end
452
+
442
453
  protected
443
454
 
444
455
  # Returns this class exclusive options array set.
@@ -0,0 +1,56 @@
1
+ Ruby is copyrighted free software by Yukihiro Matsumoto <matz@netlab.jp>.
2
+ You can redistribute it and/or modify it under either the terms of the
3
+ 2-clause BSDL (see the file BSDL), or the conditions below:
4
+
5
+ 1. You may make and give away verbatim copies of the source form of the
6
+ software without restriction, provided that you duplicate all of the
7
+ original copyright notices and associated disclaimers.
8
+
9
+ 2. You may modify your copy of the software in any way, provided that
10
+ you do at least ONE of the following:
11
+
12
+ a. place your modifications in the Public Domain or otherwise
13
+ make them Freely Available, such as by posting said
14
+ modifications to Usenet or an equivalent medium, or by allowing
15
+ the author to include your modifications in the software.
16
+
17
+ b. use the modified software only within your corporation or
18
+ organization.
19
+
20
+ c. give non-standard binaries non-standard names, with
21
+ instructions on where to get the original software distribution.
22
+
23
+ d. make other distribution arrangements with the author.
24
+
25
+ 3. You may distribute the software in object code or binary form,
26
+ provided that you do at least ONE of the following:
27
+
28
+ a. distribute the binaries and library files of the software,
29
+ together with instructions (in the manual page or equivalent)
30
+ on where to get the original distribution.
31
+
32
+ b. accompany the distribution with the machine-readable source of
33
+ the software.
34
+
35
+ c. give non-standard binaries non-standard names, with
36
+ instructions on where to get the original software distribution.
37
+
38
+ d. make other distribution arrangements with the author.
39
+
40
+ 4. You may modify and include the part of the software into any other
41
+ software (possibly commercial). But some files in the distribution
42
+ are not written by the author, so that they are not under these terms.
43
+
44
+ For the list of those files and their copying conditions, see the
45
+ file LEGAL.
46
+
47
+ 5. The scripts and library files supplied as input to or produced as
48
+ output from the software do not automatically fall under the
49
+ copyright of the software, but belong to whomever generated them,
50
+ and may be sold commercially, and may be aggregated with this
51
+ software.
52
+
53
+ 6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
54
+ IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
55
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
56
+ PURPOSE.
@@ -13,24 +13,47 @@ require_relative "rfc2396_parser"
13
13
  require_relative "rfc3986_parser"
14
14
 
15
15
  module Bundler::URI
16
- include RFC2396_REGEXP
16
+ RFC2396_PARSER = RFC2396_Parser.new
17
+ Ractor.make_shareable(RFC2396_PARSER) if defined?(Ractor)
17
18
 
18
- REGEXP = RFC2396_REGEXP
19
- Parser = RFC2396_Parser
20
19
  RFC3986_PARSER = RFC3986_Parser.new
21
20
  Ractor.make_shareable(RFC3986_PARSER) if defined?(Ractor)
22
21
 
23
- # Bundler::URI::Parser.new
24
- DEFAULT_PARSER = Parser.new
25
- DEFAULT_PARSER.pattern.each_pair do |sym, str|
26
- unless REGEXP::PATTERN.const_defined?(sym)
27
- REGEXP::PATTERN.const_set(sym, str)
22
+ DEFAULT_PARSER = RFC3986_PARSER
23
+ Ractor.make_shareable(DEFAULT_PARSER) if defined?(Ractor)
24
+
25
+ def self.parser=(parser = RFC3986_PARSER)
26
+ remove_const(:Parser) if defined?(::Bundler::URI::Parser)
27
+ const_set("Parser", parser.class)
28
+
29
+ remove_const(:REGEXP) if defined?(::Bundler::URI::REGEXP)
30
+ remove_const(:PATTERN) if defined?(::Bundler::URI::PATTERN)
31
+ if Parser == RFC2396_Parser
32
+ const_set("REGEXP", Bundler::URI::RFC2396_REGEXP)
33
+ const_set("PATTERN", Bundler::URI::RFC2396_REGEXP::PATTERN)
34
+ end
35
+
36
+ Parser.new.regexp.each_pair do |sym, str|
37
+ remove_const(sym) if const_defined?(sym, false)
38
+ const_set(sym, str)
28
39
  end
29
40
  end
30
- DEFAULT_PARSER.regexp.each_pair do |sym, str|
31
- const_set(sym, str)
41
+ self.parser = RFC3986_PARSER
42
+
43
+ def self.const_missing(const)
44
+ if const == :REGEXP
45
+ warn "Bundler::URI::REGEXP is obsolete. Use Bundler::URI::RFC2396_REGEXP explicitly.", uplevel: 1 if $VERBOSE
46
+ Bundler::URI::RFC2396_REGEXP
47
+ elsif value = RFC2396_PARSER.regexp[const]
48
+ warn "Bundler::URI::#{const} is obsolete. Use RFC2396_PARSER.regexp[#{const.inspect}] explicitly.", uplevel: 1 if $VERBOSE
49
+ value
50
+ elsif value = RFC2396_Parser.const_get(const)
51
+ warn "Bundler::URI::#{const} is obsolete. Use RFC2396_Parser::#{const} explicitly.", uplevel: 1 if $VERBOSE
52
+ value
53
+ else
54
+ super
55
+ end
32
56
  end
33
- Ractor.make_shareable(DEFAULT_PARSER) if defined?(Ractor)
34
57
 
35
58
  module Util # :nodoc:
36
59
  def make_components_hash(klass, array_hash)
@@ -168,7 +191,7 @@ module Bundler::URI
168
191
  # ["fragment", "top"]]
169
192
  #
170
193
  def self.split(uri)
171
- RFC3986_PARSER.split(uri)
194
+ DEFAULT_PARSER.split(uri)
172
195
  end
173
196
 
174
197
  # Returns a new \Bundler::URI object constructed from the given string +uri+:
@@ -182,7 +205,7 @@ module Bundler::URI
182
205
  # if it may contain invalid Bundler::URI characters.
183
206
  #
184
207
  def self.parse(uri)
185
- RFC3986_PARSER.parse(uri)
208
+ DEFAULT_PARSER.parse(uri)
186
209
  end
187
210
 
188
211
  # Merges the given Bundler::URI strings +str+
@@ -209,7 +232,7 @@ module Bundler::URI
209
232
  # # => #<Bundler::URI::HTTP http://example.com/foo/bar>
210
233
  #
211
234
  def self.join(*str)
212
- RFC3986_PARSER.join(*str)
235
+ DEFAULT_PARSER.join(*str)
213
236
  end
214
237
 
215
238
  #
@@ -70,17 +70,17 @@ module Bundler::URI
70
70
 
71
71
  # raise InvalidURIError
72
72
  def check_userinfo(user)
73
- raise Bundler::URI::InvalidURIError, "can not set userinfo for file Bundler::URI"
73
+ raise Bundler::URI::InvalidURIError, "cannot set userinfo for file Bundler::URI"
74
74
  end
75
75
 
76
76
  # raise InvalidURIError
77
77
  def check_user(user)
78
- raise Bundler::URI::InvalidURIError, "can not set user for file Bundler::URI"
78
+ raise Bundler::URI::InvalidURIError, "cannot set user for file Bundler::URI"
79
79
  end
80
80
 
81
81
  # raise InvalidURIError
82
82
  def check_password(user)
83
- raise Bundler::URI::InvalidURIError, "can not set password for file Bundler::URI"
83
+ raise Bundler::URI::InvalidURIError, "cannot set password for file Bundler::URI"
84
84
  end
85
85
 
86
86
  # do nothing
@@ -17,7 +17,7 @@ module Bundler::URI
17
17
  # This class will be redesigned because of difference of implementations;
18
18
  # the structure of its path. draft-hoffman-ftp-uri-04 is a draft but it
19
19
  # is a good summary about the de facto spec.
20
- # http://tools.ietf.org/html/draft-hoffman-ftp-uri-04
20
+ # https://datatracker.ietf.org/doc/html/draft-hoffman-ftp-uri-04
21
21
  #
22
22
  class FTP < Generic
23
23
  # A Default port of 21 for Bundler::URI::FTP.
@@ -82,7 +82,7 @@ module Bundler::URI
82
82
  if args.kind_of?(Array)
83
83
  return self.build(args.collect{|x|
84
84
  if x.is_a?(String)
85
- DEFAULT_PARSER.escape(x)
85
+ Bundler::URI::RFC2396_PARSER.escape(x)
86
86
  else
87
87
  x
88
88
  end
@@ -91,7 +91,7 @@ module Bundler::URI
91
91
  tmp = {}
92
92
  args.each do |key, value|
93
93
  tmp[key] = if value
94
- DEFAULT_PARSER.escape(value)
94
+ Bundler::URI::RFC2396_PARSER.escape(value)
95
95
  else
96
96
  value
97
97
  end
@@ -393,7 +393,7 @@ module Bundler::URI
393
393
  def check_user(v)
394
394
  if @opaque
395
395
  raise InvalidURIError,
396
- "can not set user with opaque"
396
+ "cannot set user with opaque"
397
397
  end
398
398
 
399
399
  return v unless v
@@ -417,7 +417,7 @@ module Bundler::URI
417
417
  def check_password(v, user = @user)
418
418
  if @opaque
419
419
  raise InvalidURIError,
420
- "can not set password with opaque"
420
+ "cannot set password with opaque"
421
421
  end
422
422
  return v unless v
423
423
 
@@ -596,7 +596,7 @@ module Bundler::URI
596
596
 
597
597
  if @opaque
598
598
  raise InvalidURIError,
599
- "can not set host with registry or opaque"
599
+ "cannot set host with registry or opaque"
600
600
  elsif parser.regexp[:HOST] !~ v
601
601
  raise InvalidComponentError,
602
602
  "bad component(expected host component): #{v}"
@@ -685,7 +685,7 @@ module Bundler::URI
685
685
 
686
686
  if @opaque
687
687
  raise InvalidURIError,
688
- "can not set port with registry or opaque"
688
+ "cannot set port with registry or opaque"
689
689
  elsif !v.kind_of?(Integer) && parser.regexp[:PORT] !~ v
690
690
  raise InvalidComponentError,
691
691
  "bad component(expected port component): #{v.inspect}"
@@ -733,17 +733,17 @@ module Bundler::URI
733
733
  end
734
734
 
735
735
  def check_registry(v) # :nodoc:
736
- raise InvalidURIError, "can not set registry"
736
+ raise InvalidURIError, "cannot set registry"
737
737
  end
738
738
  private :check_registry
739
739
 
740
740
  def set_registry(v) #:nodoc:
741
- raise InvalidURIError, "can not set registry"
741
+ raise InvalidURIError, "cannot set registry"
742
742
  end
743
743
  protected :set_registry
744
744
 
745
745
  def registry=(v)
746
- raise InvalidURIError, "can not set registry"
746
+ raise InvalidURIError, "cannot set registry"
747
747
  end
748
748
 
749
749
  #
@@ -866,7 +866,7 @@ module Bundler::URI
866
866
  # hier_part = ( net_path | abs_path ) [ "?" query ]
867
867
  if @host || @port || @user || @path # userinfo = @user + ':' + @password
868
868
  raise InvalidURIError,
869
- "can not set opaque with host, port, userinfo or path"
869
+ "cannot set opaque with host, port, userinfo or path"
870
870
  elsif v && parser.regexp[:OPAQUE] !~ v
871
871
  raise InvalidComponentError,
872
872
  "bad component(expected opaque component): #{v}"
@@ -945,7 +945,7 @@ module Bundler::URI
945
945
  # == Description
946
946
  #
947
947
  # Bundler::URI has components listed in order of decreasing significance from left to right,
948
- # see RFC3986 https://tools.ietf.org/html/rfc3986 1.2.3.
948
+ # see RFC3986 https://www.rfc-editor.org/rfc/rfc3986 1.2.3.
949
949
  #
950
950
  # == Usage
951
951
  #
@@ -1235,7 +1235,7 @@ module Bundler::URI
1235
1235
  return rel, rel
1236
1236
  end
1237
1237
 
1238
- # you can modify `rel', but can not `oth'.
1238
+ # you can modify `rel', but cannot `oth'.
1239
1239
  return oth, rel
1240
1240
  end
1241
1241
  private :route_from0
@@ -1260,7 +1260,7 @@ module Bundler::URI
1260
1260
  # #=> #<Bundler::URI::Generic /main.rbx?page=1>
1261
1261
  #
1262
1262
  def route_from(oth)
1263
- # you can modify `rel', but can not `oth'.
1263
+ # you can modify `rel', but cannot `oth'.
1264
1264
  begin
1265
1265
  oth, rel = route_from0(oth)
1266
1266
  rescue
@@ -1364,6 +1364,9 @@ module Bundler::URI
1364
1364
  str << ':'
1365
1365
  str << @port.to_s
1366
1366
  end
1367
+ if (@host || @port) && !@path.empty? && !@path.start_with?('/')
1368
+ str << '/'
1369
+ end
1367
1370
  str << @path
1368
1371
  if @query
1369
1372
  str << '?'
@@ -1399,19 +1402,6 @@ module Bundler::URI
1399
1402
  self.component_ary.eql?(oth.component_ary)
1400
1403
  end
1401
1404
 
1402
- =begin
1403
-
1404
- --- Bundler::URI::Generic#===(oth)
1405
-
1406
- =end
1407
- # def ===(oth)
1408
- # raise NotImplementedError
1409
- # end
1410
-
1411
- =begin
1412
- =end
1413
-
1414
-
1415
1405
  # Returns an Array of the components defined from the COMPONENT Array.
1416
1406
  def component_ary
1417
1407
  component.collect do |x|
@@ -85,7 +85,7 @@ module Bundler::URI
85
85
  # == Description
86
86
  #
87
87
  # Returns the authority for an HTTP uri, as defined in
88
- # https://datatracker.ietf.org/doc/html/rfc3986/#section-3.2.
88
+ # https://www.rfc-editor.org/rfc/rfc3986#section-3.2.
89
89
  #
90
90
  #
91
91
  # Example:
@@ -106,7 +106,7 @@ module Bundler::URI
106
106
  # == Description
107
107
  #
108
108
  # Returns the origin for an HTTP uri, as defined in
109
- # https://datatracker.ietf.org/doc/html/rfc6454.
109
+ # https://www.rfc-editor.org/rfc/rfc6454.
110
110
  #
111
111
  #
112
112
  # Example:
@@ -140,11 +140,11 @@ module Bundler::URI
140
140
 
141
141
  if !scheme
142
142
  raise InvalidURIError,
143
- "bad Bundler::URI(absolute but no scheme): #{uri}"
143
+ "bad Bundler::URI (absolute but no scheme): #{uri}"
144
144
  end
145
145
  if !opaque && (!path && (!host && !registry))
146
146
  raise InvalidURIError,
147
- "bad Bundler::URI(absolute but no path): #{uri}"
147
+ "bad Bundler::URI (absolute but no path): #{uri}"
148
148
  end
149
149
 
150
150
  when @regexp[:REL_URI]
@@ -173,7 +173,7 @@ module Bundler::URI
173
173
  # server = [ [ userinfo "@" ] hostport ]
174
174
 
175
175
  else
176
- raise InvalidURIError, "bad Bundler::URI(is not Bundler::URI?): #{uri}"
176
+ raise InvalidURIError, "bad Bundler::URI (is not Bundler::URI?): #{uri}"
177
177
  end
178
178
 
179
179
  path = '' if !path && !opaque # (see RFC2396 Section 5.2)
@@ -536,4 +536,11 @@ module Bundler::URI
536
536
  end
537
537
 
538
538
  end # class Parser
539
+
540
+ # Backward compatibility for Bundler::URI::REGEXP::PATTERN::*
541
+ RFC2396_Parser.new.pattern.each_pair do |sym, str|
542
+ unless RFC2396_REGEXP::PATTERN.const_defined?(sym, false)
543
+ RFC2396_REGEXP::PATTERN.const_set(sym, str)
544
+ end
545
+ end
539
546
  end # module Bundler::URI
@@ -78,7 +78,7 @@ module Bundler::URI
78
78
  begin
79
79
  uri = uri.to_str
80
80
  rescue NoMethodError
81
- raise InvalidURIError, "bad Bundler::URI(is not Bundler::URI?): #{uri.inspect}"
81
+ raise InvalidURIError, "bad Bundler::URI (is not Bundler::URI?): #{uri.inspect}"
82
82
  end
83
83
  uri.ascii_only? or
84
84
  raise InvalidURIError, "Bundler::URI must be ascii only #{uri.dump}"
@@ -127,7 +127,7 @@ module Bundler::URI
127
127
  m["fragment"]
128
128
  ]
129
129
  else
130
- raise InvalidURIError, "bad Bundler::URI(is not Bundler::URI?): #{uri.inspect}"
130
+ raise InvalidURIError, "bad Bundler::URI (is not Bundler::URI?): #{uri.inspect}"
131
131
  end
132
132
  end
133
133
 
@@ -135,12 +135,35 @@ module Bundler::URI
135
135
  Bundler::URI.for(*self.split(uri), self)
136
136
  end
137
137
 
138
-
139
138
  def join(*uris) # :nodoc:
140
139
  uris[0] = convert_to_uri(uris[0])
141
140
  uris.inject :merge
142
141
  end
143
142
 
143
+ # Compatibility for RFC2396 parser
144
+ def extract(str, schemes = nil, &block) # :nodoc:
145
+ warn "Bundler::URI::RFC3986_PARSER.extract is obsolete. Use Bundler::URI::RFC2396_PARSER.extract explicitly.", uplevel: 1 if $VERBOSE
146
+ RFC2396_PARSER.extract(str, schemes, &block)
147
+ end
148
+
149
+ # Compatibility for RFC2396 parser
150
+ def make_regexp(schemes = nil) # :nodoc:
151
+ warn "Bundler::URI::RFC3986_PARSER.make_regexp is obsolete. Use Bundler::URI::RFC2396_PARSER.make_regexp explicitly.", uplevel: 1 if $VERBOSE
152
+ RFC2396_PARSER.make_regexp(schemes)
153
+ end
154
+
155
+ # Compatibility for RFC2396 parser
156
+ def escape(str, unsafe = nil) # :nodoc:
157
+ warn "Bundler::URI::RFC3986_PARSER.escape is obsolete. Use Bundler::URI::RFC2396_PARSER.escape explicitly.", uplevel: 1 if $VERBOSE
158
+ unsafe ? RFC2396_PARSER.escape(str, unsafe) : RFC2396_PARSER.escape(str)
159
+ end
160
+
161
+ # Compatibility for RFC2396 parser
162
+ def unescape(str, escaped = nil) # :nodoc:
163
+ warn "Bundler::URI::RFC3986_PARSER.unescape is obsolete. Use Bundler::URI::RFC2396_PARSER.unescape explicitly.", uplevel: 1 if $VERBOSE
164
+ escaped ? RFC2396_PARSER.unescape(str, escaped) : RFC2396_PARSER.unescape(str)
165
+ end
166
+
144
167
  @@to_s = Kernel.instance_method(:to_s)
145
168
  if @@to_s.respond_to?(:bind_call)
146
169
  def inspect
@@ -1,6 +1,6 @@
1
1
  module Bundler::URI
2
2
  # :stopdoc:
3
- VERSION_CODE = '001300'.freeze
3
+ VERSION_CODE = '010002'.freeze
4
4
  VERSION = VERSION_CODE.scan(/../).collect{|n| n.to_i}.join('.').freeze
5
5
  # :startdoc:
6
6
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: false
2
2
  # Bundler::URI is a module providing classes to handle Uniform Resource Identifiers
3
- # (RFC2396[http://tools.ietf.org/html/rfc2396]).
3
+ # (RFC2396[https://www.rfc-editor.org/rfc/rfc2396]).
4
4
  #
5
5
  # == Features
6
6
  #
@@ -47,14 +47,14 @@
47
47
  # A good place to view an RFC spec is http://www.ietf.org/rfc.html.
48
48
  #
49
49
  # Here is a list of all related RFC's:
50
- # - RFC822[http://tools.ietf.org/html/rfc822]
51
- # - RFC1738[http://tools.ietf.org/html/rfc1738]
52
- # - RFC2255[http://tools.ietf.org/html/rfc2255]
53
- # - RFC2368[http://tools.ietf.org/html/rfc2368]
54
- # - RFC2373[http://tools.ietf.org/html/rfc2373]
55
- # - RFC2396[http://tools.ietf.org/html/rfc2396]
56
- # - RFC2732[http://tools.ietf.org/html/rfc2732]
57
- # - RFC3986[http://tools.ietf.org/html/rfc3986]
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
58
  #
59
59
  # == Class tree
60
60
  #
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Use RubyGems vendored copy when available. Otherwise fallback to Bundler
4
+ # vendored copy. The vendored copy in Bundler can be removed once support for
5
+ # RubyGems 3.5.18 is dropped.
6
+
7
+ begin
8
+ require "rubygems/vendored_securerandom"
9
+ rescue LoadError
10
+ require_relative "vendor/securerandom/lib/securerandom"
11
+ Gem::SecureRandom = Bundler::SecureRandom
12
+ end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: false
2
2
 
3
3
  module Bundler
4
- VERSION = "2.5.16".freeze
4
+ VERSION = "2.6.2".freeze
5
5
 
6
6
  def self.bundler_major_version
7
7
  @bundler_major_version ||= VERSION.split(".").first.to_i
@@ -41,7 +41,7 @@ module Bundler
41
41
  HASH_REGEX = /
42
42
  ^
43
43
  ([ ]*) # indentations
44
- (.+) # key
44
+ ([^#]+) # key excludes comment char '#'
45
45
  (?::(?=(?:\s|$))) # : (without the lookahead the #key includes this when : is present in value)
46
46
  [ ]?
47
47
  (['"]?) # optional opening quote