bundler 4.1.0.beta1 → 4.1.0.beta3

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 (61) hide show
  1. checksums.yaml +4 -4
  2. data/lib/bundler/build_metadata.rb +2 -2
  3. data/lib/bundler/cli/common.rb +4 -0
  4. data/lib/bundler/cli/doctor/ssl.rb +4 -8
  5. data/lib/bundler/cli/info.rb +1 -1
  6. data/lib/bundler/cli/lock.rb +19 -4
  7. data/lib/bundler/cli/open.rb +7 -1
  8. data/lib/bundler/cli/outdated.rb +8 -10
  9. data/lib/bundler/cli/platform.rb +15 -1
  10. data/lib/bundler/cli/show.rb +5 -1
  11. data/lib/bundler/cli/update.rb +1 -1
  12. data/lib/bundler/cli.rb +22 -7
  13. data/lib/bundler/constants.rb +1 -1
  14. data/lib/bundler/definition.rb +102 -16
  15. data/lib/bundler/dsl.rb +76 -5
  16. data/lib/bundler/fetcher/downloader.rb +14 -4
  17. data/lib/bundler/fetcher.rb +4 -1
  18. data/lib/bundler/gem_helper.rb +1 -1
  19. data/lib/bundler/installer/parallel_installer.rb +2 -1
  20. data/lib/bundler/installer.rb +5 -1
  21. data/lib/bundler/lazy_specification.rb +1 -1
  22. data/lib/bundler/lockfile_generator.rb +6 -0
  23. data/lib/bundler/lockfile_parser.rb +18 -2
  24. data/lib/bundler/man/bundle-info.1 +4 -1
  25. data/lib/bundler/man/bundle-info.1.ronn +4 -0
  26. data/lib/bundler/man/bundle-lock.1 +2 -2
  27. data/lib/bundler/man/bundle-lock.1.ronn +4 -3
  28. data/lib/bundler/man/bundle-open.1 +4 -1
  29. data/lib/bundler/man/bundle-open.1.ronn +4 -1
  30. data/lib/bundler/man/bundle-outdated.1 +1 -1
  31. data/lib/bundler/man/bundle-outdated.1.ronn +1 -1
  32. data/lib/bundler/man/bundle-show.1 +4 -1
  33. data/lib/bundler/man/bundle-show.1.ronn +4 -0
  34. data/lib/bundler/man/bundle-update.1 +3 -3
  35. data/lib/bundler/man/bundle-update.1.ronn +5 -3
  36. data/lib/bundler/man/gemfile.5 +43 -2
  37. data/lib/bundler/man/gemfile.5.ronn +69 -4
  38. data/lib/bundler/match_platform.rb +12 -3
  39. data/lib/bundler/materialization.rb +3 -1
  40. data/lib/bundler/override.rb +83 -2
  41. data/lib/bundler/resolver.rb +28 -4
  42. data/lib/bundler/rubygems_ext.rb +15 -4
  43. data/lib/bundler/self_manager.rb +15 -9
  44. data/lib/bundler/settings.rb +10 -26
  45. data/lib/bundler/source/git/git_proxy.rb +39 -2
  46. data/lib/bundler/source/git.rb +34 -7
  47. data/lib/bundler/source/rubygems.rb +2 -2
  48. data/lib/bundler/source/rubygems_aggregate.rb +1 -1
  49. data/lib/bundler/source_map.rb +7 -3
  50. data/lib/bundler/spec_set.rb +8 -4
  51. data/lib/bundler/templates/newgem/ext/newgem/Cargo.toml.tt +1 -1
  52. data/lib/bundler/vendor/fileutils/lib/fileutils.rb +54 -29
  53. data/lib/bundler/version.rb +1 -1
  54. data/lib/bundler.rb +1 -3
  55. data/lib/rubygems/compact_index_client/http_fetcher.rb +5 -3
  56. data/lib/rubygems/compact_index_client/parser.rb +1 -0
  57. data/lib/rubygems/vendor/uri/lib/uri/common.rb +1 -1
  58. data/lib/rubygems/vendor/uri/lib/uri/generic.rb +15 -3
  59. data/lib/rubygems/vendor/uri/lib/uri/version.rb +1 -1
  60. data/lib/rubygems/yaml_serializer.rb +131 -103
  61. metadata +391 -390
@@ -84,11 +84,14 @@ module Bundler
84
84
  platforms.delete(Bundler.local_platform) if less_specific_platform
85
85
  end
86
86
 
