bundler 2.7.2 → 4.0.0.beta1

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 (135) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +990 -917
  3. data/README.md +4 -4
  4. data/bundler.gemspec +3 -3
  5. data/lib/bundler/build_metadata.rb +2 -2
  6. data/lib/bundler/capistrano.rb +1 -19
  7. data/lib/bundler/cli/cache.rb +1 -11
  8. data/lib/bundler/cli/common.rb +20 -3
  9. data/lib/bundler/cli/config.rb +1 -2
  10. data/lib/bundler/cli/console.rb +5 -0
  11. data/lib/bundler/cli/exec.rb +29 -4
  12. data/lib/bundler/cli/gem.rb +19 -33
  13. data/lib/bundler/cli/install.rb +7 -82
  14. data/lib/bundler/cli/issue.rb +2 -2
  15. data/lib/bundler/cli/list.rb +33 -2
  16. data/lib/bundler/cli/plugin.rb +5 -1
  17. data/lib/bundler/cli/show.rb +1 -1
  18. data/lib/bundler/cli/update.rb +3 -3
  19. data/lib/bundler/cli.rb +75 -83
  20. data/lib/bundler/compact_index_client.rb +0 -1
  21. data/lib/bundler/current_ruby.rb +3 -15
  22. data/lib/bundler/definition.rb +45 -35
  23. data/lib/bundler/deployment.rb +1 -64
  24. data/lib/bundler/digest.rb +1 -1
  25. data/lib/bundler/dsl.rb +13 -35
  26. data/lib/bundler/endpoint_specification.rb +0 -22
  27. data/lib/bundler/errors.rb +1 -5
  28. data/lib/bundler/feature_flag.rb +0 -33
  29. data/lib/bundler/fetcher/compact_index.rb +1 -1
  30. data/lib/bundler/friendly_errors.rb +2 -2
  31. data/lib/bundler/index.rb +0 -7
  32. data/lib/bundler/inline.rb +1 -1
  33. data/lib/bundler/installer/gem_installer.rb +0 -11
  34. data/lib/bundler/installer.rb +0 -6
  35. data/lib/bundler/lockfile_generator.rb +1 -1
  36. data/lib/bundler/lockfile_parser.rb +2 -12
  37. data/lib/bundler/man/bundle-add.1 +1 -1
  38. data/lib/bundler/man/bundle-binstubs.1 +3 -6
  39. data/lib/bundler/man/bundle-binstubs.1.ronn +4 -6
  40. data/lib/bundler/man/bundle-cache.1 +2 -14
  41. data/lib/bundler/man/bundle-cache.1.ronn +1 -14
  42. data/lib/bundler/man/bundle-check.1 +2 -5
  43. data/lib/bundler/man/bundle-check.1.ronn +0 -5
  44. data/lib/bundler/man/bundle-clean.1 +1 -1
  45. data/lib/bundler/man/bundle-config.1 +6 -33
  46. data/lib/bundler/man/bundle-config.1.ronn +20 -55
  47. data/lib/bundler/man/bundle-console.1 +1 -1
  48. data/lib/bundler/man/bundle-doctor.1 +1 -1
  49. data/lib/bundler/man/bundle-env.1 +1 -1
  50. data/lib/bundler/man/bundle-exec.1 +2 -5
  51. data/lib/bundler/man/bundle-exec.1.ronn +1 -5
  52. data/lib/bundler/man/bundle-fund.1 +1 -1
  53. data/lib/bundler/man/bundle-gem.1 +3 -6
  54. data/lib/bundler/man/bundle-gem.1.ronn +2 -5
  55. data/lib/bundler/man/bundle-help.1 +1 -1
  56. data/lib/bundler/man/bundle-info.1 +1 -1
  57. data/lib/bundler/man/bundle-init.1 +1 -1
  58. data/lib/bundler/man/bundle-install.1 +8 -59
  59. data/lib/bundler/man/bundle-install.1.ronn +12 -107
  60. data/lib/bundler/man/bundle-issue.1 +1 -1
  61. data/lib/bundler/man/bundle-licenses.1 +1 -1
  62. data/lib/bundler/man/bundle-list.1 +6 -1
  63. data/lib/bundler/man/bundle-list.1.ronn +5 -0
  64. data/lib/bundler/man/bundle-lock.1 +1 -1
  65. data/lib/bundler/man/bundle-open.1 +1 -1
  66. data/lib/bundler/man/bundle-outdated.1 +1 -1
  67. data/lib/bundler/man/bundle-platform.1 +1 -1
  68. data/lib/bundler/man/bundle-plugin.1 +2 -9
  69. data/lib/bundler/man/bundle-plugin.1.ronn +0 -8
  70. data/lib/bundler/man/bundle-pristine.1 +1 -1
  71. data/lib/bundler/man/bundle-remove.1 +2 -8
  72. data/lib/bundler/man/bundle-remove.1.ronn +1 -8
  73. data/lib/bundler/man/bundle-show.1 +2 -5
  74. data/lib/bundler/man/bundle-show.1.ronn +0 -4
  75. data/lib/bundler/man/bundle-update.1 +1 -1
  76. data/lib/bundler/man/bundle-version.1 +1 -1
  77. data/lib/bundler/man/bundle.1 +1 -10
  78. data/lib/bundler/man/bundle.1.ronn +0 -9
  79. data/lib/bundler/man/gemfile.5 +1 -1
  80. data/lib/bundler/man/index.txt +0 -2
  81. data/lib/bundler/materialization.rb +1 -1
  82. data/lib/bundler/plugin/installer.rb +0 -10
  83. data/lib/bundler/plugin/source_list.rb +1 -1
  84. data/lib/bundler/plugin.rb +1 -1
  85. data/lib/bundler/resolver.rb +1 -1
  86. data/lib/bundler/ruby_dsl.rb +2 -0
  87. data/lib/bundler/ruby_version.rb +1 -3
  88. data/lib/bundler/rubygems_ext.rb +1 -1
  89. data/lib/bundler/rubygems_gem_installer.rb +1 -1
  90. data/lib/bundler/rubygems_integration.rb +1 -5
  91. data/lib/bundler/self_manager.rb +1 -1
  92. data/lib/bundler/settings.rb +7 -26
  93. data/lib/bundler/shared_helpers.rb +8 -20
  94. data/lib/bundler/source/git/git_proxy.rb +3 -11
  95. data/lib/bundler/source/git.rb +2 -3
  96. data/lib/bundler/source/path.rb +3 -7
  97. data/lib/bundler/source/rubygems.rb +11 -17
  98. data/lib/bundler/source.rb +1 -1
  99. data/lib/bundler/source_list.rb +4 -45
  100. data/lib/bundler/source_map.rb +2 -5
  101. data/lib/bundler/spec_set.rb +6 -15
  102. data/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +7 -129
  103. data/lib/bundler/templates/newgem/circleci/config.yml.tt +12 -0
  104. data/lib/bundler/templates/newgem/ext/newgem/Cargo.toml.tt +1 -1
  105. data/lib/bundler/templates/newgem/ext/newgem/extconf-go.rb.tt +11 -0
  106. data/lib/bundler/templates/newgem/ext/newgem/go.mod.tt +5 -0
  107. data/lib/bundler/templates/newgem/ext/newgem/newgem-go.c.tt +2 -0
  108. data/lib/bundler/templates/newgem/ext/newgem/newgem.go.tt +31 -0
  109. data/lib/bundler/templates/newgem/github/workflows/main.yml.tt +6 -0
  110. data/lib/bundler/templates/newgem/gitlab-ci.yml.tt +9 -0
  111. data/lib/bundler/templates/newgem/newgem.gemspec.tt +4 -1
  112. data/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +26 -23
  113. data/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +1 -1
  114. data/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +50 -6
  115. data/lib/bundler/vendor/fileutils/lib/fileutils.rb +57 -52
  116. data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +5 -2
  117. data/lib/bundler/vendor/thor/lib/thor/runner.rb +1 -1
  118. data/lib/bundler/vendor/uri/lib/uri/common.rb +57 -15
  119. data/lib/bundler/vendor/uri/lib/uri/file.rb +1 -1
  120. data/lib/bundler/vendor/uri/lib/uri/generic.rb +34 -21
  121. data/lib/bundler/vendor/uri/lib/uri/http.rb +12 -0
  122. data/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +9 -8
  123. data/lib/bundler/vendor/uri/lib/uri/version.rb +2 -2
  124. data/lib/bundler/version.rb +1 -1
  125. data/lib/bundler/vlad.rb +1 -14
  126. data/lib/bundler.rb +6 -28
  127. metadata +9 -13
  128. data/lib/bundler/cli/inject.rb +0 -60
  129. data/lib/bundler/cli/viz.rb +0 -31
  130. data/lib/bundler/graph.rb +0 -152
  131. data/lib/bundler/man/bundle-inject.1 +0 -31
  132. data/lib/bundler/man/bundle-inject.1.ronn +0 -32
  133. data/lib/bundler/man/bundle-viz.1 +0 -30
  134. data/lib/bundler/man/bundle-viz.1.ronn +0 -36
  135. data/lib/bundler/similarity_detector.rb +0 -63
