rubygems-update 3.2.3 → 3.2.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) hide show
  1. checksums.yaml +4 -4
  2. data/{History.txt → CHANGELOG.md} +480 -427
  3. data/Manifest.txt +30 -27
  4. data/Rakefile +20 -28
  5. data/bundler/CHANGELOG.md +73 -2
  6. data/bundler/bundler.gemspec +1 -1
  7. data/bundler/lib/bundler.rb +0 -1
  8. data/bundler/lib/bundler/build_metadata.rb +2 -2
  9. data/bundler/lib/bundler/cli.rb +3 -5
  10. data/bundler/lib/bundler/cli/cache.rb +1 -0
  11. data/bundler/lib/bundler/cli/gem.rb +14 -0
  12. data/bundler/lib/bundler/compact_index_client/updater.rb +0 -8
  13. data/bundler/lib/bundler/definition.rb +17 -27
  14. data/bundler/lib/bundler/dep_proxy.rb +15 -8
  15. data/bundler/lib/bundler/feature_flag.rb +0 -1
  16. data/bundler/lib/bundler/fetcher.rb +0 -1
  17. data/bundler/lib/bundler/gem_helper.rb +9 -7
  18. data/bundler/lib/bundler/gem_version_promoter.rb +2 -2
  19. data/bundler/lib/bundler/index.rb +6 -5
  20. data/bundler/lib/bundler/installer.rb +0 -17
  21. data/bundler/lib/bundler/installer/standalone.rb +15 -0
  22. data/bundler/lib/bundler/lazy_specification.rb +9 -18
  23. data/bundler/{man → lib/bundler/man}/bundle-add.1 +1 -1
  24. data/bundler/{man → lib/bundler/man}/bundle-binstubs.1 +1 -1
  25. data/bundler/{man → lib/bundler/man}/bundle-cache.1 +1 -1
  26. data/bundler/{man → lib/bundler/man}/bundle-check.1 +1 -1
  27. data/bundler/{man → lib/bundler/man}/bundle-clean.1 +1 -1
  28. data/bundler/{man → lib/bundler/man}/bundle-config.1 +4 -4
  29. data/bundler/lib/bundler/man/bundle-config.1.ronn +3 -3
  30. data/bundler/{man → lib/bundler/man}/bundle-doctor.1 +1 -1
  31. data/bundler/{man → lib/bundler/man}/bundle-exec.1 +1 -1
  32. data/bundler/{man → lib/bundler/man}/bundle-gem.1 +1 -1
  33. data/bundler/{man → lib/bundler/man}/bundle-info.1 +1 -1
  34. data/bundler/{man → lib/bundler/man}/bundle-init.1 +1 -1
  35. data/bundler/{man → lib/bundler/man}/bundle-inject.1 +1 -1
  36. data/bundler/{man → lib/bundler/man}/bundle-install.1 +1 -1
  37. data/bundler/{man → lib/bundler/man}/bundle-list.1 +1 -1
  38. data/bundler/{man → lib/bundler/man}/bundle-lock.1 +1 -1
  39. data/bundler/{man → lib/bundler/man}/bundle-open.1 +1 -1
  40. data/bundler/{man → lib/bundler/man}/bundle-outdated.1 +1 -1
  41. data/bundler/{man → lib/bundler/man}/bundle-platform.1 +1 -1
  42. data/bundler/{man → lib/bundler/man}/bundle-pristine.1 +1 -1
  43. data/bundler/{man → lib/bundler/man}/bundle-remove.1 +1 -1
  44. data/bundler/{man → lib/bundler/man}/bundle-show.1 +1 -1
  45. data/bundler/{man → lib/bundler/man}/bundle-update.1 +1 -1
  46. data/bundler/{man → lib/bundler/man}/bundle-viz.1 +1 -1
  47. data/bundler/{man → lib/bundler/man}/bundle.1 +1 -1
  48. data/bundler/{man → lib/bundler/man}/gemfile.5 +1 -1
  49. data/bundler/{man → lib/bundler/man}/index.txt +0 -0
  50. data/bundler/lib/bundler/resolver.rb +82 -43
  51. data/bundler/lib/bundler/resolver/spec_group.rb +56 -44
  52. data/bundler/lib/bundler/rubygems_ext.rb +16 -0
  53. data/bundler/lib/bundler/settings.rb +1 -1
  54. data/bundler/lib/bundler/shared_helpers.rb +2 -2
  55. data/bundler/lib/bundler/source/git.rb +19 -17
  56. data/bundler/lib/bundler/source/git/git_proxy.rb +54 -49
  57. data/bundler/lib/bundler/source/path/installer.rb +2 -0
  58. data/bundler/lib/bundler/source/rubygems.rb +10 -2
  59. data/bundler/lib/bundler/source_list.rb +2 -4
  60. data/bundler/lib/bundler/spec_set.rb +5 -4
  61. data/bundler/lib/bundler/templates/newgem/CHANGELOG.md.tt +5 -0
  62. data/bundler/lib/bundler/templates/newgem/Gemfile.tt +1 -1
  63. data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +1 -1
  64. data/bundler/lib/bundler/templates/newgem/rubocop.yml.tt +3 -0
  65. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +7 -0
  66. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +0 -1
  67. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +11 -5
  68. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +2 -2
  69. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +11 -0
  70. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +11 -7
  71. data/bundler/lib/bundler/vendor/thor/lib/thor.rb +5 -6
  72. data/bundler/lib/bundler/vendor/thor/lib/thor/actions.rb +1 -1
  73. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +4 -2
  74. data/bundler/lib/bundler/vendor/thor/lib/thor/error.rb +1 -1
  75. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +5 -1
  76. data/bundler/lib/bundler/vendor/thor/lib/thor/parser/options.rb +9 -8
  77. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +5 -2
  78. data/bundler/lib/bundler/vendor/thor/lib/thor/shell/color.rb +5 -1
  79. data/bundler/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
  80. data/bundler/lib/bundler/version.rb +1 -1
  81. data/lib/rubygems.rb +2 -2
  82. data/lib/rubygems/commands/setup_command.rb +16 -62
  83. data/lib/rubygems/ext/builder.rb +5 -4
  84. data/lib/rubygems/ext/cmake_builder.rb +1 -2
  85. data/lib/rubygems/ext/configure_builder.rb +1 -2
  86. data/lib/rubygems/installer_uninstaller_utils.rb +6 -1
  87. data/lib/rubygems/platform.rb +0 -4
  88. data/lib/rubygems/remote_fetcher.rb +3 -1
  89. data/lib/rubygems/requirement.rb +1 -1
  90. data/lib/rubygems/resolver/best_set.rb +1 -1
  91. data/lib/rubygems/resolver/index_specification.rb +8 -2
  92. data/lib/rubygems/resolver/molinillo/lib/molinillo/delegates/specification_provider.rb +7 -0
  93. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph.rb +0 -1
  94. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/vertex.rb +11 -5
  95. data/lib/rubygems/resolver/molinillo/lib/molinillo/errors.rb +2 -2
  96. data/lib/rubygems/resolver/molinillo/lib/molinillo/modules/specification_provider.rb +11 -0
  97. data/lib/rubygems/resolver/molinillo/lib/molinillo/resolution.rb +11 -7
  98. data/lib/rubygems/specification.rb +18 -14
  99. data/lib/rubygems/test_case.rb +17 -4
  100. data/rubygems-update.gemspec +2 -2
  101. data/test/rubygems/data/null-required-ruby-version.gemspec.rz +0 -0
  102. data/test/rubygems/data/null-required-rubygems-version.gemspec.rz +0 -0
  103. data/test/rubygems/test_gem.rb +5 -0
  104. data/test/rubygems/test_gem_commands_setup_command.rb +21 -37
  105. data/test/rubygems/test_gem_dependency_installer.rb +52 -47
  106. data/test/rubygems/test_gem_ext_builder.rb +30 -6
  107. data/test/rubygems/test_gem_ext_cmake_builder.rb +2 -4
  108. data/test/rubygems/test_gem_ext_configure_builder.rb +2 -2
  109. data/test/rubygems/test_gem_installer.rb +2 -0
  110. data/test/rubygems/test_gem_platform.rb +8 -0
  111. data/test/rubygems/test_gem_remote_fetcher.rb +1 -1
  112. data/test/rubygems/test_gem_requirement.rb +35 -1
  113. data/test/rubygems/test_gem_resolver_best_set.rb +23 -0
  114. data/test/rubygems/test_gem_specification.rb +9 -3
  115. data/test/rubygems/test_gem_stream_ui.rb +1 -1
  116. metadata +34 -55