87
- def validate_deps(s)
88
- s.runtime_dependencies.each do |dep|
87
+ def validate_deps(s, overrides = s.is_a?(LazySpecification) ? Array(s.overrides) : [])
88
+ Override.rewrite_dependencies(overrides, s.name, s.runtime_dependencies).each do |dep|
89
89
  next if dep.name == "bundler"
90
90
 
91
91
  return :missing unless names.include?(dep.name)
92
+
93
+ override = Override.find_for(overrides, dep.name, :version)
94
+ dep = Gem::Dependency.new(dep.name, override.apply_to(dep.requirement)) if override
92
95
  return :invalid if none? {|spec| dep.matches_spec?(spec) }
93
96
  end
94
97
 
@@ -281,7 +284,7 @@ module Bundler
281
284
  overrides = spec.is_a?(LazySpecification) ? Array(spec.overrides) : []
282
285
  matching_specs = spec.source.specs.search([spec.name, spec.version])
283
286
  platform_spec = MatchPlatform.select_best_platform_match(matching_specs, platform).find do |s|
284
- s.matches_current_metadata_with_overrides?(overrides) && valid_dependencies?(s)
287
+ s.matches_current_metadata_with_overrides?(overrides) && validate_deps(s, overrides) == :valid
285
288
  end
286
289
 
287
290
  if platform_spec
@@ -354,7 +357,8 @@ module Bundler
354
357
  end
355
358
 
356
359
  def tsort_each_child(s)
357
- s.dependencies.sort_by(&:name).each do |d|
360
+ dependencies = s.is_a?(LazySpecification) ? Override.rewrite_dependencies(s.overrides, s.name, s.dependencies) : s.dependencies
361
+ dependencies.sort_by(&:name).each do |d|
358
362
  next if d.type == :development
359
363
 
360
364
  specs_for_name = lookup[d.name]
@@ -12,7 +12,7 @@ publish = false
12
12
  crate-type = ["cdylib"]
13
13
 
14
14
  [dependencies]
15
- magnus = { version = "0.8.2" }
15
+ magnus = { version = "0.9" }
16
16
  rb-sys = { version = "0.9", features = ["stable-api-compiled-fallback"] }
17
17
 
18
18
  [build-dependencies]
@@ -181,7 +181,7 @@ end
181
181
  #
182
182
  module Bundler::FileUtils
183
183
  # The version number.
184
- VERSION = "1.8.0"
184
+ VERSION = "1.8.1"
185
185
 
186
186
  def self.private_module_function(name) #:nodoc:
187
187
  module_function name
@@ -279,38 +279,67 @@ module Bundler::FileUtils
279
279
  end
280
280
  private_module_function :remove_trailing_slash
281
281
 
282
+ # :markup: markdown
282
283
  #
283
- # Creates directories at the paths in the given +list+
284
- # (a single path or an array of paths);
285
- # returns +list+ if it is an array, <tt>[list]</tt> otherwise.
284
+ # call-seq:
285
+ # Bundler::FileUtils.mkdir(*paths, mode: 0775, noop: nil, verbose: nil) -> array_of_paths or nil
286
286
  #
287
- # Argument +list+ or its elements
288
- # should be {interpretable as paths}[rdoc-ref:FileUtils@Path+Arguments].
287
+ # Argument `paths` may be one path or an array of paths;
288
+ # each must be {interpretable as a path}[rdoc-ref:FileUtils@Path+Arguments].
289
289
  #
290
- # With no keyword arguments, creates a directory at each +path+ in +list+
291
- # by calling: <tt>Dir.mkdir(path, mode)</tt>;
292
- # see {Dir.mkdir}[https://docs.ruby-lang.org/en/master/Dir.html#method-c-mkdir]:
290
+ # By default, creates a directory entry at each of the given `paths`;
291
+ # each directory has permissions `0775`;
292
+ # returns an array of the paths:
293
293
  #
294
- # Bundler::FileUtils.mkdir(%w[tmp0 tmp1]) # => ["tmp0", "tmp1"]
295
- # Bundler::FileUtils.mkdir('tmp4') # => ["tmp4"]
294
+ # ```ruby
295
+ # Bundler::FileUtils.mkdir('foo') # => ["foo"]
296
+ # Bundler::FileUtils.mkdir(%w[bar baz]) # => ["bar", "baz"]
297
+ # File.stat(Dir.new('foo')).mode.to_s(8) # => "40775"
298
+ # File.stat(Dir.new('bar')).mode.to_s(8) # => "40775"
299
+ # File.stat(Dir.new('baz')).mode.to_s(8) # => "40775"
300
+ # Bundler::FileUtils.rmdir(%w[foo bar baz]) # => ["foo", "bar", "baz"]
301
+ # ```
296
302
  #