@@ -30,6 +30,9 @@ module Bundler::URI
30
30
  remove_const(:Parser) if defined?(::Bundler::URI::Parser)
31
31
  const_set("Parser", parser.class)
32
32
 
33
+ remove_const(:PARSER) if defined?(::Bundler::URI::PARSER)
34
+ const_set("PARSER", parser)
35
+
33
36
  remove_const(:REGEXP) if defined?(::Bundler::URI::REGEXP)
34
37
  remove_const(:PATTERN) if defined?(::Bundler::URI::PATTERN)
35
38
  if Parser == RFC2396_Parser
@@ -49,10 +52,10 @@ module Bundler::URI
49
52
  warn "Bundler::URI::REGEXP is obsolete. Use Bundler::URI::RFC2396_REGEXP explicitly.", uplevel: 1 if $VERBOSE
50
53
  Bundler::URI::RFC2396_REGEXP
51
54
  elsif value = RFC2396_PARSER.regexp[const]
52
- warn "Bundler::URI::#{const} is obsolete. Use RFC2396_PARSER.regexp[#{const.inspect}] explicitly.", uplevel: 1 if $VERBOSE
55
+ warn "Bundler::URI::#{const} is obsolete. Use Bundler::URI::RFC2396_PARSER.regexp[#{const.inspect}] explicitly.", uplevel: 1 if $VERBOSE
53
56
  value
