rubygems-update 3.2.23 → 3.2.24

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: 34d592c07f3fc05d6a1201bb1cd26e0ace4cbced2f6030cdc552a8f8fc2a384f
4
- data.tar.gz: 4cc3ad43ce2aad0c4787622f521b1d10fac300dc68b17926067f26b69c64f558
3
+ metadata.gz: a4e4aacbfe1b4e9161fb46d8c061fbeef0eb1021c6637e728b21411c0bc98027
4
+ data.tar.gz: 9b2e7347fce9d278b068fa8f61ae126b884a70b21d2b14b2628fce82c5db8442
5
5
  SHA512:
6
- metadata.gz: 1e8ae581d0b154dc77f54c9235c186034a374f456d3f226157c6a9852389c047449cfb7d8959258fceef79ce6f6695d0aa2ad4c003c0cd4968f3fffa81c60c6a
7
- data.tar.gz: fe0aa438ee051a2f4e66c309f3d5945d53deba4ddf63a2118ad68a859591c17a2b30dd9f88d76be84b99c167b34627da43c49ee3eca929ced2926a6ed6a8000a
6
+ metadata.gz: 1dba7bb0f85830a5751e4c35393681a1f724039d0b1f0d7477d89fb7c8d32c3d9e7037dcb9410c1219b282070f2e518328c6220618a8adb86ff6e5783a62e804
7
+ data.tar.gz: c35f72c29ee46ad3f8f9d343d480a33b8d5cd7dcb07bbf272722fd9462b1c62a8dde6814e822a309c0e04dfd6c7e0b45d2ad4a35bf758a406782dde7f947fa93
data/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ # 3.2.24 / 2021-07-15
2
+
3
+ ## Bug fixes:
4
+
5
+ * Fix contradictory message about deletion of default gem. Pull request
6
+ #4739 by jaredbeck
7
+
8
+ ## Documentation:
9
+
10
+ * Add a description about `GEM_HOST_OTP_CODE` to help text. Pull request
11
+ #4742 by ybiquitous
12
+
1
13
  # 3.2.23 / 2021-07-09
2
14
 
3
15
  ## Enhancements:
data/bundler/CHANGELOG.md CHANGED
@@ -1,3 +1,16 @@
1
+ # 2.2.24 (July 15, 2021)
2
+
3
+ ## Bug fixes:
4
+
5
+ - Fix development gem unintentionally removed on an edge case [#4751](https://github.com/rubygems/rubygems/pull/4751)
6
+ - Fix dangling empty plugin hooks [#4755](https://github.com/rubygems/rubygems/pull/4755)
7
+ - Fix `bundle plugin install --help` showing `bundle install`'s help [#4756](https://github.com/rubygems/rubygems/pull/4756)
8
+ - Make sure `bundle check` shows uniq missing gems [#4749](https://github.com/rubygems/rubygems/pull/4749)
9
+
10
+ ## Performance:
11
+
12
+ - Slightly speed up `bundler/setup` [#4750](https://github.com/rubygems/rubygems/pull/4750)
13
+
1
14
  # 2.2.23 (July 9, 2021)
2
15
 
3
16
  ## Enhancements:
@@ -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 = "2021-07-09".freeze
8
- @git_commit_sha = "e863a3905d".freeze
7
+ @built_at = "2021-07-15".freeze
8
+ @git_commit_sha = "d78b1ee235".freeze
9
9
  @release = true
10
10
  # end ivars
11
11
 
@@ -14,6 +14,7 @@ module Bundler
14
14
  COMMAND_ALIASES = {
15
15
  "check" => "c",
16
16
  "install" => "i",
17
+ "plugin" => "",
17
18
  "list" => "ls",
18
19
  "exec" => ["e", "ex", "exe"],
19
20
  "cache" => ["package", "pack"],
@@ -133,7 +133,7 @@ module Bundler
133
133
  @unlock[:gems] ||= @dependencies.map(&:name)
134
134
  else
135
135
  eager_unlock = expand_dependencies(@unlock[:gems] || [], true)
136
- @unlock[:gems] = @locked_specs.for(eager_unlock, [], false, false, false).map(&:name)
136
+ @unlock[:gems] = @locked_specs.for(eager_unlock, false, false, false).map(&:name)
137
137
  end
138
138
 
139
139
  @dependency_changes = converge_dependencies
@@ -185,25 +185,15 @@ module Bundler
185
185
  #
186
186
  # @return [Bundler::SpecSet]
187
187
  def specs
188
- @specs ||= begin
189
- begin
190
- specs = resolve.materialize(requested_dependencies)
191
- rescue GemNotFound => e # Handle yanked gem
192
- gem_name, gem_version = extract_gem_info(e)
193
- locked_gem = @locked_specs[gem_name].last
194
- raise if locked_gem.nil? || locked_gem.version.to_s != gem_version || !@remote
195
- raise GemNotFound, "Your bundle is locked to #{locked_gem} from #{locked_gem.source}, but that version can " \
196
- "no longer be found in that source. That means the author of #{locked_gem} has removed it. " \
197
- "You'll need to update your bundle to a version other than #{locked_gem} that hasn't been " \
198
- "removed in order to install."
199
- end
200
- unless specs["bundler"].any?
201
- bundler = sources.metadata_source.specs.search(Gem::Dependency.new("bundler", VERSION)).last
202
- specs["bundler"] = bundler
203
- end
204
-
205
- specs
206
- end
188
+ @specs ||= add_bundler_to(resolve.materialize(requested_dependencies))
189
+ rescue GemNotFound => e # Handle yanked gem
190
+ gem_name, gem_version = extract_gem_info(e)
191
+ locked_gem = @locked_specs[gem_name].last
192
+ raise if locked_gem.nil? || locked_gem.version.to_s != gem_version || !@remote
193
+ raise GemNotFound, "Your bundle is locked to #{locked_gem} from #{locked_gem.source}, but that version can " \
194
+ "no longer be found in that source. That means the author of #{locked_gem} has removed it. " \
195
+ "You'll need to update your bundle to a version other than #{locked_gem} that hasn't been " \
196
+ "removed in order to install."
207
197
  end
208
198
 
209
199
  def new_specs
@@ -235,17 +225,11 @@ module Bundler
235
225
  end
236
226
 
237
227
  def requested_specs
238
- @requested_specs ||= begin
239
- groups = requested_groups
240
- groups.map!(&:to_sym)
241
- specs_for(groups)
242
- end
228
+ specs_for(requested_groups)
243
229
  end
244
230
 
245
231
  def requested_dependencies
246
- groups = requested_groups
247
- groups.map!(&:to_sym)
248
- dependencies_for(groups)
232
+ dependencies_for(requested_groups)
249
233
  end
250
234
 
251
235
  def current_dependencies
@@ -255,11 +239,13 @@ module Bundler
255
239
  end
256
240
 
257
241
  def specs_for(groups)
242
+ groups = requested_groups if groups.empty?
258
243
  deps = dependencies_for(groups)
259
- SpecSet.new(specs.for(expand_dependencies(deps)))
244
+ add_bundler_to(resolve.materialize(expand_dependencies(deps)))
260
245
  end
261
246
 
262
247
  def dependencies_for(groups)
248
+ groups.map!(&:to_sym)
263
249
  current_dependencies.reject do |d|
264
250
  (d.groups & groups).empty?
265
251
  end
@@ -507,6 +493,15 @@ module Bundler
507
493
 
508
494
  private
509
495
 
496
+ def add_bundler_to(specs)
497
+ unless specs["bundler"].any?
498
+ bundler = sources.metadata_source.specs.search(Gem::Dependency.new("bundler", VERSION)).last
499
+ specs["bundler"] = bundler
500
+ end
501
+
502
+ specs
503
+ end
504
+
510
505
  def precompute_source_requirements_for_indirect_dependencies?
511
506
  sources.non_global_rubygems_sources.all?(&:dependency_api_available?) && !sources.aggregate_global_source?
512
507
  end
@@ -735,7 +730,7 @@ module Bundler
735
730
  # if we won't need the source (according to the lockfile),
736
731
  # don't error if the path/git source isn't available
737
732
  next if @locked_specs.
738
- for(requested_dependencies, [], false, true, false).
733
+ for(requested_dependencies, false, true, false).
739
734
  none? {|locked_spec| locked_spec.source == s.source }
740
735
 
741
736
  raise
@@ -754,8 +749,8 @@ module Bundler
754
749
  end
755
750
 
756
751
  resolve = SpecSet.new(converged)
757
- @locked_specs_incomplete_for_platform = !resolve.for(expand_dependencies(requested_dependencies & deps), @unlock[:gems], true, true)
758
- resolve = SpecSet.new(resolve.for(expand_dependencies(deps, true), [], false, false, false).reject{|s| @unlock[:gems].include?(s.name) })
752
+ @locked_specs_incomplete_for_platform = !resolve.for(expand_dependencies(requested_dependencies & deps), true, true)
753
+ resolve = SpecSet.new(resolve.for(expand_dependencies(deps, true), false, false, false).reject{|s| @unlock[:gems].include?(s.name) })
759
754
  diff = nil
760
755
 
761
756
  # Now, we unlock any sources that do not have anymore gems pinned to it
@@ -102,38 +102,39 @@ module Bundler
102
102
  # if there's already a dependency with this name we try to prefer one
103
103
  if current = @dependencies.find {|d| d.name == dep.name }
104
104
  deleted_dep = @dependencies.delete(current) if current.type == :development
105
- return if deleted_dep
106
105
 
107
- if current.requirement != dep.requirement
108
- return if dep.type == :development
106
+ unless deleted_dep
107
+ if current.requirement != dep.requirement
108
+ return if dep.type == :development
109
109
 
110
- update_prompt = ""
110
+ update_prompt = ""
111
111
 
112
- if File.basename(@gemfile) == Injector::INJECTED_GEMS
113
- if dep.requirements_list.include?(">= 0") && !current.requirements_list.include?(">= 0")
114
- update_prompt = ". Gem already added"
115
- else
116
- update_prompt = ". If you want to update the gem version, run `bundle update #{current.name}`"
112
+ if File.basename(@gemfile) == Injector::INJECTED_GEMS
113
+ if dep.requirements_list.include?(">= 0") && !current.requirements_list.include?(">= 0")
114
+ update_prompt = ". Gem already added"
115
+ else
116
+ update_prompt = ". If you want to update the gem version, run `bundle update #{current.name}`"
117
117
 
118
- update_prompt += ". You may also need to change the version requirement specified in the Gemfile if it's too restrictive." unless current.requirements_list.include?(">= 0")
118
+ update_prompt += ". You may also need to change the version requirement specified in the Gemfile if it's too restrictive." unless current.requirements_list.include?(">= 0")
119
+ end
119
120
  end
120
- end
121
121
 
122
- raise GemfileError, "You cannot specify the same gem twice with different version requirements.\n" \
123
- "You specified: #{current.name} (#{current.requirement}) and #{dep.name} (#{dep.requirement})" \
124
- "#{update_prompt}"
125
- else
126
- Bundler.ui.warn "Your Gemfile lists the gem #{current.name} (#{current.requirement}) more than once.\n" \
127
- "You should probably keep only one of them.\n" \
128
- "Remove any duplicate entries and specify the gem only once.\n" \
129
- "While it's not a problem now, it could cause errors if you change the version of one of them later."
130
- end
122
+ raise GemfileError, "You cannot specify the same gem twice with different version requirements.\n" \
123
+ "You specified: #{current.name} (#{current.requirement}) and #{dep.name} (#{dep.requirement})" \
124
+ "#{update_prompt}"
125
+ else
126
+ Bundler.ui.warn "Your Gemfile lists the gem #{current.name} (#{current.requirement}) more than once.\n" \
127
+ "You should probably keep only one of them.\n" \
128
+ "Remove any duplicate entries and specify the gem only once.\n" \
129
+ "While it's not a problem now, it could cause errors if you change the version of one of them later."
130
+ end
131
131
 
132
- if current.source != dep.source
133
- return if dep.type == :development
134
- raise GemfileError, "You cannot specify the same gem twice coming from different sources.\n" \
135
- "You specified that #{dep.name} (#{dep.requirement}) should come from " \
136
- "#{current.source || "an unspecified source"} and #{dep.source}\n"
132
+ if current.source != dep.source
133
+ return if dep.type == :development
134
+ raise GemfileError, "You cannot specify the same gem twice coming from different sources.\n" \
135
+ "You specified that #{dep.name} (#{dep.requirement}) should come from " \
136
+ "#{current.source || "an unspecified source"} and #{dep.source}\n"
137
+ end
137
138
  end
138
139
  end
139
140
 
@@ -3,7 +3,7 @@
3
3
  module Bundler
4
4
  class Standalone
5
5
  def initialize(groups, definition)
6
- @specs = groups.empty? ? definition.requested_specs : definition.specs_for(groups.map(&:to_sym))
6
+ @specs = definition.specs_for(groups)
7
7
  end
8
8
 
9
9
  def generate
@@ -309,6 +309,8 @@ module Bundler
309
309
  #
310
310
  # @param [String] name of the plugin
311
311
  def load_plugin(name)
312
+ return unless name && !name.empty?
313
+
312
314
  # Need to ensure before this that plugin root where the rest of gems
313
315
  # are installed to be on load path to support plugin deps. Currently not
314
316
  # done to avoid conflicts
@@ -74,7 +74,10 @@ module Bundler
74
74
  def unregister_plugin(name)
75
75
  @commands.delete_if {|_, v| v == name }
76
76
  @sources.delete_if {|_, v| v == name }
77
- @hooks.each {|_, plugin_names| plugin_names.delete(name) }
77
+ @hooks.each do |hook, names|
78
+ names.delete(name)
79
+ @hooks.delete(hook) if names.empty?
80
+ end
78
81
  @plugin_paths.delete(name)
79
82
  @load_paths.delete(name)
80
83
  save_index
@@ -12,12 +12,10 @@ module Bundler
12
12
  def setup(*groups)
13
13
  @definition.ensure_equivalent_gemfile_and_lockfile if Bundler.frozen_bundle?
14
14
 
15
- groups.map!(&:to_sym)
16
-
17
15
  # Has to happen first
18
16
  clean_load_path
19
17
 
20
- specs = groups.any? ? @definition.specs_for(groups) : requested_specs
18
+ specs = @definition.specs_for(groups)
21
19
 
22
20
  SharedHelpers.set_bundle_environment
23
21
  Bundler.rubygems.replace_entrypoints(specs)
@@ -11,15 +11,14 @@ module Bundler
11
11
  @specs = specs
12
12
  end
13
13
 
14
- def for(dependencies, skip = [], check = false, match_current_platform = false, raise_on_missing = true)
14
+ def for(dependencies, check = false, match_current_platform = false, raise_on_missing = true)
15
15
  handled = []
16
16
  deps = dependencies.dup
17
17
  specs = []
18
- skip += ["bundler"]
19
18
 
20
19
  loop do
21
20
  break unless dep = deps.shift
22
- next if handled.include?(dep) || skip.include?(dep.name)
21
+ next if handled.any?{|d| d.name == dep.name && (match_current_platform || d.__platform == dep.__platform) } || dep.name == "bundler"
23
22
 
24
23
  handled << dep
25
24
 
@@ -73,7 +72,7 @@ module Bundler
73
72
  end
74
73
 
75
74
  def materialize(deps, missing_specs = nil)
76
- materialized = self.for(deps, [], false, true, !missing_specs)
75
+ materialized = self.for(deps, false, true, !missing_specs)
77
76
 
78
77
  materialized.group_by(&:source).each do |source, specs|
79
78
  next unless specs.any?{|s| s.is_a?(LazySpecification) }
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: false
2
2
 
3
3
  module Bundler
4
- VERSION = "2.2.23".freeze
4
+ VERSION = "2.2.24".freeze
5
5
 
6
6
  def self.bundler_major_version
7
7
  @bundler_major_version ||= VERSION.split(".").first.to_i
data/lib/rubygems.rb CHANGED
@@ -8,7 +8,7 @@
8
8
  require 'rbconfig'
9
9
 
10
10
  module Gem
11
- VERSION = "3.2.23".freeze
11
+ VERSION = "3.2.24".freeze
12
12
  end
13
13
 
14
14
  # Must be first since it unloads the prelude from 1.9.2
@@ -31,7 +31,8 @@ module Gem::GemcutterUtilities
31
31
 
32
32
  def add_otp_option
33
33
  add_option('--otp CODE',
34
- 'Digit code for multifactor authentication') do |value, options|
34
+ 'Digit code for multifactor authentication',
35
+ 'You can also use the environment variable GEM_HOST_OTP_CODE') do |value, options|
35
36
  options[:otp] = value
36
37
  end
37
38
  end
@@ -70,6 +70,9 @@ class Gem::Uninstaller
70
70
  # only add user directory if install_dir is not set
71
71
  @user_install = false
72
72
  @user_install = options[:user_install] unless options[:install_dir]
73
+
74
+ # Optimization: populated during #uninstall
75
+ @default_specs_matching_uninstall_params = []
73
76
  end
74
77
 
75
78
  ##
@@ -98,10 +101,8 @@ class Gem::Uninstaller
98
101
  default_specs, list = list.partition do |spec|
99
102
  spec.default_gem?
100
103
  end
101
-
102
- default_specs.each do |default_spec|
103
- say "Gem #{default_spec.full_name} cannot be uninstalled because it is a default gem"
104
- end
104
+ warn_cannot_uninstall_default_gems(default_specs - list)
105
+ @default_specs_matching_uninstall_params = default_specs
105
106
 
106
107
  list, other_repo_specs = list.partition do |spec|
107
108
  @gem_home == spec.base_dir or
@@ -270,7 +271,7 @@ class Gem::Uninstaller
270
271
  end
271
272
 
272
273
  safe_delete { FileUtils.rm_r gemspec }
273
- say "Successfully uninstalled #{spec.full_name}"
274
+ announce_deletion_of(spec)
274
275
 
275
276
  Gem::Specification.reset
276
277
  end
@@ -373,4 +374,34 @@ class Gem::Uninstaller
373
374
 
374
375
  raise e
375
376
  end
377
+
378
+ private
379
+
380
+ def announce_deletion_of(spec)
381
+ name = spec.full_name
382
+ say "Successfully uninstalled #{name}"
383
+ if default_spec_matches?(spec)
384
+ say(
385
+ "There was both a regular copy and a default copy of #{name}. The " \
386
+ "regular copy was successfully uninstalled, but the default copy " \
387
+ "was left around because default gems can't be removed."
388
+ )
389
+ end
390
+ end
391
+
392
+ # @return true if the specs of any default gems are `==` to the given `spec`.
393
+ def default_spec_matches?(spec)
394
+ !default_specs_that_match(spec).empty?
395
+ end
396
+
397
+ # @return [Array] specs of default gems that are `==` to the given `spec`.
398
+ def default_specs_that_match(spec)
399
+ @default_specs_matching_uninstall_params.select {|default_spec| spec == default_spec }
400
+ end
401
+
402
+ def warn_cannot_uninstall_default_gems(specs)
403
+ specs.each do |spec|
404
+ say "Gem #{spec.full_name} cannot be uninstalled because it is a default gem"
405
+ end
406
+ end
376
407
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "rubygems-update"
5
- s.version = "3.2.23"
5
+ s.version = "3.2.24"
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
 
@@ -295,8 +295,15 @@ class TestGemUninstaller < Gem::InstallerTestCase
295
295
 
296
296
  uninstaller = Gem::Uninstaller.new spec.name, :executables => true
297
297
 
298
- uninstaller.uninstall
299
-
298
+ ui = Gem::MockGemUi.new "1\ny\n"
299
+ use_ui ui do
300
+ uninstaller.uninstall
301
+ end
302
+ expected = "Successfully uninstalled default-2\n" \
303
+ "There was both a regular copy and a default copy of default-2. The " \
304
+ "regular copy was successfully uninstalled, but the default copy " \
305
+ "was left around because default gems can't be removed.\n"
306
+ assert_equal expected, ui.output
300
307
  assert_path_not_exist spec.gem_dir
301
308
  end
302
309
 
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.23
4
+ version: 3.2.24
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: 2021-07-09 00:00:00.000000000 Z
19
+ date: 2021-07-15 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
@@ -771,7 +771,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
771
771
  - !ruby/object:Gem::Version
772
772
  version: '0'
773
773
  requirements: []
774
- rubygems_version: 3.2.23
774
+ rubygems_version: 3.2.24
775
775
  signing_key:
776
776
  specification_version: 4
777
777
  summary: RubyGems is a package management framework for Ruby.