297
- # Keyword arguments:
303
+ # Raises an exception if for any reason a directory cannot be created;
304
+ # a common reason is that the directory already exists.
298
305
  #
299
- # - <tt>mode: <i>mode</i></tt> - also calls <tt>File.chmod(mode, path)</tt>;
300
- # see {File.chmod}[https://docs.ruby-lang.org/en/master/File.html#method-c-chmod].
301
- # - <tt>noop: true</tt> - does not create directories.
302
- # - <tt>verbose: true</tt> - prints an equivalent command:
306
+ # With keyword argument `mode` given,
307
+ # creates directories with the given permissions:
303
308
  #
304
- # Bundler::FileUtils.mkdir(%w[tmp0 tmp1], verbose: true)
305
- # Bundler::FileUtils.mkdir(%w[tmp2 tmp3], mode: 0700, verbose: true)
309
+ # ```ruby
310
+ # Bundler::FileUtils.mkdir('bar', mode: 0664)
311
+ # File.stat(Dir.new('bar')).mode.to_s(8) # => "40664"
312
+ # Bundler::FileUtils.rmdir('bar')
313
+ # ```
306
314
  #
307
- # Output:
315
+ # With keyword argument `noop` given as `true`,
316
+ # does not create directories;
317
+ # returns `nil`
318
+ #
319
+ # ```ruby
320
+ # Bundler::FileUtils.mkdir('foo', noop: true) # => nil
321
+ # Dir.exist?('foo') # => false
322
+ # ```
323
+ #
324
+ # With keyword argument `verbose` given as `true`,
325
+ # prints a shell command:
308
326
  #
309
- # mkdir tmp0 tmp1
310
- # mkdir -m 700 tmp2 tmp3
327
+ # ```ruby
328
+ # Bundler::FileUtils.mkdir('foo', verbose: true)
329
+ # Bundler::FileUtils.mkdir(%w[bar baz], mode: 0644, verbose: true)
330
+ # Bundler::FileUtils.mkdir(%w[bar baz], mode: 0644, verbose: true, noop: true)
331
+ # ```
311
332
  #
312
- # Raises an exception if any path points to an existing
313
- # file or directory, or if for any reason a directory cannot be created.
333
+ # Output:
334
+ #
335
+ # ```text
336
+ # mkdir foo
337
+ # mkdir -m 644 bar baz
338
+ # mkdir -m 644 bar baz
339
+ # ```
340
+ #
341
+ # Note that in the last call above (containing `noop: true`)
342
+ # the existence of the directory is not checked.
314
343
  #
315
344
  # Related: Bundler::FileUtils.mkdir_p.
316
345
  #
@@ -686,7 +715,7 @@ module Bundler::FileUtils
686
715
  # Keyword arguments:
687
716
  #
688
717
  # - <tt>force: true</tt> - overwrites +dest+ if it exists.
689
- # - <tt>relative: false</tt> - create links relative to +dest+.
718
+ # - <tt>relative: true</tt> - create links relative to +dest+.
690
719
  # - <tt>noop: true</tt> - does not create links.
691
720
  # - <tt>verbose: true</tt> - prints an equivalent command:
692
721
  #
@@ -754,7 +783,7 @@ module Bundler::FileUtils
754
783
  n = real_ddirs.size - i
755
784
  n -= 1 unless target_directory
756
785
  link2 = fu_clean_components(*Array.new([n, 0].max, '..'), *real_sdirs[i..-1])
757
- link1 = link2 if link1.size > link2.size
786
+ link1 = link2 if !link2.empty? and link1.size > link2.size
758
787
  end
759
788
  s = File.join(link1)
760
789
  fu_output_message [cmd, s, d].flatten.join(' ') if verbose
@@ -2037,10 +2066,6 @@ module Bundler::FileUtils
2037
2066
  def fu_windows?; false end #:nodoc:
2038
2067
  end
2039
2068
 
2040
- def fu_copy_stream0(src, dest, blksize = nil) #:nodoc:
2041
- IO.copy_stream(src, dest)
2042
- end
2043
-
2044
2069
  def fu_stream_blksize(*streams) #:nodoc:
2045
2070
  streams.each do |s|
2046
2071
  next unless s.respond_to?(:stat)
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: false
2
2
 