54
57
  elsif value = RFC2396_Parser.const_get(const)
55
- warn "Bundler::URI::#{const} is obsolete. Use RFC2396_Parser::#{const} explicitly.", uplevel: 1 if $VERBOSE
58
+ warn "Bundler::URI::#{const} is obsolete. Use Bundler::URI::RFC2396_Parser::#{const} explicitly.", uplevel: 1 if $VERBOSE
56
59
  value
57
60
  else
58
61
  super
@@ -92,6 +95,40 @@ module Bundler::URI
92
95
  end
93
96
 
94
97
  module Schemes # :nodoc:
98
+ class << self
99
+ ReservedChars = ".+-"
100
+ EscapedChars = "\u01C0\u01C1\u01C2"
101
+ # Use Lo category chars as escaped chars for TruffleRuby, which
102
+ # does not allow Symbol categories as identifiers.
103
+
104
+ def escape(name)
105
+ unless name and name.ascii_only?
106
+ return nil
107
+ end
108
+ name.upcase.tr(ReservedChars, EscapedChars)
109
+ end
110
+
111
+ def unescape(name)
112
+ name.tr(EscapedChars, ReservedChars).encode(Encoding::US_ASCII).upcase
113
+ end
114
+
115
+ def find(name)
116
+ const_get(name, false) if name and const_defined?(name, false)
117
+ end
118
+
119
+ def register(name, klass)
120
+ unless scheme = escape(name)
121
+ raise ArgumentError, "invalid character as scheme - #{name}"
122
+ end
123
+ const_set(scheme, klass)
124
+ end
125
+
126
+ def list
127
+ constants.map { |name|
128
+ [unescape(name.to_s), const_get(name)]
129
+ }.to_h
130
+ end
131
+ end
95
132
  end
96
133
  private_constant :Schemes
97
134
 
@@ -104,7 +141,7 @@ module Bundler::URI
104
141
  # Note that after calling String#upcase on +scheme+, it must be a valid
105
142
  # constant name.
106
143
  def self.register_scheme(scheme, klass)
107
- Schemes.const_set(scheme.to_s.upcase, klass)
144
+ Schemes.register(scheme, klass)
108
145
  end
109
146
 
110
147
  # Returns a hash of the defined schemes:
@@ -122,14 +159,14 @@ module Bundler::URI
122
159
  #
123
160
  # Related: Bundler::URI.register_scheme.
124
161
  def self.scheme_list
125
- Schemes.constants.map { |name|
126
- [name.to_s.upcase, Schemes.const_get(name)]
127
- }.to_h
162
+ Schemes.list
128
163
  end
129
164
 
165
+ # :stopdoc:
130
166
  INITIAL_SCHEMES = scheme_list
131
167
  private_constant :INITIAL_SCHEMES
132
168
  Ractor.make_shareable(INITIAL_SCHEMES) if defined?(Ractor)
169
+ # :startdoc:
133
170
 
134
171
  # Returns a new object constructed from the given +scheme+, +arguments+,
135
172
  # and +default+:
@@ -148,12 +185,10 @@ module Bundler::URI
148
185
  # # => #<Bundler::URI::HTTP foo://john.doe@www.example.com:123/forum/questions/?tag=networking&order=newest#top>
149
186
  #
150
187
  def self.for(scheme, *arguments, default: Generic)
151
- const_name = scheme.to_s.upcase
188
+ const_name = Schemes.escape(scheme)
152
189
 
153
190
  uri_class = INITIAL_SCHEMES[const_name]
154
- uri_class ||= if /\A[A-Z]\w*\z/.match?(const_name) && Schemes.const_defined?(const_name, false)
155
- Schemes.const_get(const_name, false)
156
- end
191
+ uri_class ||= Schemes.find(const_name)
157
192
  uri_class ||= default
158
193
 
159
194
  return uri_class.new(scheme, *arguments)
@@ -195,7 +230,7 @@ module Bundler::URI
195
230
  # ["fragment", "top"]]
196
231
  #
197
232
  def self.split(uri)
198
- DEFAULT_PARSER.split(uri)
233
+ PARSER.split(uri)
199
234
  end
200
235
 
