rubygems-update 3.2.2 → 3.2.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. checksums.yaml +4 -4
  2. data/{History.txt → CHANGELOG.md} +482 -424
  3. data/Manifest.txt +30 -27
  4. data/Rakefile +11 -15
  5. data/bundler/CHANGELOG.md +67 -2
  6. data/bundler/bundler.gemspec +1 -1
  7. data/bundler/lib/bundler.rb +3 -7
  8. data/bundler/lib/bundler/build_metadata.rb +2 -2
  9. data/bundler/lib/bundler/cli.rb +2 -5
  10. data/bundler/lib/bundler/cli/cache.rb +1 -0
  11. data/bundler/lib/bundler/cli/gem.rb +2 -0
  12. data/bundler/lib/bundler/cli/update.rb +1 -1
  13. data/bundler/lib/bundler/compact_index_client/cache.rb +5 -13
  14. data/bundler/lib/bundler/compact_index_client/gem_parser.rb +28 -0
  15. data/bundler/lib/bundler/compact_index_client/updater.rb +0 -8
  16. data/bundler/lib/bundler/definition.rb +29 -21
  17. data/bundler/lib/bundler/dep_proxy.rb +15 -8
  18. data/bundler/lib/bundler/feature_flag.rb +0 -1
  19. data/bundler/lib/bundler/fetcher.rb +0 -1
  20. data/bundler/lib/bundler/gem_helper.rb +9 -7
  21. data/bundler/lib/bundler/gem_helpers.rb +30 -24
  22. data/bundler/lib/bundler/gem_version_promoter.rb +2 -2
  23. data/bundler/lib/bundler/installer.rb +0 -17
  24. data/bundler/lib/bundler/installer/standalone.rb +14 -0
  25. data/bundler/lib/bundler/lazy_specification.rb +10 -11
  26. data/bundler/{man → lib/bundler/man}/bundle-add.1 +1 -1
  27. data/bundler/{man → lib/bundler/man}/bundle-binstubs.1 +1 -1
  28. data/bundler/{man → lib/bundler/man}/bundle-cache.1 +1 -1
  29. data/bundler/{man → lib/bundler/man}/bundle-check.1 +1 -1
  30. data/bundler/{man → lib/bundler/man}/bundle-clean.1 +1 -1
  31. data/bundler/{man → lib/bundler/man}/bundle-config.1 +4 -4
  32. data/bundler/lib/bundler/man/bundle-config.1.ronn +3 -3
  33. data/bundler/{man → lib/bundler/man}/bundle-doctor.1 +1 -1
  34. data/bundler/{man → lib/bundler/man}/bundle-exec.1 +1 -1
  35. data/bundler/{man → lib/bundler/man}/bundle-gem.1 +1 -1
  36. data/bundler/{man → lib/bundler/man}/bundle-info.1 +1 -1
  37. data/bundler/{man → lib/bundler/man}/bundle-init.1 +1 -1
  38. data/bundler/{man → lib/bundler/man}/bundle-inject.1 +1 -1
  39. data/bundler/{man → lib/bundler/man}/bundle-install.1 +1 -1
  40. data/bundler/{man → lib/bundler/man}/bundle-list.1 +1 -1
  41. data/bundler/{man → lib/bundler/man}/bundle-lock.1 +1 -1
  42. data/bundler/{man → lib/bundler/man}/bundle-open.1 +1 -1
  43. data/bundler/{man → lib/bundler/man}/bundle-outdated.1 +1 -1
  44. data/bundler/{man → lib/bundler/man}/bundle-platform.1 +1 -1
  45. data/bundler/{man → lib/bundler/man}/bundle-pristine.1 +1 -1
  46. data/bundler/{man → lib/bundler/man}/bundle-remove.1 +1 -1
  47. data/bundler/{man → lib/bundler/man}/bundle-show.1 +1 -1
  48. data/bundler/{man → lib/bundler/man}/bundle-update.1 +1 -1
  49. data/bundler/{man → lib/bundler/man}/bundle-viz.1 +1 -1
  50. data/bundler/{man → lib/bundler/man}/bundle.1 +1 -1
  51. data/bundler/{man → lib/bundler/man}/gemfile.5 +1 -1
  52. data/bundler/{man → lib/bundler/man}/index.txt +0 -0
  53. data/bundler/lib/bundler/resolver.rb +36 -16
  54. data/bundler/lib/bundler/resolver/spec_group.rb +18 -23
  55. data/bundler/lib/bundler/rubygems_ext.rb +16 -0
  56. data/bundler/lib/bundler/rubygems_integration.rb +0 -5
  57. data/bundler/lib/bundler/settings.rb +1 -1
  58. data/bundler/lib/bundler/source/git.rb +19 -17
  59. data/bundler/lib/bundler/source/git/git_proxy.rb +54 -49
  60. data/bundler/lib/bundler/source/path/installer.rb +2 -0
  61. data/bundler/lib/bundler/source/rubygems.rb +10 -2
  62. data/bundler/lib/bundler/spec_set.rb +6 -9
  63. data/bundler/lib/bundler/templates/newgem/Gemfile.tt +1 -1
  64. data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +1 -1
  65. data/bundler/lib/bundler/templates/newgem/rubocop.yml.tt +3 -0
  66. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +7 -0
  67. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +1 -1
  68. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +11 -0
  69. data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +11 -7
  70. data/bundler/lib/bundler/version.rb +1 -1
  71. data/lib/rubygems.rb +2 -2
  72. data/lib/rubygems/commands/setup_command.rb +16 -62
  73. data/lib/rubygems/dependency_installer.rb +1 -0
  74. data/lib/rubygems/ext/builder.rb +5 -4
  75. data/lib/rubygems/ext/cmake_builder.rb +1 -2
  76. data/lib/rubygems/ext/configure_builder.rb +1 -2
  77. data/lib/rubygems/gemcutter_utilities.rb +2 -2
  78. data/lib/rubygems/installer.rb +0 -23
  79. data/lib/rubygems/installer_uninstaller_utils.rb +6 -1
  80. data/lib/rubygems/platform.rb +0 -4
  81. data/lib/rubygems/remote_fetcher.rb +4 -2
  82. data/lib/rubygems/request_set.rb +2 -13
  83. data/lib/rubygems/requirement.rb +1 -1
  84. data/lib/rubygems/resolver.rb +6 -1
  85. data/lib/rubygems/resolver/api_set.rb +28 -19
  86. data/lib/rubygems/resolver/api_set/gem_parser.rb +20 -0
  87. data/lib/rubygems/resolver/api_specification.rb +4 -3
  88. data/lib/rubygems/resolver/best_set.rb +2 -2
  89. data/lib/rubygems/resolver/index_specification.rb +18 -0
  90. data/lib/rubygems/resolver/installer_set.rb +57 -7
  91. data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/vertex.rb +1 -1
  92. data/lib/rubygems/resolver/molinillo/lib/molinillo/errors.rb +1 -1
  93. data/lib/rubygems/resolver/spec_specification.rb +14 -0
  94. data/lib/rubygems/resolver/specification.rb +12 -0
  95. data/lib/rubygems/source.rb +10 -6
  96. data/lib/rubygems/specification.rb +18 -14
  97. data/lib/rubygems/test_case.rb +17 -4
  98. data/rubygems-update.gemspec +2 -2
  99. data/test/rubygems/data/null-required-rubygems-version.gemspec.rz +0 -0
  100. data/test/rubygems/test_gem.rb +5 -0
  101. data/test/rubygems/test_gem_commands_install_command.rb +131 -0
  102. data/test/rubygems/test_gem_commands_setup_command.rb +21 -37
  103. data/test/rubygems/test_gem_dependency_installer.rb +27 -47
  104. data/test/rubygems/test_gem_ext_builder.rb +30 -6
  105. data/test/rubygems/test_gem_ext_cmake_builder.rb +2 -4
  106. data/test/rubygems/test_gem_ext_configure_builder.rb +2 -2
  107. data/test/rubygems/test_gem_installer.rb +8 -60
  108. data/test/rubygems/test_gem_platform.rb +8 -0
  109. data/test/rubygems/test_gem_remote_fetcher.rb +1 -1
  110. data/test/rubygems/test_gem_requirement.rb +34 -0
  111. data/test/rubygems/test_gem_resolver_api_set.rb +26 -52
  112. data/test/rubygems/test_gem_resolver_api_specification.rb +3 -3
  113. data/test/rubygems/test_gem_resolver_best_set.rb +26 -3
  114. data/test/rubygems/test_gem_source.rb +2 -2
  115. data/test/rubygems/test_gem_source_subpath_problem.rb +2 -2
  116. data/test/rubygems/test_gem_specification.rb +9 -3
  117. data/test/rubygems/test_gem_stream_ui.rb +1 -1
  118. metadata +34 -55