3
3
  module Bundler
4
- VERSION = "4.1.0.beta1".freeze
4
+ VERSION = "4.1.0.beta3".freeze
5
5
 
6
6
  def self.bundler_major_version
7
7
  @bundler_major_version ||= gem_version.segments.first
data/lib/bundler.rb CHANGED
@@ -119,9 +119,7 @@ module Bundler
119
119
  def bin_path
120
120
  @bin_path ||= begin
121
121
  path = Bundler.settings[:bin] || "bin"
122
- path = Pathname.new(path).expand_path(root).expand_path
123
- mkdir_p(path)
124
- path
122
+ Pathname.new(path).expand_path(root).expand_path
125
123
  end
126
124
  end
127
125
 
@@ -48,9 +48,11 @@ class Gem::CompactIndexClient
48
48
  if https?(uri) && !https?(redirect)
49
49
  raise Gem::RemoteFetcher::FetchError.new("redirecting to non-https resource: #{Gem::Uri.redact(redirect)}", uri)
50
50
  end
51
- # An absolute Location on the same host drops the credentials that a
52
- # relative one would have kept.
53
- redirect.userinfo = uri.userinfo if redirect.host == uri.host && !redirect.userinfo
51
+ # An absolute Location on the same origin drops the credentials that a
52
+ # relative one would have kept. Another port or scheme on the same host
53
+ # is a different protection space (RFC 9110, Section 11.5).
54
+ same_origin = [redirect.scheme, redirect.host, redirect.port] == [uri.scheme, uri.host, uri.port]
55
+ redirect.userinfo = uri.userinfo if same_origin && !redirect.userinfo
54
56
 
55
57
  fetch(redirect, headers, redirects_remaining - 1)
56
58
  when Gem::Net::HTTPRangeNotSatisfiable
@@ -24,6 +24,7 @@ class Gem::CompactIndexClient
24
24
 
25
25
  lines(@compact_index.versions).each do |line|
26
26
  name, versions_string, checksum = line.split(" ", 3)
27
+ next unless versions_string # see #parse_version_checksum
27
28
  @info_checksums[name] = checksum || ""
28
29
  versions_string.split(",") do |version|
29
30
  delete = version.delete_prefix!("-")
@@ -271,7 +271,7 @@ module Gem::URI
271
271
  # # => #<Gem::URI::HTTP http://example.com/foo/bar>
272
272
  #
273
273
  def self.join(*str)
274
- DEFAULT_PARSER.join(*str)
274
+ PARSER.join(*str)
275
275
  end
276
276
 
277
277
  #
@@ -466,7 +466,7 @@ module Gem::URI
466
466
  #
467
467
  # uri = Gem::URI.parse("http://john:S3nsit1ve@my.example.com")
468
468
  # uri.user = "sam"
469
- # uri.to_s #=> "http://sam:V3ry_S3nsit1ve@my.example.com"
469
+ # uri.to_s #=> "http://sam@my.example.com"
470
470
  #
471
471
  def user=(user)
472
472
  check_user(user)
@@ -1021,9 +1021,21 @@ module Gem::URI
1021
1021
 
1022
1022
  # RFC2396, Section 5.2, 6), a)
1023
1023
  base_path << '' if base_path.last == '..'
1024
- while i = base_path.index('..')
1025
- base_path.slice!(i - 1, 2)
1024
+ # Remove "<segment>/.." pairs in a single left-to-right pass (O(n)).
1025
+ # This deliberately differs from the relative-path stack handling
1026
+ # below: a leading ".." (one with no preceding segment left to
1027
+ # cancel) discards the whole base path, reproducing the previous
1028
+ # index/slice! implementation exactly.
1029
+ reduced = []
1030
+ base_path.each do |seg|
1031
+ if seg == '..'
1032
+ break if reduced.empty?
1033
+ reduced.pop
1034
+ else
1035
+ reduced << seg
1036
+ end
1026
1037
  end
1038
+ base_path = reduced
1027
1039
 
1028
1040
  if (first = rel_path.first) and first.empty?
1029
1041
  base_path.clear
@@ -1,6 +1,6 @@
1
1
  module Gem::URI
2
2
  # :stopdoc:
3
- VERSION = '1.1.1'.freeze
3
+ VERSION = '1.1.2'.freeze
4
4
  VERSION_CODE = VERSION.split('.').map{|s| s.rjust(2, '0')}.join.freeze
5
5
  # :startdoc:
6
6
  end