201
236
  # Returns a new \Bundler::URI object constructed from the given string +uri+:
@@ -205,11 +240,11 @@ module Bundler::URI
205
240
  # Bundler::URI.parse('http://john.doe@www.example.com:123/forum/questions/?tag=networking&order=newest#top')
206
241
  # # => #<Bundler::URI::HTTP http://john.doe@www.example.com:123/forum/questions/?tag=networking&order=newest#top>
207
242
  #
208
- # It's recommended to first ::escape string +uri+
243
+ # It's recommended to first Bundler::URI::RFC2396_PARSER.escape string +uri+
209
244
  # if it may contain invalid Bundler::URI characters.
210
245
  #
211
246
  def self.parse(uri)
212
- DEFAULT_PARSER.parse(uri)
247
+ PARSER.parse(uri)
213
248
  end
214
249
 
215
250
  # Merges the given Bundler::URI strings +str+
@@ -265,7 +300,7 @@ module Bundler::URI
265
300
  #
266
301
  def self.extract(str, schemes = nil, &block) # :nodoc:
267
302
  warn "Bundler::URI.extract is obsolete", uplevel: 1 if $VERBOSE
268
- DEFAULT_PARSER.extract(str, schemes, &block)
303
+ PARSER.extract(str, schemes, &block)
269
304
  end
270
305
 
271
306
  #
@@ -302,7 +337,7 @@ module Bundler::URI
302
337
  #
303
338
  def self.regexp(schemes = nil)# :nodoc:
304
339
  warn "Bundler::URI.regexp is obsolete", uplevel: 1 if $VERBOSE
305
- DEFAULT_PARSER.make_regexp(schemes)
340
+ PARSER.make_regexp(schemes)
306
341
  end
307
342
 
308
343
  TBLENCWWWCOMP_ = {} # :nodoc:
@@ -407,6 +442,8 @@ module Bundler::URI
407
442
  _decode_uri_component(/%\h\h/, str, enc)
408
443
  end
409
444
 
445
+ # Returns a string derived from the given string +str+ with
446
+ # Bundler::URI-encoded characters matching +regexp+ according to +table+.
410
447
  def self._encode_uri_component(regexp, table, str, enc)
411
448
  str = str.to_s.dup
412
449
  if str.encoding != Encoding::ASCII_8BIT
@@ -421,6 +458,8 @@ module Bundler::URI
421
458
  end
422
459
  private_class_method :_encode_uri_component
423
460
 
461
+ # Returns a string decoding characters matching +regexp+ from the
462
+ # given \URL-encoded string +str+.
424
463
  def self._decode_uri_component(regexp, str, enc)
425
464
  raise ArgumentError, "invalid %-encoding (#{str})" if /%(?!\h\h)/.match?(str)
426
465
  str.b.gsub(regexp, TBLDECWWWCOMP_).force_encoding(enc)
@@ -859,6 +898,7 @@ module Bundler
859
898
  # Returns a \Bundler::URI object derived from the given +uri+,
860
899
  # which may be a \Bundler::URI string or an existing \Bundler::URI object:
861
900
  #
901
+ # require 'bundler/vendor/uri/lib/uri'
862
902
  # # Returns a new Bundler::URI.
863
903
  # uri = Bundler::URI('http://github.com/ruby/ruby')
864
904
  # # => #<Bundler::URI::HTTP http://github.com/ruby/ruby>
@@ -866,6 +906,8 @@ module Bundler
866
906
  # Bundler::URI(uri)
867
907
  # # => #<Bundler::URI::HTTP http://github.com/ruby/ruby>
868
908
  #
909
+ # You must require 'bundler/vendor/uri/lib/uri' to use this method.
910
+ #
869
911
  def URI(uri)
870
912
  if uri.is_a?(Bundler::URI::Generic)
871
913
  uri
@@ -47,7 +47,7 @@ module Bundler::URI
47
47
  # :path => '/ruby/src'})
48
48
  # uri2.to_s # => "file://host.example.com/ruby/src"
49
49
  #
50
- # uri3 = Bundler::URI::File.build({:path => Bundler::URI::escape('/path/my file.txt')})
50
+ # uri3 = Bundler::URI::File.build({:path => Bundler::URI::RFC2396_PARSER.escape('/path/my file.txt')})
51
51
  # uri3.to_s # => "file:///path/my%20file.txt"
52
52
  #
53
53
  def self.build(args)
@@ -73,7 +73,7 @@ module Bundler::URI
73
73
  #
74
74
  # At first, tries to create a new Bundler::URI::Generic instance using
75
75
  # Bundler::URI::Generic::build. But, if exception Bundler::URI::InvalidComponentError is raised,
76
- # then it does Bundler::URI::Escape.escape all Bundler::URI components and tries again.
76
+ # then it does Bundler::URI::RFC2396_PARSER.escape all Bundler::URI components and tries again.
77
77
  #
78
78
  def self.build2(args)
79
79
  begin