@@ -158,6 +158,22 @@ module Gem
158
158
  end
159
159
  end
160
160
 
161
+ if Gem::Requirement.new("~> 2.0").hash == Gem::Requirement.new("~> 2.0.0").hash
162
+ class Requirement
163
+ module CorrectHashForLambdaOperator
164
+ def hash
165
+ if requirements.any? {|r| r.first == "~>" }
166
+ requirements.map {|r| r.first == "~>" ? [r[0], r[1].to_s] : r }.sort.hash
167
+ else
168
+ super
169
+ end
170
+ end
171
+ end
172
+
173
+ prepend CorrectHashForLambdaOperator
174
+ end
175
+ end
176
+
161
177
  class Platform
162
178
  JAVA = Gem::Platform.new("java") unless defined?(JAVA)
163
179
  MSWIN = Gem::Platform.new("mswin32") unless defined?(MSWIN)
@@ -7,7 +7,6 @@ module Bundler
7
7
  autoload :Validator, File.expand_path("settings/validator", __dir__)
8
8
 
9
9
  BOOL_KEYS = %w[
10
- allow_bundler_dependency_conflicts
11
10
  allow_deployment_source_credential_changes
12
11
  allow_offline_install
13
12
  auto_clean_without_path
@@ -20,6 +19,7 @@ module Bundler
20
19
  disable_checksum_validation
21
20
  disable_exec_load
22
21
  disable_local_branch_check
22
+ disable_local_revision_check
23
23
  disable_multisource
24
24
  disable_shared_gems
25
25
  disable_version_check
@@ -194,11 +194,11 @@ module Bundler
194
194
  return @md5_available if defined?(@md5_available)
195
195
  @md5_available = begin
196
196
  require "openssl"
197
- OpenSSL::Digest.digest("MD5", "")
197
+ ::OpenSSL::Digest.digest("MD5", "")
198
198
  true
199
199
  rescue LoadError
200
200
  true
201
- rescue OpenSSL::Digest::DigestError
201
+ rescue ::OpenSSL::Digest::DigestError
202
202
  false
203
203
  end
204
204
  end
@@ -22,7 +22,7 @@ module Bundler
22
22
  @uri = options["uri"] || ""
23
23
  @safe_uri = URICredentialsFilter.credential_filtered_uri(@uri)
24
24
  @branch = options["branch"]
25
- @ref = options["ref"] || options["branch"] || options["tag"] || "master"
25
+ @ref = options["ref"] || options["branch"] || options["tag"]
26
26
  @submodules = options["submodules"]
27
27
  @name = options["name"]
28
28
  @version = options["version"].to_s.strip.gsub("-", ".pre.")
@@ -60,25 +60,27 @@ module Bundler
60
60
  alias_method :==, :eql?
61
61
 
62
62
  def to_s
63
- at = if local?
64
- path
65
- elsif user_ref = options["ref"]
66
- if ref =~ /\A[a-z0-9]{4,}\z/i
67
- shortref_for_display(user_ref)
63
+ begin
64
+ at = if local?
65
+ path
66
+ elsif user_ref = options["ref"]
67
+ if ref =~ /\A[a-z0-9]{4,}\z/i
68
+ shortref_for_display(user_ref)
69
+ else
70
+ user_ref
71
+ end
72
+ elsif ref
73
+ ref
68
74
  else
69
- user_ref
75
+ git_proxy.branch
70
76
  end
71
- else
72
- ref
73
- end
74
77
 
75
- rev = begin
76
- "@#{shortref_for_display(revision)}"
77
- rescue GitError
78
- nil
79
- end
78
+ rev = " (at #{at}@#{shortref_for_display(revision)})"
79
+ rescue GitError
80
+ ""
81
+ end
80
82
 
81
- "#{@safe_uri} (at #{at}#{rev})"
83
+ "#{@safe_uri}#{rev}"
82
84
  end
83
85
 
84
86
  def name
@@ -146,7 +148,7 @@ module Bundler
146
148
 
147
149
  changed = cached_revision && cached_revision != git_proxy.revision
148
150
 
149
- if changed && !@unlocked && !git_proxy.contains?(cached_revision)
151
+ if !Bundler.settings[:disable_local_revision_check] && changed && !@unlocked && !git_proxy.contains?(cached_revision)
150
152
  raise GitError, "The Gemfile lock is pointing to revision #{shortref_for_display(cached_revision)} " \
151
153
  "but the current branch in your local override for #{name} does not contain such commit. " \
152
154
  "Please make sure your branch is up to date."
@@ -17,7 +17,7 @@ module Bundler
17
17
  class GitNotAllowedError < GitError
18
18
  def initialize(command)
19
19
  msg = String.new
20
- msg << "Bundler is trying to run a `git #{command}` at runtime. You probably need to run `bundle install`. However, "
20
+ msg << "Bundler is trying to run `#{command}` at runtime. You probably need to run `bundle install`. However, "
21
21
  msg << "this error message could probably be more useful. Please submit a ticket at https://github.com/rubygems/rubygems/issues/new?labels=Bundler&template=bundler-related-issue.md "
22
22
  msg << "with steps to reproduce as well as the following\n\nCALLER: #{caller.join("\n")}"
23
23
  super msg
@@ -27,11 +27,11 @@ module Bundler
27
27
  class GitCommandError < GitError
28
28
  attr_reader :command
29
29
 
30
- def initialize(command, path, destination_path, extra_info = nil)
30
+ def initialize(command, path, extra_info = nil)
31
31
  @command = command
32
32
 
33
33
  msg = String.new
34
- msg << "Git error: command `git #{command}` in directory #{destination_path} has failed."
34
+ msg << "Git error: command `#{command}` in directory #{path} has failed."
35
35
  msg << "\n#{extra_info}" if extra_info
36
36
  msg << "\nIf this error persists you could try removing the cache directory '#{path}'" if path.exist?
37
37
  super msg
@@ -39,9 +39,9 @@ module Bundler
39
39
  end
40
40
 
41
41
  class MissingGitRevisionError < GitCommandError
42
- def initialize(command, path, destination_path, ref, repo)
42
+ def initialize(command, destination_path, ref, repo)
43
43
  msg = "Revision #{ref} does not exist in the repository #{repo}. Maybe you misspelled it?"
44
- super command, path, destination_path, msg
44
+ super command, destination_path, msg
45
45
  end
46
46
  end
47
47
 
@@ -67,13 +67,13 @@ module Bundler
67
67
 
68
68
  def branch
69
69
  @branch ||= allowed_with_path do
70
- git("rev-parse --abbrev-ref HEAD", :dir => path).strip
70
+ git("rev-parse", "--abbrev-ref", "HEAD", :dir => path).strip
71
71
  end
72
72
  end
73
73
 
74
74
  def contains?(commit)
75
75
  allowed_with_path do
76
- result, status = git_null("branch --contains #{commit}", :dir => path)
76
+ result, status = git_null("branch", "--contains", commit, :dir => path)
77
77
  status.success? && result =~ /^\* (.*)$/
78
78
  end
79
79
  end
@@ -88,20 +88,22 @@ module Bundler
88
88
 
89
89
  def checkout
90
90
  return if path.exist? && has_revision_cached?
91
- extra_ref = "#{Shellwords.shellescape(ref)}:#{Shellwords.shellescape(ref)}" if ref && ref.start_with?("refs/")
91
+ extra_ref = "#{ref}:#{ref}" if ref && ref.start_with?("refs/")
92
92
 
93
93
  Bundler.ui.info "Fetching #{URICredentialsFilter.credential_filtered_uri(uri)}"
94
94
 
95
+ configured_uri = configured_uri_for(uri).to_s
96
+
95
97
  unless path.exist?
96
98
  SharedHelpers.filesystem_access(path.dirname) do |p|
97
99
  FileUtils.mkdir_p(p)
98
100
  end
99
- git_retry %(clone #{uri_escaped_with_configured_credentials} "#{path}" --bare --no-hardlinks --quiet)
101
+ git_retry "clone", configured_uri, path.to_s, "--bare", "--no-hardlinks", "--quiet"
100
102
  return unless extra_ref
101
103
  end
102
104
 
103
105
  with_path do
104
- git_retry %(fetch --force --quiet --tags #{uri_escaped_with_configured_credentials} "refs/heads/*:refs/heads/*" #{extra_ref}), :dir => path
106
+ git_retry(*["fetch", "--force", "--quiet", "--tags", configured_uri, "refs/heads/*:refs/heads/*", extra_ref].compact, :dir => path)
105
107
  end
106
108
  end
107
109
 
@@ -115,7 +117,7 @@ module Bundler
115
117
  SharedHelpers.filesystem_access(destination) do |p|
116
118
  FileUtils.rm_rf(p)
117
119
  end
118
- git_retry %(clone --no-checkout --quiet "#{path}" "#{destination}")
120
+ git_retry "clone", "--no-checkout", "--quiet", path.to_s, destination.to_s
119
121
  File.chmod(((File.stat(destination).mode | 0o777) & ~File.umask), destination)
120
122
  rescue Errno::EEXIST => e
121
123
  file_path = e.message[%r{.*?((?:[a-zA-Z]:)?/.*)}, 1]
@@ -125,56 +127,59 @@ module Bundler
125
127
  end
126
128
  end
127
129
  # method 2
128
- git_retry %(fetch --force --quiet --tags "#{path}"), :dir => destination
130
+ git_retry "fetch", "--force", "--quiet", "--tags", path.to_s, :dir => destination
129
131
 
130
132
  begin
131
- git "reset --hard #{@revision}", :dir => destination
133
+ git "reset", "--hard", @revision, :dir => destination
132
134
  rescue GitCommandError => e
133
- raise MissingGitRevisionError.new(e.command, path, destination, @revision, URICredentialsFilter.credential_filtered_uri(uri))
135
+ raise MissingGitRevisionError.new(e.command, destination, @revision, URICredentialsFilter.credential_filtered_uri(uri))
134
136
  end
135
137
 
136
138
  if submodules
137
- git_retry "submodule update --init --recursive", :dir => destination
139
+ git_retry "submodule", "update", "--init", "--recursive", :dir => destination
138
140
  elsif Gem::Version.create(version) >= Gem::Version.create("2.9.0")
139
141
  inner_command = "git -C $toplevel submodule deinit --force $sm_path"
140
- inner_command = inner_command.gsub("$") { '\$' } unless Bundler::WINDOWS
141
- git_retry "submodule foreach --quiet \"#{inner_command}\"", :dir => destination
142
+ git_retry "submodule", "foreach", "--quiet", inner_command, :dir => destination
142
143
  end
143
144
  end
144
145
 
145
146
  private
146
147
 
147
- def git_null(command, dir: SharedHelpers.pwd)
148
+ def git_null(*command, dir: nil)
148
149
  check_allowed(command)
149
150
 
150
151
  out, status = SharedHelpers.with_clean_git_env do
151
- capture_and_ignore_stderr("git #{command}", :chdir => dir.to_s)
152
+ capture_and_ignore_stderr(*capture3_args_for(command, dir))
152
153
  end
153
154
 
154
155
  [URICredentialsFilter.credential_filtered_string(out, uri), status]
155
156
  end
156
157
 
157
- def git_retry(command, dir: SharedHelpers.pwd)
158
- Bundler::Retry.new("`git #{URICredentialsFilter.credential_filtered_string(command, uri)}`", GitNotAllowedError).attempts do
159
- git(command, :dir => dir)
158
+ def git_retry(*command, dir: nil)
159
+ command_with_no_credentials = check_allowed(command)
160
+
161
+ Bundler::Retry.new("`#{command_with_no_credentials}` at #{dir || SharedHelpers.pwd}").attempts do
162
+ git(*command, :dir => dir)
160
163
  end
161
164
  end
162
165
 
163
- def git(command, dir: SharedHelpers.pwd)
166
+ def git(*command, dir: nil)
164
167
  command_with_no_credentials = check_allowed(command)
165
168
 
166
169
  out, status = SharedHelpers.with_clean_git_env do
167
- capture_and_filter_stderr(uri, "git #{command}", :chdir => dir.to_s)
170
+ capture_and_filter_stderr(*capture3_args_for(command, dir))
168
171
  end
169
172
 
170
- raise GitCommandError.new(command_with_no_credentials, path, dir) unless status.success?
173
+ filtered_out = URICredentialsFilter.credential_filtered_string(out, uri)
174
+
175
+ raise GitCommandError.new(command_with_no_credentials, dir || SharedHelpers.pwd, filtered_out) unless status.success?
171
176
 
172
- URICredentialsFilter.credential_filtered_string(out, uri)
177
+ filtered_out
173
178
  end
174
179
 
175
180
  def has_revision_cached?
176
181
  return unless @revision
177
- with_path { git("cat-file -e #{@revision}", :dir => path) }
182
+ with_path { git("cat-file", "-e", @revision, :dir => path) }
178
183
  true
179
184
  rescue GitError
180
185
  false
@@ -186,24 +191,10 @@ module Bundler
186
191
 
187
192
  def find_local_revision
188
193
  allowed_with_path do
189
- git("rev-parse --verify #{Shellwords.shellescape(ref)}", :dir => path).strip
194
+ git("rev-parse", "--verify", ref || "HEAD", :dir => path).strip
190
195
  end
191
196
  rescue GitCommandError => e
192
- raise MissingGitRevisionError.new(e.command, path, path, ref, URICredentialsFilter.credential_filtered_uri(uri))
193
- end
194
-
195
- # Escape the URI for git commands
196
- def uri_escaped_with_configured_credentials
197
- remote = configured_uri_for(uri)
198
- if Bundler::WINDOWS
199
- # Windows quoting requires double quotes only, with double quotes
200
- # inside the string escaped by being doubled.
201
- '"' + remote.gsub('"') { '""' } + '"'
202
- else
203
- # Bash requires single quoted strings, with the single quotes escaped
204
- # by ending the string, escaping the quote, and restarting the string.
205
- "'" + remote.gsub("'") { "'\\''" } + "'"
206
- end
197
+ raise MissingGitRevisionError.new(e.command, path, ref, URICredentialsFilter.credential_filtered_uri(uri))
207
198
  end
208
199
 
209
200
  # Adds credentials to the URI as Fetcher#configured_uri_for does
@@ -233,23 +224,37 @@ module Bundler
233
224
  end
234
225
 
235
226
  def check_allowed(command)
236
- command_with_no_credentials = URICredentialsFilter.credential_filtered_string(command, uri)
227
+ command_with_no_credentials = URICredentialsFilter.credential_filtered_string("git #{command.shelljoin}", uri)
237
228
  raise GitNotAllowedError.new(command_with_no_credentials) unless allow?
238
229
  command_with_no_credentials
239
230
  end
240
231
 
241
- def capture_and_filter_stderr(uri, cmd, chdir: SharedHelpers.pwd)
232
+ def capture_and_filter_stderr(*cmd)
242
233
  require "open3"
243
- return_value, captured_err, status = Open3.capture3(cmd, :chdir => chdir)
244
- Bundler.ui.warn URICredentialsFilter.credential_filtered_string(captured_err, uri) if uri && !captured_err.empty?
234
+ return_value, captured_err, status = Open3.capture3(*cmd)
235
+ Bundler.ui.warn URICredentialsFilter.credential_filtered_string(captured_err, uri) unless captured_err.empty?
245
236
  [return_value, status]
246
237
  end
247
238
 
248
- def capture_and_ignore_stderr(cmd, chdir: SharedHelpers.pwd)
239
+ def capture_and_ignore_stderr(*cmd)
249
240
  require "open3"
250
- return_value, _, status = Open3.capture3(cmd, :chdir => chdir)
241
+ return_value, _, status = Open3.capture3(*cmd)
251
242
  [return_value, status]
252
243
  end
244
+
245
+ def capture3_args_for(cmd, dir)
246
+ return ["git", *cmd] unless dir
247
+
248
+ if Bundler.feature_flag.bundler_3_mode? || supports_minus_c?
249
+ ["git", "-C", dir.to_s, *cmd]
250
+ else
251
+ ["git", *cmd, { :chdir => dir.to_s }]
252
+ end
253
+ end
254
+
255
+ def supports_minus_c?
256
+ @supports_minus_c ||= Gem::Version.new(version) >= Gem::Version.new("1.8.5")
257
+ end
253
258
  end
254
259
  end
255
260
  end
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative "../../rubygems_gem_installer"
4
+
3
5
  module Bundler
4
6
  class Source
5
7
  class Path
@@ -145,6 +145,8 @@ module Bundler
145
145
 
146
146
  Bundler.mkdir_p bin_path, :no_sudo => true unless spec.executables.empty? || Bundler.rubygems.provides?(">= 2.7.5")
147
147
 
148
+ require_relative "../rubygems_gem_installer"
149
+
148
150
  installed_spec = Bundler::RubyGemsGemInstaller.at(
149
151
  path,
150
152
  :install_dir => install_path.to_s,
@@ -351,7 +353,6 @@ module Bundler
351
353
  def installed_specs
352
354
  @installed_specs ||= Index.build do |idx|
353
355
  Bundler.rubygems.all_specs.reverse_each do |spec|
354
- next if spec.name == "bundler"
355
356
  spec.source = self
356
357
  if Bundler.rubygems.spec_missing_extensions?(spec, false)
357
358
  Bundler.ui.debug "Source #{self} is ignoring #{spec} because it is missing extensions"
@@ -487,8 +488,15 @@ module Bundler
487
488
  uri = spec.remote.uri
488
489
  Bundler.ui.confirm("Fetching #{version_message(spec)}")
489
490
  rubygems_local_path = Bundler.rubygems.download_gem(spec, uri, download_path)
491
+
492
+ # older rubygems return varying file:// variants depending on version
493
+ rubygems_local_path = rubygems_local_path.gsub(/\Afile:/, "") unless Bundler.rubygems.provides?(">= 3.2.0.rc.2")
494
+ rubygems_local_path = rubygems_local_path.gsub(%r{\A//}, "") if Bundler.rubygems.provides?("< 3.1.0")
495
+
490
496
  if rubygems_local_path != local_path
491
- FileUtils.mv(rubygems_local_path, local_path)
497
+ SharedHelpers.filesystem_access(local_path) do
498
+ FileUtils.mv(rubygems_local_path, local_path)
499
+ end
492
500
  end
493
501
  cache_globally(spec, local_path)
494
502
  end
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "set"
4
-
5
3
  module Bundler
6
4
  class SourceList
7
5
  attr_reader :path_sources,
@@ -99,7 +97,7 @@ module Bundler
99
97
  @rubygems_aggregate = replacement_rubygems if replacement_rubygems
100
98
 
101
99
  return true if !equal_sources?(lock_sources, replacement_sources) && !equivalent_sources?(lock_sources, replacement_sources)
102
- return true if replacement_rubygems && rubygems_remotes.to_set != replacement_rubygems.remotes.to_set
100
+ return true if replacement_rubygems && rubygems_remotes.sort_by(&:to_s) != replacement_rubygems.remotes.sort_by(&:to_s)
103
101
 
104
102
  false
105
103
  end
@@ -153,7 +151,7 @@ module Bundler
153
151
  end
154
152
 
155
153
  def equal_sources?(lock_sources, replacement_sources)
156
- lock_sources.to_set == replacement_sources.to_set
154
+ lock_sources.sort_by(&:to_s) == replacement_sources.sort_by(&:to_s)
157
155
  end
158
156
 
159
157
  def equal_source?(source, other_source)
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "tsort"
4
- require "set"
5
4
 
6
5
  module Bundler
7
6
  class SpecSet
@@ -13,14 +12,16 @@ module Bundler
13
12
  end
14
13
 
15
14
  def for(dependencies, skip = [], check = false, match_current_platform = false, raise_on_missing = true)
16
- handled = Set.new
15
+ handled = []
17
16
  deps = dependencies.dup
18
17
  specs = []
19
18
  skip += ["bundler"]
20
19
 
21
20
  loop do
22
21
  break unless dep = deps.shift
23
- next if !handled.add?(dep) || skip.include?(dep.name)
22
+ next if handled.include?(dep) || skip.include?(dep.name)
23
+
24
+ handled << dep
24
25
 
25
26
  specs_for_dep = spec_for_dependency(dep, match_current_platform)
26
27
  if specs_for_dep.any?
@@ -28,7 +29,7 @@ module Bundler
28
29
 
29
30
  specs_for_dep.first.dependencies.each do |d|
30
31
  next if d.type == :development
31
- d = DepProxy.new(d, dep.__platform) unless match_current_platform
32
+ d = DepProxy.get_proxy(d, dep.__platform) unless match_current_platform
32
33
  deps << d
33
34
  end
34
35
  elsif check