bundler 4.1.0.beta2 → 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.
@@ -86,11 +86,22 @@ module Gem
86
86
  end
87
87
  end
88
88
 
89
- def open_file_with_lock(path, &block)
89
+ def open_file_with_lock(path)
90
90
  file_lock = "#{path}.lock"
91
- open_file_with_flock(file_lock, &block)
92
- ensure
93
- FileUtils.rm_f file_lock
91
+
92
+ loop do
93
+ open_file_with_flock(file_lock) do |io|
94
+ # The previous holder removed the file while we were waiting on it,
95
+ # so leave this block and try again on the file now at the lock path
96
+ next unless File.identical?(io, file_lock)
97
+
98
+ begin
99
+ return yield io
100
+ ensure
101
+ FileUtils.rm_f file_lock
102
+ end
103
+ end
104
+ end
94
105
  end
95
106
  end
96
107
  end
@@ -77,11 +77,11 @@ module Bundler
77
77
  end
78
78
 
79
79
  def hash
80
- @remotes.hash
80
+ credless_remotes.hash
81
81
  end
82
82
 
83
83
  def eql?(other)
84
- other.is_a?(Rubygems) && other.credless_remotes == credless_remotes
84
+ equal?(other) || (other.is_a?(Rubygems) && other.credless_remotes == credless_remotes)
85
85
  end
86
86
 
87
87
  alias_method :==, :eql?
@@ -8,7 +8,7 @@ module Bundler
8
8
  @sources = sources
9
9
  @dependencies = dependencies
10
10
  @locked_specs = locked_specs
11
- # No gemspec names a gem that a `from:`/`to:` override substitutes, so
11
+ # No gemspec names a gem that a `with:`/`in:` override substitutes, so
12
12
  # the dependency API never fetches it unless asked.
13
13
  @replacement_names = replacement_names
14
14
  end
@@ -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.beta2".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
@@ -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