@@ -126,9 +126,9 @@ module Bundler::URI
126
126
  end
127
127
  end
128
128
  else
129
- component = self.class.component rescue ::Bundler::URI::Generic::COMPONENT
129
+ component = self.component rescue ::Bundler::URI::Generic::COMPONENT
130
130
  raise ArgumentError,
131
- "expected Array of or Hash of components of #{self.class} (#{component.join(', ')})"
131
+ "expected Array of or Hash of components of #{self} (#{component.join(', ')})"
132
132
  end
133
133
 
134
134
  tmp << nil
@@ -186,18 +186,18 @@ module Bundler::URI
186
186
 
187
187
  if arg_check
188
188
  self.scheme = scheme
189
- self.userinfo = userinfo
190
189
  self.hostname = host
191
190
  self.port = port
191
+ self.userinfo = userinfo
192
192
  self.path = path
193
193
  self.query = query
194
194
  self.opaque = opaque
195
195
  self.fragment = fragment
196
196
  else
197
197
  self.set_scheme(scheme)
198
- self.set_userinfo(userinfo)
199
198
  self.set_host(host)
200
199
  self.set_port(port)
200
+ self.set_userinfo(userinfo)
201
201
  self.set_path(path)
202
202
  self.query = query
203
203
  self.set_opaque(opaque)
@@ -284,7 +284,7 @@ module Bundler::URI
284
284
 
285
285
  # Returns the parser to be used.
286
286
  #
287
- # Unless a Bundler::URI::Parser is defined, DEFAULT_PARSER is used.
287
+ # Unless the +parser+ is defined, DEFAULT_PARSER is used.
288
288
  #
289
289
  def parser
290
290
  if !defined?(@parser) || !@parser
@@ -315,7 +315,7 @@ module Bundler::URI
315
315
  end
316
316
 
317
317
  #
318
- # Checks the scheme +v+ component against the Bundler::URI::Parser Regexp for :SCHEME.
318
+ # Checks the scheme +v+ component against the +parser+ Regexp for :SCHEME.
319
319
  #
320
320
  def check_scheme(v)
321
321
  if v && parser.regexp[:SCHEME] !~ v
@@ -385,7 +385,7 @@ module Bundler::URI
385
385
 
386
386
  #
387
387
  # Checks the user +v+ component for RFC2396 compliance
388
- # and against the Bundler::URI::Parser Regexp for :USERINFO.
388
+ # and against the +parser+ Regexp for :USERINFO.
389
389
  #
390
390
  # Can not have a registry or opaque component defined,
391
391
  # with a user component defined.
@@ -409,7 +409,7 @@ module Bundler::URI
409
409
 
410
410
  #
411
411
  # Checks the password +v+ component for RFC2396 compliance
412
- # and against the Bundler::URI::Parser Regexp for :USERINFO.
412
+ # and against the +parser+ Regexp for :USERINFO.
413
413
  #
414
414
  # Can not have a registry or opaque component defined,
415
415
  # with a user component defined.
@@ -511,7 +511,7 @@ module Bundler::URI
511
511
  user, password = split_userinfo(user)
512
512
  end
513
513
  @user = user
514
- @password = password if password
514
+ @password = password
515
515
 
516
516
  [@user, @password]
517
517
  end
@@ -522,7 +522,7 @@ module Bundler::URI
522
522
  # See also Bundler::URI::Generic.user=.
523
523
  #
524
524
  def set_user(v)
525
- set_userinfo(v, @password)
525
+ set_userinfo(v, nil)
526
526
  v
527
527
  end
528
528
  protected :set_user
@@ -574,6 +574,12 @@ module Bundler::URI
574
574
  @password
575
575
  end
576
576
 
577
+ # Returns the authority info (array of user, password, host and
578
+ # port), if any is set. Or returns +nil+.
579
+ def authority
580
+ return @user, @password, @host, @port if @user || @password || @host || @port
581
+ end
582
+
577
583
  # Returns the user component after Bundler::URI decoding.
578
584
  def decoded_user
579
585
  Bundler::URI.decode_uri_component(@user) if @user
@@ -586,7 +592,7 @@ module Bundler::URI
586
592
 
587
593
  #
588
594
  # Checks the host +v+ component for RFC2396 compliance
589
- # and against the Bundler::URI::Parser Regexp for :HOST.
595
+ # and against the +parser+ Regexp for :HOST.
590
596
  #
591
597
  # Can not have a registry or opaque component defined,
592
598
  # with a host component defined.
@@ -615,6 +621,13 @@ module Bundler::URI
615
621
  end
616
622
  protected :set_host
617
623
 
624
+ # Protected setter for the authority info (+user+, +password+, +host+
625
+ # and +port+). If +port+ is +nil+, +default_port+ will be set.
626
+ #
627
+ protected def set_authority(user, password, host, port = nil)
628
+ @user, @password, @host, @port = user, password, host, port || self.default_port
629
+ end
630
+
618
631
  #
