rubygems-update 3.2.4 → 3.2.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d93499fede75e4516b9007d926ad52f4428cc1361dfc8720635ce85daef669e5
4
- data.tar.gz: ca5b261892f92350f5e9a922757780c9718751d11d21251c6f4f189cb8f27bf7
3
+ metadata.gz: 2f6bb6c4c3306717f1cbb6c31a681fb34fe87a80908be9788cf9b8670acd0f45
4
+ data.tar.gz: 54f8871259d5e897c28946c66908e8ee64cf96be9dfd13e3fe47ed75f92a0fca
5
5
  SHA512:
6
- metadata.gz: 61ed9d7bdad4ae0d6f49980503fe583c71870d86695a1e050ad9bab5549538b13cdb87fbc9859ed89e902a6e580137dedc053bf59191553173101d862bd7b0f1
7
- data.tar.gz: 54ffb6db2ff4a6ae6772ca38a4ad26a5458b6783c21a10f2c932ff0408191cd52fae270b7936eb3f183a2d61a8cfd7e05dfd4d01a0064124e9013ecd61a7abc1
6
+ metadata.gz: 56a73fe1ec095a370b2b8ebc93e0a4aa8e8986841b33b02a5eca4475e89fa59929039a4a9aae248e4aa8f6cef2236d7e47d887c98df2487ab5f5f265af1f2084
7
+ data.tar.gz: 50aacfbe514a2c5a0567325bded2095de0fdb2a33f794bb8f2872855848ad88594d82189bfcf67767909daf9e8e6f984f3a7b9de5dcd1bf1c4c34f018ea51ec2
@@ -1,3 +1,12 @@
1
+ # 3.2.5 / 2021-01-11
2
+
3
+ ## Bug fixes:
4
+
5
+ * Don't load more specs after the whole set of specs has been setup. Pull
6
+ request #4262 by deivid-rodriguez
7
+ * Fix broken `bundler` executable after `gem update --system`. Pull
8
+ request #4221 by deivid-rodriguez
9
+
1
10
  # 3.2.4 / 2020-12-31
2
11
 
3
12
  ## Enhancements:
data/Rakefile CHANGED
@@ -7,9 +7,7 @@ require 'psych'
7
7
 
8
8
  desc "Setup Rubygems dev environment"
9
9
  task :setup do
10
- version = File.read("dev_gems.rb.lock").split(/BUNDLED WITH\n /).last
11
- sh "gem install bundler:#{version}"
12
- sh "bundle install --gemfile=dev_gems.rb"
10
+ sh "ruby bundler/bin/bundle install --gemfile=dev_gems.rb"
13
11
  end
14
12
 
15
13
  desc "Setup git hooks"
@@ -183,11 +181,7 @@ end
183
181
 
184
182
  desc "Upload release to S3"
185
183
  task :upload_to_s3 do
186
- begin
187
- require "aws-sdk-s3"
188
- rescue LoadError
189
- abort "Install the aws-sdk-s3 gem to be able to upload gems to rubygems.org."
190
- end
184
+ require "aws-sdk-s3"
191
185
 
192
186
  s3 = Aws::S3::Resource.new(region:'us-west-2')
193
187
  %w[zip tgz].each do |ext|
@@ -313,9 +307,7 @@ To update to the latest RubyGems you can run:
313
307
 
314
308
  gem update --system
315
309
 
316
- If you need to upgrade or downgrade please follow the [how to upgrade/downgrade
317
- RubyGems][upgrading] instructions. To install RubyGems by hand see the
318
- [Download RubyGems][download] page.
310
+ To install RubyGems by hand see the [Download RubyGems][download] page.
319
311
 
320
312
  #{history.release_notes_for_blog.join("\n")}
321
313
 
@@ -324,7 +316,6 @@ SHA256 Checksums:
324
316
  #{checksums}
325
317
 
326
318
  [download]: https://rubygems.org/pages/download
327
- [upgrading]: http://docs.seattlerb.org/rubygems/UPGRADING_rdoc.html
328
319
 
329
320
  ANNOUNCEMENT
330
321
 