@@ -110,11 +110,6 @@ module Bundler
110
110
  obj.to_s
111
111
  end
112
112
 
113
- def platforms
114
- return [Gem::Platform::RUBY] if Bundler.settings[:force_ruby_platform]
115
- Gem.platforms
116
- end
117
-
118
113
  def configuration
119
114
  require_relative "psyched_yaml"
120
115
  Gem.configuration
@@ -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
@@ -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
@@ -22,12 +22,13 @@ module Bundler
22
22
  break unless dep = deps.shift
23
23
  next if !handled.add?(dep) || skip.include?(dep.name)
24
24
 
25
- if spec = spec_for_dependency(dep, match_current_platform)
26
- specs << spec
25
+ specs_for_dep = spec_for_dependency(dep, match_current_platform)
26
+ if specs_for_dep.any?
27
+ specs += specs_for_dep
27
28
 
28
- spec.dependencies.each do |d|
29
+ specs_for_dep.first.dependencies.each do |d|
29
30
  next if d.type == :development
30
- d = DepProxy.new(d, dep.__platform) unless match_current_platform
31
+ d = DepProxy.get_proxy(d, dep.__platform) unless match_current_platform
31
32
  deps << d
32
33
  end
33
34
  elsif check
@@ -184,11 +185,7 @@ module Bundler
184
185
  def spec_for_dependency(dep, match_current_platform)