619
632
  # == Args
620
633
  #
@@ -639,6 +652,7 @@ module Bundler::URI
639
652
  def host=(v)
640
653
  check_host(v)
641
654
  set_host(v)
655
+ set_userinfo(nil)
642
656
  v
643
657
  end
644
658
 
@@ -675,7 +689,7 @@ module Bundler::URI
675
689
 
676
690
  #
677
691
  # Checks the port +v+ component for RFC2396 compliance
678
- # and against the Bundler::URI::Parser Regexp for :PORT.
692
+ # and against the +parser+ Regexp for :PORT.
679
693
  #
680
694
  # Can not have a registry or opaque component defined,
681
695
  # with a port component defined.
@@ -729,6 +743,7 @@ module Bundler::URI
729
743
  def port=(v)
730
744
  check_port(v)
731
745
  set_port(v)
746
+ set_userinfo(nil)
732
747
  port
733
748
  end
734
749
 
@@ -748,7 +763,7 @@ module Bundler::URI
748
763
 
749
764
  #
750
765
  # Checks the path +v+ component for RFC2396 compliance
751
- # and against the Bundler::URI::Parser Regexp
766
+ # and against the +parser+ Regexp
752
767
  # for :ABS_PATH and :REL_PATH.
753
768
  #
754
769
  # Can not have a opaque component defined,
@@ -853,7 +868,7 @@ module Bundler::URI
853
868
 
854
869
  #
855
870
  # Checks the opaque +v+ component for RFC2396 compliance and
856
- # against the Bundler::URI::Parser Regexp for :OPAQUE.
871
+ # against the +parser+ Regexp for :OPAQUE.
857
872
  #
858
873
  # Can not have a host, port, user, or path component defined,
859
874
  # with an opaque component defined.
@@ -905,7 +920,7 @@ module Bundler::URI
905
920
  end
906
921
 
907
922
  #
908
- # Checks the fragment +v+ component against the Bundler::URI::Parser Regexp for :FRAGMENT.
923
+ # Checks the fragment +v+ component against the +parser+ Regexp for :FRAGMENT.
909
924
  #
910
925
  #
911
926
  # == Args
@@ -1121,7 +1136,7 @@ module Bundler::URI
1121
1136
 
1122
1137
  base = self.dup
1123
1138
 
1124
- authority = rel.userinfo || rel.host || rel.port
1139
+ authority = rel.authority
1125
1140
 
1126
1141
  # RFC2396, Section 5.2, 2)
1127
1142
  if (rel.path.nil? || rel.path.empty?) && !authority && !rel.query
@@ -1134,9 +1149,7 @@ module Bundler::URI
1134
1149
 
1135
1150
  # RFC2396, Section 5.2, 4)
1136
1151
  if authority
1137
- base.set_userinfo(rel.userinfo)
1138
- base.set_host(rel.host)
1139
- base.set_port(rel.port || base.default_port)
1152
+ base.set_authority(*authority)
1140
1153
  base.set_path(rel.path)
1141
1154
  elsif base.path && rel.path
1142
1155
  base.set_path(merge_path(base.path, rel.path))
@@ -1527,7 +1540,7 @@ module Bundler::URI
1527
1540
  else
1528
1541
  unless proxy_uri = env[name]
1529
1542
  if proxy_uri = env[name.upcase]
1530
- warn 'The environment variable HTTP_PROXY is discouraged. Use http_proxy.', uplevel: 1
1543
+ warn 'The environment variable HTTP_PROXY is discouraged. Please use http_proxy instead.', uplevel: 1
1531
1544
  end
1532
1545
  end
1533
1546
  end
@@ -61,6 +61,18 @@ module Bundler::URI
61
61
  super(tmp)
62
62
  end
63
63
 
64
+ # Do not allow empty host names, as they are not allowed by RFC 3986.
65
+ def check_host(v)
66
+ ret = super
67
+
68
+ if ret && v.empty?
69
+ raise InvalidComponentError,
70
+ "bad component(expected host component): #{v}"
71
+ end
72
+
73
+ ret
74
+ end
75
+
64
76
  #
65
77
  # == Description
66
78
  #
@@ -67,7 +67,7 @@ module Bundler::URI
67
67
  #
68
68
  # == Synopsis
69
69
  #
70
- # Bundler::URI::Parser.new([opts])
70
+ # Bundler::URI::RFC2396_Parser.new([opts])
71
71
  #
72
72
  # == Args
73
73
  #
@@ -86,7 +86,7 @@ module Bundler::URI
86
86
  #
87
87
  # == Examples
88
88
  #
89
- # p = Bundler::URI::Parser.new(:ESCAPED => "(?:%[a-fA-F0-9]{2}|%u[a-fA-F0-9]{4})")
89
+ # p = Bundler::URI::RFC2396_Parser.new(:ESCAPED => "(?:%[a-fA-F0-9]{2}|%u[a-fA-F0-9]{4})")
90
90
  # u = p.parse("http://example.jp/%uABCD") #=> #<Bundler::URI::HTTP http://example.jp/%uABCD>