@@ -1,3 +1,19 @@
1
+ # 2.2.5 (January 11, 2021)
2
+
3
+ ## Enhancements:
4
+
5
+ - Improve rubocop setup in the new gem template [#4220](https://github.com/rubygems/rubygems/pull/4220)
6
+ - Support repositories with default branch not named master [#4224](https://github.com/rubygems/rubygems/pull/4224)
7
+
8
+ ## Bug fixes:
9
+
10
+ - Let Net::HTTP decompress the index instead of doing it manually [#4081](https://github.com/rubygems/rubygems/pull/4081)
11
+ - Workaround for another jruby crash when autoloading a constant [#4252](https://github.com/rubygems/rubygems/pull/4252)
12
+ - Fix another performance regression in the resolver [#4243](https://github.com/rubygems/rubygems/pull/4243)
13
+ - Restore support for old git versions [#4233](https://github.com/rubygems/rubygems/pull/4233)
14
+ - Give a proper error if cache path does not have write access [#4215](https://github.com/rubygems/rubygems/pull/4215)
15
+ - Fix running `rake release` from an ambiguous ref [#4219](https://github.com/rubygems/rubygems/pull/4219)
16
+
1
17
  # 2.2.4 (December 31, 2020)
2
18
 
3
19
  ## Bug fixes:
@@ -327,7 +343,7 @@
327
343
  - Fix `bundle update` message about exclude groups saying "installed" instead of "updated" ([#7150](https://github.com/rubygems/bundler/pull/7150))
328
344
  - Fix `bundle licenses` not showing correct information about bundler itself ([#7147](https://github.com/rubygems/bundler/pull/7147))
329
345
  - Fix installation path not including ruby scope when `BUNDLE_PATH` was set ([#7163](https://github.com/rubygems/bundler/pull/7163))
330
- - Fix `bundle clean` incorrectly removing git depedencies present in the Gemfile when rubygems 3.0+ was used and path involved a symlink ([#7211](https://github.com/rubygems/bundler/pull/7211))
346
+ - Fix `bundle clean` incorrectly removing git dependencies present in the Gemfile when rubygems 3.0+ was used and path involved a symlink ([#7211](https://github.com/rubygems/bundler/pull/7211))
331
347
  - Fix platform specific gems always being re-resolved when bundler was not running under that platform ([#7212](https://github.com/rubygems/bundler/pull/7212))
332
348
  - Fix `bundle package --all-platforms` causing `bundle install` to ignore `--with` and `--without` ([#6113](https://github.com/rubygems/bundler/pull/6113))
333
349
  - Fix `MissingRevision` git errors to include the specific `git` command that failed under the hood ([#7225](https://github.com/rubygems/bundler/pull/7225))
@@ -499,7 +515,7 @@ Changes
499
515
  ## Bug fixes:
500
516
 
501
517
  - Fix issue where updating a gem resulted in the gem's version being downgraded when `BUNDLE_ONLY_UPDATE_TO_NEWER_VERSIONS` was set ([#6529](https://github.com/rubygems/bundler/issues/6529), @theflow)
502
- - Fix some rescue calls that don't specifiy error type (@utilum)
518
+ - Fix some rescue calls that don't specify error type (@utilum)
503
519
  - Fix an issue when the Lockfile would contain platform-specific gems that it didn't need ([#6491](https://github.com/rubygems/bundler/issues/6491), @segiddins)
504
520
  - Improve handling of adding new gems with only a single group to the Gemfile in `bundle add` (@agrim123)
505
521
  - Refactor check for OpenSSL in `bundle env` (@voxik)
@@ -63,7 +63,6 @@ module Bundler
63
63
  autoload :Resolver, File.expand_path("bundler/resolver", __dir__)
64
64
  autoload :Retry, File.expand_path("bundler/retry", __dir__)
65
65
  autoload :RubyDsl, File.expand_path("bundler/ruby_dsl", __dir__)
66
- autoload :RubyGemsGemInstaller, File.expand_path("bundler/rubygems_gem_installer", __dir__)
67
66
  autoload :RubyVersion, File.expand_path("bundler/ruby_version", __dir__)
68
67
  autoload :Runtime, File.expand_path("bundler/runtime", __dir__)
69
68
  autoload :Settings, File.expand_path("bundler/settings", __dir__)
@@ -4,8 +4,8 @@ module Bundler
4
4
  # Represents metadata from when the Bundler gem was built.
5
5
  module BuildMetadata
6
6
  # begin ivars
7
- @built_at = "2020-12-31".freeze
8
- @git_commit_sha = "529e536f28".freeze
7
+ @built_at = "2021-01-11".freeze
8
+ @git_commit_sha = "ba867aed7f".freeze
9
9
  @release = true
10
10
  # end ivars
11
11
 
@@ -59,6 +59,7 @@ module Bundler
59
59
  :exe => options[:exe],
60
60
  :bundler_version => bundler_dependency_version,
61
61
  :github_username => github_username.empty? ? "[USERNAME]" : github_username,
62
+ :required_ruby_version => Gem.ruby_version < Gem::Version.new("2.4.a") ? "2.3.0" : "2.4.0",
62
63
  }
63
64
  ensure_safe_gem_name(name, constant_array)
64
65
 
@@ -147,6 +148,7 @@ module Bundler
147
148
  "For more information, see the RuboCop docs (https://docs.rubocop.org/en/stable/) " \
148
149
  "and the Ruby Style Guides (https://github.com/rubocop-hq/ruby-style-guide).")
149
150
  config[:rubocop] = true
151
+ config[:rubocop_version] = Gem.ruby_version < Gem::Version.new("2.4.a") ? "0.81.0" : "1.7"
150
152
  Bundler.ui.info "RuboCop enabled in config"
151
153
  templates.merge!("rubocop.yml.tt" => ".rubocop.yml")
152
154
  end
@@ -1,8 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "../vendored_fileutils"
4
- require "stringio"
5
- require "zlib"
6
4
 
7
5
  module Bundler
8
6
  class CompactIndexClient
@@ -45,18 +43,12 @@ module Bundler
45
43
  else
46
44
  "bytes=#{local_temp_path.size}-"
47
45
  end
48
- else
49
- # Fastly ignores Range when Accept-Encoding: gzip is set
50
- headers["Accept-Encoding"] = "gzip"
51
46
  end
52
47
 
53
48
  response = @fetcher.call(remote_path, headers)
54
49
  return nil if response.is_a?(Net::HTTPNotModified)
55
50
 
56
51
  content = response.body
57
- if response["Content-Encoding"] == "gzip"
58
- content = Zlib::GzipReader.new(StringIO.new(content)).read
59
- end
60
52
 
61
53
  SharedHelpers.filesystem_access(local_temp_path) do
62
54
  if response.is_a?(Net::HTTPPartialContent) && local_temp_path.size.nonzero?
@@ -117,13 +117,13 @@ module Bundler
117
117
  def git_push(remote = nil)
118
118
  remote ||= default_remote
119
119
  perform_git_push remote
120
- perform_git_push "#{remote} #{version_tag}"
120
+ perform_git_push "#{remote} refs/tags/#{version_tag}"
121
121
  Bundler.ui.confirm "Pushed git commits and release tag."
122
122
  end
123
123
 
124
124
  def default_remote
125
- current_branch = sh(%w[git rev-parse --abbrev-ref HEAD]).strip
126
- return "origin" if current_branch.empty?
125
+ # We can replace this with `git branch --show-current` once we drop support for git < 2.22.0
126
+ current_branch = sh(%w[git rev-parse --abbrev-ref HEAD]).gsub(%r{\Aheads/}, "").strip
127
127
 
128
128
  remote_for_branch = sh(%W[git config --get branch.#{current_branch}.remote]).strip
129
129
  return "origin" if remote_for_branch.empty?
@@ -163,7 +163,12 @@ module Bundler
163
163
  # Add a spec group for "non platform specific spec" as the fallback
164
164
  # spec group.
165
165
  sg_ruby = sg.copy_for([Gem::Platform::RUBY])
166
- selected_sgs.insert(-2, sg_ruby) if sg_ruby
166
+ next unless sg_ruby
167
+
168
+ sg_ruby_deps = sg_ruby.dependencies_for_activated_platforms.map(&:dep)
169
+ sg_all_platforms_deps = sg_all_platforms.dependencies_for_activated_platforms.map(&:dep)
170
+
171
+ selected_sgs.insert(-2, sg_ruby) if sg_ruby_deps != sg_all_platforms_deps
167
172
  end
168
173
  selected_sgs
169
174
  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
@@ -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
 
@@ -132,7 +132,7 @@ module Bundler
132
132
  begin
133
133
  git "reset", "--hard", @revision, :dir => destination
134
134
  rescue GitCommandError => e
135
- 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))
136
136
  end
137
137
 
138
138
  if submodules
@@ -145,32 +145,36 @@ module Bundler
145
145
 
146
146
  private
147
147
 
148
- def git_null(*command, dir: SharedHelpers.pwd)
148
+ def git_null(*command, dir: nil)
149
149
  check_allowed(command)
150
150
 
151
151
  out, status = SharedHelpers.with_clean_git_env do
152
- capture_and_ignore_stderr("git", "-C", dir.to_s, *command)
152
+ capture_and_ignore_stderr(*capture3_args_for(command, dir))
153
153
  end
154
154
 
155
155
  [URICredentialsFilter.credential_filtered_string(out, uri), status]
156
156
  end
157
157
 
158
- def git_retry(*command, dir: SharedHelpers.pwd)
159
- Bundler::Retry.new("`git -C #{dir} #{URICredentialsFilter.credential_filtered_string(command.shelljoin, uri)}`", GitNotAllowedError).attempts do
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
160
162
  git(*command, :dir => dir)
161
163
  end
162
164
  end
163
165
 
164
- def git(*command, dir: SharedHelpers.pwd)
166
+ def git(*command, dir: nil)
165
167
  command_with_no_credentials = check_allowed(command)
166
168
 
167
169
  out, status = SharedHelpers.with_clean_git_env do
168
- capture_and_filter_stderr("git", "-C", dir.to_s, *command)
170
+ capture_and_filter_stderr(*capture3_args_for(command, dir))
169
171
  end
170
172
 
171
- 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?
172
176
 
173
- URICredentialsFilter.credential_filtered_string(out, uri)
177
+ filtered_out
174
178
  end
175
179
 
176
180
  def has_revision_cached?
@@ -187,10 +191,10 @@ module Bundler
187
191
 
188
192
  def find_local_revision
189
193
  allowed_with_path do
190
- git("rev-parse", "--verify", ref, :dir => path).strip
194
+ git("rev-parse", "--verify", ref || "HEAD", :dir => path).strip
191
195
  end
192
196
  rescue GitCommandError => e
193
- raise MissingGitRevisionError.new(e.command, path, path, ref, URICredentialsFilter.credential_filtered_uri(uri))
197
+ raise MissingGitRevisionError.new(e.command, path, ref, URICredentialsFilter.credential_filtered_uri(uri))
194
198
  end
195
199
 
196
200
  # Adds credentials to the URI as Fetcher#configured_uri_for does
@@ -220,7 +224,7 @@ module Bundler
220
224
  end
221
225
 
222
226
  def check_allowed(command)
223
- command_with_no_credentials = URICredentialsFilter.credential_filtered_string(command.shelljoin, uri)
227
+ command_with_no_credentials = URICredentialsFilter.credential_filtered_string("git #{command.shelljoin}", uri)
224
228
  raise GitNotAllowedError.new(command_with_no_credentials) unless allow?
225
229
  command_with_no_credentials
226
230
  end
@@ -237,6 +241,20 @@ module Bundler
237
241
  return_value, _, status = Open3.capture3(*cmd)
238
242
  [return_value, status]
239
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
240
258
  end
241
259
  end
242
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,
@@ -487,8 +489,15 @@ module Bundler
487
489
  uri = spec.remote.uri
488
490
  Bundler.ui.confirm("Fetching #{version_message(spec)}")
489
491
  rubygems_local_path = Bundler.rubygems.download_gem(spec, uri, download_path)
492
+
493
+ # older rubygems return varying file:// variants depending on version
494
+ rubygems_local_path = rubygems_local_path.gsub(/\Afile:/, "") unless Bundler.rubygems.provides?(">= 3.2.0.rc.2")
495
+ rubygems_local_path = rubygems_local_path.gsub(%r{\A//}, "") if Bundler.rubygems.provides?("< 3.1.0")
496
+
490
497
  if rubygems_local_path != local_path
491
- FileUtils.mv(rubygems_local_path, local_path)
498
+ SharedHelpers.filesystem_access(local_path) do
499
+ FileUtils.mv(rubygems_local_path, local_path)
500
+ end
492
501
  end
493
502
  cache_globally(spec, local_path)
494
503
  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
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: false
2
2
 
3
3
  module Bundler
4
- VERSION = "2.2.4".freeze
4
+ VERSION = "2.2.5".freeze
5
5
 
6
6
  def self.bundler_major_version
7
7
  @bundler_major_version ||= VERSION.split(".").first.to_i
@@ -8,7 +8,7 @@
8
8
  require 'rbconfig'
9
9
 
10
10
  module Gem
11
- VERSION = "3.2.4".freeze
11
+ VERSION = "3.2.5".freeze
12
12
  end
13
13
 
14
14
  # Must be first since it unloads the prelude from 1.9.2
@@ -375,9 +375,7 @@ By default, this RubyGems will install gem as:
375
375
  specs_dir = File.join(options[:destdir], specs_dir) unless Gem.win_platform?
376
376
  mkdir_p specs_dir, :mode => 0755
377
377
 
378
- bundler_spec = Gem::Specification.load("bundler/bundler.gemspec")
379
- bundler_spec.files = Dir.chdir("bundler") { Dir["{*.md,{lib,exe}/**/*}"] }
380
- bundler_spec.executables -= %w[bundler bundle_ruby]
378
+ bundler_spec = Dir.chdir("bundler") { Gem::Specification.load("bundler.gemspec") }
381
379
 
382
380
  # Remove bundler-*.gemspec in default specification directory.
383
381
  Dir.entries(specs_dir).
@@ -182,6 +182,7 @@ class Gem::Specification < Gem::BasicSpecification
182
182
  @@default_value[k].nil?
183
183
  end
184
184
 
185
+ @@stubs = nil
185
186
  @@stubs_by_name = {}
186
187
 
187
188
  # Sentinel object to represent "not found" stubs
@@ -800,10 +801,8 @@ class Gem::Specification < Gem::BasicSpecification
800
801
  def self.stubs
801
802
  @@stubs ||= begin
802
803
  pattern = "*.gemspec"
803
- stubs = installed_stubs(dirs, pattern) + default_stubs(pattern)
804
- stubs = stubs.uniq {|stub| stub.full_name }
804
+ stubs = stubs_for_pattern(pattern, false)
805
805
 
806
- _resort!(stubs)
807
806
  @@stubs_by_name = stubs.select {|s| Gem::Platform.match_spec? s }.group_by(&:name)
808
807
  stubs
809
808
  end
@@ -820,26 +819,31 @@ class Gem::Specification < Gem::BasicSpecification
820
819
  end
821
820
  end
822
821
 
823
- EMPTY = [].freeze # :nodoc:
824
-
825
822
  ##
826
823
  # Returns a Gem::StubSpecification for installed gem named +name+
827
824
  # only returns stubs that match Gem.platforms
828
825
 
829
826
  def self.stubs_for(name)
830
- if @@stubs_by_name[name]
831
- @@stubs_by_name[name]
827
+ if @@stubs
828
+ @@stubs_by_name[name] || []
832
829
  else
833
- pattern = "#{name}-*.gemspec"
834
- stubs = installed_stubs(dirs, pattern).select {|s| Gem::Platform.match_spec? s } + default_stubs(pattern)
835
- stubs = stubs.uniq {|stub| stub.full_name }.group_by(&:name)
836
- stubs.each_value {|v| _resort!(v) }
837
-
838
- @@stubs_by_name.merge! stubs
839
- @@stubs_by_name[name] ||= EMPTY
830
+ @@stubs_by_name[name] ||= stubs_for_pattern("#{name}-*.gemspec")
840
831
  end
841
832
  end
842
833
 
834
+ ##
835
+ # Finds stub specifications matching a pattern from the standard locations,
836
+ # optionally filtering out specs not matching the current platform
837
+ #
838
+ def self.stubs_for_pattern(pattern, match_platform = true) # :nodoc:
839
+ installed_stubs = installed_stubs(Gem::Specification.dirs, pattern)
840
+ installed_stubs.select! {|s| Gem::Platform.match_spec? s } if match_platform
841
+ stubs = installed_stubs + default_stubs(pattern)
842
+ stubs = stubs.uniq {|stub| stub.full_name }
843
+ _resort!(stubs)
844
+ stubs
845
+ end
846
+
843
847
  def self._resort!(specs) # :nodoc:
844
848
  specs.sort! do |a, b|
845
849
  names = a.name <=> b.name
@@ -26,7 +26,20 @@ begin
26
26
  rescue LoadError
27
27
  end
28
28
 
29
- require 'bundler'
29
+ if File.exist?(bundler_gemspec)
30
+ require_relative '../../bundler/lib/bundler'
31
+ else
32
+ require 'bundler'
33
+ end
34
+
35
+ # Enable server plugin needed for bisection
36
+ if ENV["RG_BISECT_SERVER_PLUGIN"]
37
+ require ENV["RG_BISECT_SERVER_PLUGIN"]
38
+
39
+ Minitest.extensions << "server"
40
+ end
41
+
42
+ ENV["MT_NO_PLUGINS"] = "true"
30
43
 
31
44
  require 'minitest/autorun'
32
45
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "rubygems-update"
5
- s.version = "3.2.4"
5
+ s.version = "3.2.5"
6
6
  s.authors = ["Jim Weirich", "Chad Fowler", "Eric Hodel", "Luis Lavena", "Aaron Patterson", "Samuel Giddins", "André Arko", "Evan Phoenix", "Hiroshi SHIBATA"]
7
7
  s.email = ["", "", "drbrain@segment7.net", "luislavena@gmail.com", "aaron@tenderlovemaking.com", "segiddins@segiddins.me", "andre@arko.net", "evan@phx.io", "hsbt@ruby-lang.org"]
8
8
 
@@ -24,6 +24,7 @@ class TestGemCommandsSetupCommand < Gem::TestCase
24
24
  lib/rubygems/test_case.rb
25
25
  lib/rubygems/ssl_certs/rubygems.org/foo.pem
26
26
  bundler/exe/bundle
27
+ bundler/exe/bundler
27
28
  bundler/lib/bundler.rb
28
29
  bundler/lib/bundler/b.rb
29
30
  bundler/bin/bundler/man/bundle-b.1
@@ -41,7 +42,7 @@ class TestGemCommandsSetupCommand < Gem::TestCase
41
42
  gemspec.name = "bundler"
42
43
  gemspec.version = BUNDLER_VERS
43
44
  gemspec.bindir = "exe"
44
- gemspec.executables = ["bundle"]
45
+ gemspec.executables = ["bundle", "bundler"]
45
46
 
46
47
  File.open 'bundler/bundler.gemspec', 'w' do |io|
47
48
  io.puts gemspec.to_ruby
@@ -135,6 +136,7 @@ class TestGemCommandsSetupCommand < Gem::TestCase
135
136
  exec_line = out.shift until exec_line == "RubyGems installed the following executables:"
136
137
  assert_equal "\t#{default_gem_bin_path}", out.shift
137
138
  assert_equal "\t#{default_bundle_bin_path}", out.shift
139
+ assert_equal "\t#{default_bundler_bin_path}", out.shift
138
140
  end
139
141
 
140
142
  def test_env_shebang_flag
@@ -152,6 +154,7 @@ class TestGemCommandsSetupCommand < Gem::TestCase
152
154
  bin_env = win_platform? ? "" : %w[/usr/bin/env /bin/env].find {|f| File.executable?(f) } + " "
153
155
  assert_match %r{\A#!\s*#{bin_env}#{ruby_exec}}, File.read(default_gem_bin_path)
154
156
  assert_match %r{\A#!\s*#{bin_env}#{ruby_exec}}, File.read(default_bundle_bin_path)
157
+ assert_match %r{\A#!\s*#{bin_env}#{ruby_exec}}, File.read(default_bundler_bin_path)
155
158
  assert_match %r{\A#!\s*#{bin_env}#{ruby_exec}}, File.read(gem_bin_path)
156
159
  end
157
160
 
@@ -387,4 +390,8 @@ class TestGemCommandsSetupCommand < Gem::TestCase
387
390
  def default_bundle_bin_path
388
391
  File.join @install_dir, 'bin', 'bundle'
389
392
  end
393
+
394
+ def default_bundler_bin_path
395
+ File.join @install_dir, 'bin', 'bundler'
396
+ end
390
397
  end unless Gem.java_platform?
@@ -1161,6 +1161,14 @@ dependencies: []
1161
1161
  Gem::Specification.class_variable_set(:@@stubs, nil)
1162
1162
  end
1163
1163
 
1164
+ def test_self_stubs_for_no_lazy_loading_after_all_specs_setup
1165
+ Gem::Specification.all = [util_spec('a', '1')]
1166
+
1167
+ save_gemspec('b-1', '1', File.join(Gem.dir, 'specifications')){|s| s.name = 'b' }
1168
+
1169
+ assert_equal [], Gem::Specification.stubs_for('b').map {|s| s.full_name }
1170
+ end
1171
+
1164
1172
  def test_self_stubs_for_mult_platforms
1165
1173
  # gems for two different platforms are installed with --user-install
1166
1174
  # the correct one should be returned in the array
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubygems-update
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.4
4
+ version: 3.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jim Weirich
@@ -16,7 +16,7 @@ authors:
16
16
  autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
- date: 2020-12-31 00:00:00.000000000 Z
19
+ date: 2021-01-11 00:00:00.000000000 Z
20
20
  dependencies: []
21
21
  description: |-
22
22
  A package (also known as a library) contains a set of functionality