185
186
  specs_for_platforms = lookup[dep.name]
186
187
  if match_current_platform
187
- Bundler.rubygems.platforms.reverse_each do |pl|
188
- match = GemHelpers.select_best_platform_match(specs_for_platforms, pl)
189
- return match if match
190
- end
191
- nil
188
+ GemHelpers.select_best_platform_match(specs_for_platforms, Bundler.local_platform)
192
189
  else
193
190
  GemHelpers.select_best_platform_match(specs_for_platforms, dep.__platform)
194
191
  end
@@ -16,5 +16,5 @@ gem "<%= config[:test] %>", "~> <%= config[:test_framework_version] %>"
16
16
  <%- end -%>
17
17
  <%- if config[:rubocop] -%>
18
18
 
19
- gem "rubocop", "~> 0.80"
19
+ gem "rubocop", "~> <%= config[:rubocop_version] %>"
20
20
  <%- end -%>
@@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
14
14
  <%- if config[:mit] -%>
15
15
  spec.license = "MIT"
16
16
  <%- end -%>
17
- spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
17
+ spec.required_ruby_version = Gem::Requirement.new(">= <%= config[:required_ruby_version] %>")
18
18
 
19
19
  spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
20
20
 
@@ -1,3 +1,6 @@
1
+ AllCops:
2
+ TargetRubyVersion: <%= ::Gem::Version.new(config[:required_ruby_version]).segments[0..1].join(".") %>
3
+
1
4
  Style/StringLiterals:
2
5
  Enabled: true
3
6
  EnforcedStyle: double_quotes
@@ -26,6 +26,13 @@ module Bundler::Molinillo
26
26
  end
27
27
  end
28
28
 
29
+ # (see Bundler::Molinillo::SpecificationProvider#dependencies_equal?)
30
+ def dependencies_equal?(dependencies, other_dependencies)
31
+ with_no_such_dependency_error_handling do
32
+ specification_provider.dependencies_equal?(dependencies, other_dependencies)
33
+ end
34
+ end
35
+
29
36
  # (see Bundler::Molinillo::SpecificationProvider#name_for)
30
37
  def name_for(dependency)
31
38
  with_no_such_dependency_error_handling do
@@ -121,7 +121,7 @@ module Bundler::Molinillo
121
121
  t = ''.dup
122
122
  depth = 2
123
123
  tree.each do |req|
124
- t << ' ' * depth << req.to_s
124
+ t << ' ' * depth << printable_requirement.call(req)
125
125
  unless tree.last == req
126
126
  if spec = conflict.activated_by_name[name_for(req)]
127
127
  t << %( was resolved to #{version_for_spec.call(spec)}, which)
@@ -45,6 +45,17 @@ module Bundler::Molinillo
45
45
  true
46
46
  end
47
47
 
48
+ # Determines whether two arrays of dependencies are equal, and thus can be
49
+ # grouped.
50
+ #
51
+ # @param [Array<Object>] dependencies
52
+ # @param [Array<Object>] other_dependencies
53
+ # @return [Boolean] whether `dependencies` and `other_dependencies` should
54
+ # be considered equal.
55
+ def dependencies_equal?(dependencies, other_dependencies)
56
+ dependencies == other_dependencies
57
+ end
58
+
48
59
  # Returns the name for the given `dependency`.
49
60
  # @note This method should be 'pure', i.e. the return value should depend
50
61
  # only on the `dependency` parameter.