91
91
  # Bundler::URI.parse(u.to_s) #=> raises Bundler::URI::InvalidURIError
92
92
  #
@@ -108,12 +108,12 @@ module Bundler::URI
108
108
 
109
109
  # The Hash of patterns.
110
110
  #
111
- # See also Bundler::URI::Parser.initialize_pattern.
111
+ # See also #initialize_pattern.
112
112
  attr_reader :pattern
113
113
 
114
114
  # The Hash of Regexp.
115
115
  #
116
- # See also Bundler::URI::Parser.initialize_regexp.
116
+ # See also #initialize_regexp.
117
117
  attr_reader :regexp
118
118
 
119
119
  # Returns a split Bundler::URI against +regexp[:ABS_URI]+.
@@ -202,8 +202,7 @@ module Bundler::URI
202
202
  #
203
203
  # == Usage
204
204
  #
205
- # p = Bundler::URI::Parser.new
206
- # p.parse("ldap://ldap.example.com/dc=example?user=john")
205
+ # Bundler::URI::RFC2396_PARSER.parse("ldap://ldap.example.com/dc=example?user=john")
207
206
  # #=> #<Bundler::URI::LDAP ldap://ldap.example.com/dc=example?user=john>
208
207
  #
209
208
  def parse(uri)
@@ -244,7 +243,7 @@ module Bundler::URI
244
243
  # If no +block+ given, then returns the result,
245
244
  # else it calls +block+ for each element in result.
246
245
  #
247
- # See also Bundler::URI::Parser.make_regexp.
246
+ # See also #make_regexp.
248
247
  #
249
248
  def extract(str, schemes = nil)
250
249
  if block_given?
@@ -263,7 +262,7 @@ module Bundler::URI
263
262
  unless schemes
264
263
  @regexp[:ABS_URI_REF]
265
264
  else
266
- /(?=#{Regexp.union(*schemes)}:)#{@pattern[:X_ABS_URI]}/x
265
+ /(?=(?i:#{Regexp.union(*schemes).source}):)#{@pattern[:X_ABS_URI]}/x
267
266
  end
268
267
  end
269
268
 
@@ -524,6 +523,8 @@ module Bundler::URI
524
523
  ret
525
524
  end
526
525
 
526
+ # Returns +uri+ as-is if it is Bundler::URI, or convert it to Bundler::URI if it is
527
+ # a String.
527
528
  def convert_to_uri(uri)
528
529
  if uri.is_a?(Bundler::URI::Generic)
529
530
  uri
@@ -1,6 +1,6 @@
1
1
  module Bundler::URI
2
2
  # :stopdoc:
3
- VERSION_CODE = '010003'.freeze
4
- VERSION = VERSION_CODE.scan(/../).collect{|n| n.to_i}.join('.').freeze
3
+ VERSION = '1.1.1'.freeze
4
+ VERSION_CODE = VERSION.split('.').map{|s| s.rjust(2, '0')}.join.freeze
5
5
  # :startdoc:
6
6
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: false
2
2
 
3
3
  module Bundler
4
- VERSION = "2.7.2".freeze
4
+ VERSION = "4.0.0.beta1".freeze
5
5
 
6
6
  def self.bundler_major_version
7
7
  @bundler_major_version ||= gem_version.segments.first
data/lib/bundler/vlad.rb CHANGED
@@ -1,17 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "shared_helpers"
4
- Bundler::SharedHelpers.major_deprecation 2,
5
- "The Bundler task for Vlad"
6
-
7
- # Vlad task for Bundler.
8
- #
9
- # Add "require 'bundler/vlad'" in your Vlad deploy.rb, and
10
- # include the vlad:bundle:install task in your vlad:deploy task.
11
- require_relative "deployment"
12
-
13
- include Rake::DSL if defined? Rake::DSL
14
-
15
- namespace :vlad do
16
- Bundler::Deployment.define_task(Rake::RemoteTask, :remote_task, roles: :app)
17
- end
4
+ Bundler::SharedHelpers.feature_removed! "The Bundler task for Vlad"
data/lib/bundler.rb CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  require_relative "bundler/rubygems_ext"
4
4
  require_relative "bundler/vendored_fileutils"
5
- require "pathname"
5
+ autoload :Pathname, "pathname" unless defined?(Pathname)
6
6
  require "rbconfig"
7
7
 
8
8
  require_relative "bundler/errors"
@@ -54,7 +54,6 @@ module Bundler
54
54
  autoload :FREEBSD, File.expand_path("bundler/constants", __dir__)
55
55
  autoload :GemHelper, File.expand_path("bundler/gem_helper", __dir__)
56
56
  autoload :GemVersionPromoter, File.expand_path("bundler/gem_version_promoter", __dir__)
57
- autoload :Graph, File.expand_path("bundler/graph", __dir__)
58
57
  autoload :Index, File.expand_path("bundler/index", __dir__)
59
58
  autoload :Injector, File.expand_path("bundler/injector", __dir__)
60
59
  autoload :Installer, File.expand_path("bundler/installer", __dir__)
@@ -219,8 +218,7 @@ module Bundler
219
218
  end
220
219
 
221
220
  def environment
222
- SharedHelpers.major_deprecation 2, "Bundler.environment has been removed in favor of Bundler.load", print_caller_location: true
223
- load
221
+ SharedHelpers.feature_removed! "Bundler.environment has been removed in favor of Bundler.load"
224
222
  end
225
223
 
226
224
  # Returns an instance of Bundler::Definition for given Gemfile and lockfile
@@ -365,16 +363,11 @@ module Bundler
365
363
  ORIGINAL_ENV.clone
366
364
  end
367
365
 
368
- # @deprecated Use `unbundled_env` instead
369
366
  def clean_env
370
- message =
371
- "`Bundler.clean_env` has been deprecated in favor of `Bundler.unbundled_env`. " \
372
- "If you instead want the environment before bundler was originally loaded, use `Bundler.original_env`"
373
367
  removed_message =
374
368
  "`Bundler.clean_env` has been removed in favor of `Bundler.unbundled_env`. " \
375
369
  "If you instead want the environment before bundler was originally loaded, use `Bundler.original_env`"
376
- Bundler::SharedHelpers.major_deprecation(2, message, removed_message: removed_message, print_caller_location: true)
377
- unbundled_env
370
+ Bundler::SharedHelpers.feature_removed!(removed_message)
378
371
  end
379
372
 
380
373
  # @return [Hash] Environment with all bundler-related variables removed
@@ -392,16 +385,11 @@ module Bundler
392
385
  with_env(original_env) { yield }
393
386
  end
394
387
 
395
- # @deprecated Use `with_unbundled_env` instead
396
388
  def with_clean_env
397
- message =
398
- "`Bundler.with_clean_env` has been deprecated in favor of `Bundler.with_unbundled_env`. " \
399
- "If you instead want the environment before bundler was originally loaded, use `Bundler.with_original_env`"
400
389
  removed_message =
401
390
  "`Bundler.with_clean_env` has been removed in favor of `Bundler.with_unbundled_env`. " \
402
391
  "If you instead want the environment before bundler was originally loaded, use `Bundler.with_original_env`"
403
- Bundler::SharedHelpers.major_deprecation(2, message, removed_message: removed_message, print_caller_location: true)
404
- with_env(unbundled_env) { yield }
392
+ Bundler::SharedHelpers.feature_removed!(removed_message)
405
393
  end
406
394
 
407
395
  # Run block with all bundler-related variables removed
@@ -414,16 +402,11 @@ module Bundler
414
402
  with_original_env { Kernel.system(*args) }
415
403
  end
416
404
 
417
- # @deprecated Use `unbundled_system` instead
418
405
  def clean_system(*args)
419
- message =
420
- "`Bundler.clean_system` has been deprecated in favor of `Bundler.unbundled_system`. " \
421
- "If you instead want to run the command in the environment before bundler was originally loaded, use `Bundler.original_system`"
422
406
  removed_message =
423
407
  "`Bundler.clean_system` has been removed in favor of `Bundler.unbundled_system`. " \
424
408
  "If you instead want to run the command in the environment before bundler was originally loaded, use `Bundler.original_system`"
425
- Bundler::SharedHelpers.major_deprecation(2, message, removed_message: removed_message, print_caller_location: true)
426
- with_env(unbundled_env) { Kernel.system(*args) }
409
+ Bundler::SharedHelpers.feature_removed!(removed_message)
427
410
  end
428
411
 
429
412
  # Run subcommand in an environment with all bundler related variables removed
@@ -436,16 +419,11 @@ module Bundler
436
419
  with_original_env { Kernel.exec(*args) }
437
420
  end
438
421
 
439
- # @deprecated Use `unbundled_exec` instead
440
422
  def clean_exec(*args)
441
- message =
442
- "`Bundler.clean_exec` has been deprecated in favor of `Bundler.unbundled_exec`. " \
443
- "If you instead want to exec to a command in the environment before bundler was originally loaded, use `Bundler.original_exec`"
444
423
  removed_message =
445
424
  "`Bundler.clean_exec` has been removed in favor of `Bundler.unbundled_exec`. " \
446
425
  "If you instead want to exec to a command in the environment before bundler was originally loaded, use `Bundler.original_exec`"
447
- Bundler::SharedHelpers.major_deprecation(2, message, removed_message: removed_message, print_caller_location: true)
448
- with_env(unbundled_env) { Kernel.exec(*args) }
426
+ Bundler::SharedHelpers.feature_removed!(removed_message)
449
427
  end
450
428
 
451
429
  # Run a `Kernel.exec` to a subcommand in an environment with all bundler related variables removed