rubygems-update 3.3.0 → 3.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 54e94fde92dd221d68a39c5ec1116f860999c9ea55f744ff77b02e84fca6f580
4
- data.tar.gz: 79682c276c94ea4e5a51d44f62f24ba38af3c41b6fda47a7ff58352143f517c0
3
+ metadata.gz: 2f3cab95c0495f8346fe4ddaa9d60f798d06132f484f36749d10035c29a9cab8
4
+ data.tar.gz: fecd45d7fa7b3c41ae7af764b062b8355d6986aadab9b513759e2af75a9d8720
5
5
  SHA512:
6
- metadata.gz: 72363f1d7b5ba733226562c433807f0ed13543e598adc030f274db516cacac54d7e748907db269a0fd1b8ada7a567986ddfe8db25a848a4edad8203301bcf02c
7
- data.tar.gz: 3c5c777ac829d9af2533e7717a4a3814266d8fc0b9c2f634a2e4173fc1763a0d80c15ffa02ec5c0ffb1ce9edc893f4121a3f9cf6731d3919532a006536e2b52b
6
+ metadata.gz: b4b89fb3675c171488c620a0d88998e5f31de023160b77d804c0cab871b8b09446e32e018e2a8923451bf8b2ee33d20c66e6374db97468c1654d677fafb12d37
7
+ data.tar.gz: 0e4ddbea298fca2bcbbdddf41bf90d9853d565e705ee5adb1035f6fd85d941ced05c4370511cc12102cc8804753d132a7ccc461316c90cd4644473995e3a0087
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ # 3.3.1 / 2021-12-22
2
+
3
+ ## Enhancements:
4
+
5
+ * Fix compatibility with OpenSSL 3.0. Pull request #5196 by rhenium
6
+ * Remove hard errors when matching major bundler not found. Pull request
7
+ #5181 by deivid-rodriguez
8
+ * Installs bundler 2.3.1 as a default gem.
9
+
1
10
  # 3.3.0 / 2021-12-21
2
11
 
3
12
  ## Breaking changes:
data/bundler/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ # 2.3.1 (December 22, 2021)
2
+
3
+ ## Enhancements:
4
+
5
+ - Vendor latest `thor` with fixes for latest `did_you_mean` deprecations [#5202](https://github.com/rubygems/rubygems/pull/5202)
6
+ - Avoid unnecessary `shellwords` require on newer rubygems [#5195](https://github.com/rubygems/rubygems/pull/5195)
7
+ - Re-exec prepending command with `Gem.ruby` if `$PROGRAM_NAME` is not executable [#5193](https://github.com/rubygems/rubygems/pull/5193)
8
+
1
9
  # 2.3.0 (December 21, 2021)
2
10
 
3
11
  ## Features:
@@ -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-12-21".freeze
8
- @git_commit_sha = "e7167b9a42".freeze
7
+ @built_at = "2021-12-22".freeze
8
+ @git_commit_sha = "7b38ca2f84".freeze
9
9
  @release = true
10
10
  # end ivars
11
11
 
@@ -67,7 +67,7 @@ module Bundler
67
67
  def build_extensions
68
68
  extension_cache_path = options[:bundler_extension_cache_path]
69
69
  unless extension_cache_path && extension_dir = spec.extension_dir
70
- require "shellwords" # compensate missing require in rubygems before version 3.2.25
70
+ require "shellwords" unless Bundler.rubygems.provides?(">= 3.2.25")
71
71
  return super
72
72
  end
73
73
 
@@ -39,10 +39,13 @@ module Bundler
39
39
  configured_gem_home = ENV["GEM_HOME"]
40
40
  configured_gem_path = ENV["GEM_PATH"]
41
41
 
42
+ cmd = [$PROGRAM_NAME, *ARGV]
43
+ cmd.unshift(Gem.ruby) unless File.executable?($PROGRAM_NAME)
44
+
42
45
  Bundler.with_original_env do
43
46
  Kernel.exec(
44
47
  { "GEM_HOME" => configured_gem_home, "GEM_PATH" => configured_gem_path, "BUNDLER_VERSION" => lockfile_version },
45
- $PROGRAM_NAME, *ARGV
48
+ *cmd
46
49
  )
47
50
  end
48
51
  end
@@ -210,9 +210,9 @@ class Bundler::Thor
210
210
  #
211
211
  # ==== Examples
212
212
  #
213
- # inject_into_class "app/controllers/application_controller.rb", ApplicationController, " filter_parameter :password\n"
213
+ # inject_into_class "app/controllers/application_controller.rb", "ApplicationController", " filter_parameter :password\n"
214
214
  #
215
- # inject_into_class "app/controllers/application_controller.rb", ApplicationController do
215
+ # inject_into_class "app/controllers/application_controller.rb", "ApplicationController" do
216
216
  # " filter_parameter :password\n"
217
217
  # end
218
218
  #
@@ -233,9 +233,9 @@ class Bundler::Thor
233
233
  #
234
234
  # ==== Examples
235
235
  #
236
- # inject_into_module "app/helpers/application_helper.rb", ApplicationHelper, " def help; 'help'; end\n"
236
+ # inject_into_module "app/helpers/application_helper.rb", "ApplicationHelper", " def help; 'help'; end\n"
237
237
  #
238
- # inject_into_module "app/helpers/application_helper.rb", ApplicationHelper do
238
+ # inject_into_module "app/helpers/application_helper.rb", "ApplicationHelper" do
239
239
  # " def help; 'help'; end\n"
240
240
  # end
241
241
  #
@@ -252,7 +252,7 @@ class Bundler::Thor
252
252
  # flag<Regexp|String>:: the regexp or string to be replaced
253
253
  # replacement<String>:: the replacement, can be also given as a block
254
254
  # config<Hash>:: give :verbose => false to not log the status, and
255
- # :force => true, to force the replacement regardless of runner behavior.
255
+ # :force => true, to force the replacement regardles of runner behavior.
256
256
  #
257
257
  # ==== Example
258
258
  #
@@ -331,7 +331,7 @@ class Bundler::Thor
331
331
  path = File.expand_path(path, destination_root)
332
332
 
333
333
  say_status :remove, relative_to_original_destination_root(path), config.fetch(:verbose, true)
334
- if !options[:pretend] && File.exist?(path)
334
+ if !options[:pretend] && (File.exist?(path) || File.symlink?(path))
335
335
  require "fileutils"
336
336
  ::FileUtils.rm_rf(path)
337
337
  end
@@ -106,12 +106,14 @@ class Bundler::Thor
106
106
  # Adds the content to the file.
107
107
  #
108
108
  def replace!(regexp, string, force)
109
- return if pretend?
110
109
  content = File.read(destination)
111
- if force || !content.include?(replacement)
110
+ before, after = content.split(regexp, 2)
111
+ snippet = (behavior == :after ? after : before).to_s
112
+
113
+ if force || !snippet.include?(replacement)
112
114
  success = content.gsub!(regexp, string)
113
115
 
114
- File.open(destination, "wb") { |file| file.write(content) }
116
+ File.open(destination, "wb") { |file| file.write(content) } unless pretend?
115
117
  success
116
118
  end
117
119
  end
@@ -161,6 +161,8 @@ class Bundler::Thor
161
161
  # to the block you provide. The path is set back to the previous path when
162
162
  # the method exits.
163
163
  #
164
+ # Returns the value yielded by the block.
165
+ #
164
166
  # ==== Parameters
165
167
  # dir<String>:: the directory to move to.
166
168
  # config<Hash>:: give :verbose => true to log and use padding.
@@ -179,16 +181,18 @@ class Bundler::Thor
179
181
  FileUtils.mkdir_p(destination_root)
180
182
  end
181
183
 
184
+ result = nil
182
185
  if pretend
183
186
  # In pretend mode, just yield down to the block
184
- block.arity == 1 ? yield(destination_root) : yield
187
+ result = block.arity == 1 ? yield(destination_root) : yield
185
188
  else
186
189
  require "fileutils"
187
- FileUtils.cd(destination_root) { block.arity == 1 ? yield(destination_root) : yield }
190
+ FileUtils.cd(destination_root) { result = block.arity == 1 ? yield(destination_root) : yield }
188
191
  end
189
192
 
190
193
  @destination_stack.pop
191
194
  shell.padding -= 1 if verbose
195
+ result
192
196
  end
193
197
 
194
198
  # Goes to the root and execute the given block.
@@ -28,6 +28,12 @@ class Bundler::Thor
28
28
  super(convert_key(key))
29
29
  end
30
30
 
31
+ def except(*keys)
32
+ dup.tap do |hash|
33
+ keys.each { |key| hash.delete(convert_key(key)) }
34
+ end
35
+ end
36
+
31
37
  def fetch(key, *args)
32
38
  super(convert_key(key), *args)
33
39
  end
@@ -102,9 +102,14 @@ class Bundler::Thor
102
102
  end
103
103
 
104
104
  if Correctable
105
- DidYouMean::SPELL_CHECKERS.merge!(
106
- 'Bundler::Thor::UndefinedCommandError' => UndefinedCommandError::SpellChecker,
107
- 'Bundler::Thor::UnknownArgumentError' => UnknownArgumentError::SpellChecker
108
- )
105
+ if DidYouMean.respond_to?(:correct_error)
106
+ DidYouMean.correct_error(Bundler::Thor::UndefinedCommandError, UndefinedCommandError::SpellChecker)
107
+ DidYouMean.correct_error(Bundler::Thor::UnknownArgumentError, UnknownArgumentError::SpellChecker)
108
+ else
109
+ DidYouMean::SPELL_CHECKERS.merge!(
110
+ 'Bundler::Thor::UndefinedCommandError' => UndefinedCommandError::SpellChecker,
111
+ 'Bundler::Thor::UnknownArgumentError' => UnknownArgumentError::SpellChecker
112
+ )
113
+ end
109
114
  end
110
115
  end
@@ -45,6 +45,7 @@ class Bundler::Thor
45
45
  @switches = {}
46
46
  @extra = []
47
47
  @stopped_parsing_after_extra_index = nil
48
+ @is_treated_as_value = false
48
49
 
49
50
  options.each do |option|
50
51
  @switches[option.switch_name] = option
@@ -74,8 +75,19 @@ class Bundler::Thor
74
75
  end
75
76
  end
76
77
 
78
+ def shift
79
+ @is_treated_as_value = false
80
+ super
81
+ end
82
+
83
+ def unshift(arg, is_value: false)
84
+ @is_treated_as_value = is_value
85
+ super(arg)
86
+ end
87
+
77
88
  def parse(args) # rubocop:disable MethodLength
78
89
  @pile = args.dup
90
+ @is_treated_as_value = false
79
91
  @parsing_options = true
80
92
 
81
93
  while peek
@@ -88,7 +100,10 @@ class Bundler::Thor
88
100
  when SHORT_SQ_RE
89
101
  unshift($1.split("").map { |f| "-#{f}" })
90
102
  next
91
- when EQ_RE, SHORT_NUM
103
+ when EQ_RE
104
+ unshift($2, is_value: true)
105
+ switch = $1
106
+ when SHORT_NUM
92
107
  unshift($2)
93
108
  switch = $1
94
109
  when LONG_RE, SHORT_RE
@@ -148,6 +163,7 @@ class Bundler::Thor
148
163
  # Two booleans are returned. The first is true if the current value
149
164
  # starts with a hyphen; the second is true if it is a registered switch.
150
165
  def current_is_switch?
166
+ return [false, false] if @is_treated_as_value
151
167
  case peek
152
168
  when LONG_RE, SHORT_RE, EQ_RE, SHORT_NUM
153
169
  [true, switch?($1)]
@@ -159,6 +175,7 @@ class Bundler::Thor
159
175
  end
160
176
 
161
177
  def current_is_switch_formatted?
178
+ return false if @is_treated_as_value
162
179
  case peek
163
180
  when LONG_RE, SHORT_RE, EQ_RE, SHORT_NUM, SHORT_SQ_RE
164
181
  true
@@ -168,6 +185,7 @@ class Bundler::Thor
168
185
  end
169
186
 
170
187
  def current_is_value?
188
+ return true if @is_treated_as_value
171
189
  peek && (!parsing_options? || super)
172
190
  end
173
191
 
@@ -103,6 +103,23 @@ class Bundler::Thor
103
103
  stdout.flush
104
104
  end
105
105
 
106
+ # Say (print) an error to the user. If the sentence ends with a whitespace
107
+ # or tab character, a new line is not appended (print + flush). Otherwise
108
+ # are passed straight to puts (behavior got from Highline).
109
+ #
110
+ # ==== Example
111
+ # say_error("error: something went wrong")
112
+ #
113
+ def say_error(message = "", color = nil, force_new_line = (message.to_s !~ /( |\t)\Z/))
114
+ return if quiet?
115
+
116
+ buffer = prepare_message(message, *color)
117
+ buffer << "\n" if force_new_line && !message.to_s.end_with?("\n")
118
+
119
+ stderr.print(buffer)
120
+ stderr.flush
121
+ end
122
+
106
123
  # Say a status with the given color and appends the message. Since this
107
124
  # method is used frequently by actions, it allows nil or false to be given
108
125
  # in log_status, avoiding the message from being shown. If a Symbol is
@@ -111,13 +128,14 @@ class Bundler::Thor
111
128
  def say_status(status, message, log_status = true)
112
129
  return if quiet? || log_status == false
113
130
  spaces = " " * (padding + 1)
114
- color = log_status.is_a?(Symbol) ? log_status : :green
115
-
116
131
  status = status.to_s.rjust(12)
132
+ margin = " " * status.length + spaces
133
+
134
+ color = log_status.is_a?(Symbol) ? log_status : :green
117
135
  status = set_color status, color, true if color
118
136
 
119
- buffer = "#{status}#{spaces}#{message}"
120
- buffer = "#{buffer}\n" unless buffer.end_with?("\n")
137
+ message = message.to_s.chomp.gsub(/(?<!\A)^/, margin)
138
+ buffer = "#{status}#{spaces}#{message}\n"
121
139
 
122
140
  stdout.print(buffer)
123
141
  stdout.flush
@@ -21,7 +21,7 @@ class Bundler::Thor
21
21
  end
22
22
 
23
23
  module Shell
24
- SHELL_DELEGATED_METHODS = [:ask, :error, :set_color, :yes?, :no?, :say, :say_status, :print_in_columns, :print_table, :print_wrapped, :file_collision, :terminal_width]
24
+ SHELL_DELEGATED_METHODS = [:ask, :error, :set_color, :yes?, :no?, :say, :say_error, :say_status, :print_in_columns, :print_table, :print_wrapped, :file_collision, :terminal_width]
25
25
  attr_writer :shell
26
26
 
27
27
  autoload :Basic, File.expand_path("shell/basic", __dir__)
@@ -211,7 +211,7 @@ class Bundler::Thor
211
211
  #
212
212
  def globs_for(path)
213
213
  path = escape_globs(path)
214
- ["#{path}/Thorfile", "#{path}/*.thor", "#{path}/tasks/*.thor", "#{path}/lib/tasks/*.thor"]
214
+ ["#{path}/Thorfile", "#{path}/*.thor", "#{path}/tasks/*.thor", "#{path}/lib/tasks/**/*.thor"]
215
215
  end
216
216
 
217
217
  # Return the path to the ruby interpreter taking into account multiple
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: false
2
2
 
3
3
  module Bundler
4
- VERSION = "2.3.0".freeze
4
+ VERSION = "2.3.1".freeze
5
5
 
6
6
  def self.bundler_major_version
7
7
  @bundler_major_version ||= VERSION.split(".").first.to_i
@@ -2,48 +2,18 @@
2
2
 
3
3
  module Gem::BundlerVersionFinder
4
4
  def self.bundler_version
5
- version, _ = bundler_version_with_reason
5
+ v = ENV["BUNDLER_VERSION"]
6
6
 
7
- return unless version
7
+ v ||= bundle_update_bundler_version
8
+ return if v == true
8
9
 
9
- Gem::Version.new(version)
10
- end
11
-
12
- def self.bundler_version_with_reason
13
- if v = ENV["BUNDLER_VERSION"]
14
- return [v, "`$BUNDLER_VERSION`"]
15
- end
16
- if v = bundle_update_bundler_version
17
- return if v == true
18
- return [v, "`bundle update --bundler`"]
19
- end
20
- v, lockfile = lockfile_version
21
- if v
22
- return [v, "your #{lockfile}"]
23
- end
24
- end
10
+ v ||= lockfile_version
11
+ return unless v
25
12
 
26
- def self.missing_version_message
27
- return unless vr = bundler_version_with_reason
28
- <<-EOS
29
- Could not find 'bundler' (#{vr.first}) required by #{vr.last}.
30
- To update to the latest version installed on your system, run `bundle update --bundler`.
31
- To install the missing version, run `gem install bundler:#{vr.first}`
32
- EOS
13
+ Gem::Version.new(v)
33
14
  end
34
15
 
35
- def self.compatible?(spec)
36
- return true unless spec.name == "bundler".freeze
37
- return true unless bundler_version = self.bundler_version
38
-
39
- spec.version.segments.first == bundler_version.segments.first
40
- end
41
-
42
- def self.filter!(specs)
43
- return unless bundler_version = self.bundler_version
44
-
45
- specs.reject! {|spec| spec.version.segments.first != bundler_version.segments.first }
46
-
16
+ def self.prioritize!(specs)
47
17
  exact_match_index = specs.find_index {|spec| spec.version == bundler_version }
48
18
  return unless exact_match_index
49
19
 
@@ -68,12 +38,10 @@ To install the missing version, run `gem install bundler:#{vr.first}`
68
38
  private_class_method :bundle_update_bundler_version
69
39
 
70
40
  def self.lockfile_version
71
- return unless lockfile = lockfile_contents
72
- lockfile, contents = lockfile
73
- lockfile ||= "lockfile"
41
+ return unless contents = lockfile_contents
74
42
  regexp = /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
75
43
  return unless contents =~ regexp
76
- [$1, lockfile]
44
+ $1
77
45
  end
78
46
  private_class_method :lockfile_version
79
47
 
@@ -103,7 +71,7 @@ To install the missing version, run `gem install bundler:#{vr.first}`
103
71
 
104
72
  return unless File.file?(lockfile)
105
73
 
106
- [lockfile, File.read(lockfile)]
74
+ File.read(lockfile)
107
75
  end
108
76
  private_class_method :lockfile_contents
109
77
  end
@@ -277,7 +277,7 @@ class Gem::Dependency
277
277
  requirement.satisfied_by?(spec.version) && env_req.satisfied_by?(spec.version)
278
278
  end.map(&:to_spec)
279
279
 
280
- Gem::BundlerVersionFinder.filter!(matches) if filters_bundler?
280
+ Gem::BundlerVersionFinder.prioritize!(matches) if prioritizes_bundler?
281
281
 
282
282
  if platform_only
283
283
  matches.reject! do |spec|
@@ -295,7 +295,7 @@ class Gem::Dependency
295
295
  @requirement.specific?
296
296
  end
297
297
 
298
- def filters_bundler?
298
+ def prioritizes_bundler?
299
299
  name == "bundler".freeze && !specific?
300
300
  end
301
301
 
@@ -325,11 +325,11 @@ class Gem::Dependency
325
325
  active = matches.find {|spec| spec.activated? }
326
326
  return active if active
327
327
 
328
- return matches.first if prerelease?
329
-
330
- # Move prereleases to the end of the list for >= 0 requirements
331
- pre, matches = matches.partition {|spec| spec.version.prerelease? }
332
- matches += pre if requirement == Gem::Requirement.default
328
+ unless prerelease?
329
+ # Move prereleases to the end of the list for >= 0 requirements
330
+ pre, matches = matches.partition {|spec| spec.version.prerelease? }
331
+ matches += pre if requirement == Gem::Requirement.default
332
+ end
333
333
 
334
334
  matches.first
335
335
  end
@@ -59,9 +59,6 @@ module Gem
59
59
  private
60
60
 
61
61
  def build_message
62
- if name == "bundler" && message = Gem::BundlerVersionFinder.missing_version_message
63
- return message
64
- end
65
62
  names = specs.map(&:full_name)
66
63
  "Could not find '#{name}' (#{requirement}) - did find: [#{names.join ','}]\n"
67
64
  end
@@ -115,11 +115,9 @@ class Gem::Security::Policy
115
115
  raise Gem::Security::Exception, 'missing key or signature'
116
116
  end
117
117
 
118
- public_key = Gem::Security.get_public_key(key)
119
-
120
118
  raise Gem::Security::Exception,
121
119
  "certificate #{signer.subject} does not match the signing key" unless
122
- signer.public_key.to_pem == public_key.to_pem
120
+ signer.check_private_key(key)
123
121
 
124
122
  true
125
123
  end
@@ -424,6 +424,8 @@ module Gem::Security
424
424
  # Gets the right public key from a PKey instance
425
425
 
426
426
  def self.get_public_key(key)
427
+ # Ruby 3.0 (Ruby/OpenSSL 2.2) or later
428
+ return OpenSSL::PKey.read(key.public_to_der) if key.respond_to?(:public_to_der)
427
429
  return key.public_key unless key.is_a?(OpenSSL::PKey::EC)
428
430
 
429
431
  ec_key = OpenSSL::PKey::EC.new(key.group.curve_name)
@@ -490,9 +492,13 @@ module Gem::Security
490
492
  when 'rsa'
491
493
  OpenSSL::PKey::RSA.new(RSA_DSA_KEY_LENGTH)
492
494
  when 'ec'
493
- domain_key = OpenSSL::PKey::EC.new(EC_NAME)
494
- domain_key.generate_key
495
- domain_key
495
+ if RUBY_VERSION >= "2.4.0"
496
+ OpenSSL::PKey::EC.generate(EC_NAME)
497
+ else
498
+ domain_key = OpenSSL::PKey::EC.new(EC_NAME)
499
+ domain_key.generate_key
500
+ domain_key
501
+ end
496
502
  else
497
503
  raise Gem::Security::Exception,
498
504
  "#{algorithm} algorithm not found. RSA, DSA, and EC algorithms are supported."
@@ -527,7 +533,7 @@ module Gem::Security
527
533
  raise Gem::Security::Exception,
528
534
  "incorrect signing key for re-signing " +
529
535
  "#{expired_certificate.subject}" unless
530
- expired_certificate.public_key.to_pem == get_public_key(private_key).to_pem
536
+ expired_certificate.check_private_key(private_key)
531
537
 
532
538
  unless expired_certificate.subject.to_s ==
533
539
  expired_certificate.issuer.to_s
@@ -995,7 +995,6 @@ class Gem::Specification < Gem::BasicSpecification
995
995
  def self.find_by_path(path)
996
996
  path = path.dup.freeze
997
997
  spec = @@spec_with_requirable_file[path] ||= (stubs.find do |s|
998
- next unless Gem::BundlerVersionFinder.compatible?(s)
999
998
  s.contains_requirable_file? path
1000
999
  end || NOT_FOUND)
1001
1000
  spec.to_spec
@@ -1008,7 +1007,6 @@ class Gem::Specification < Gem::BasicSpecification
1008
1007
  def self.find_inactive_by_path(path)
1009
1008
  stub = stubs.find do |s|
1010
1009
  next if s.activated?
1011
- next unless Gem::BundlerVersionFinder.compatible?(s)
1012
1010
  s.contains_requirable_file? path
1013
1011
  end
1014
1012
  stub && stub.to_spec
data/lib/rubygems.rb CHANGED
@@ -8,7 +8,7 @@
8
8
  require 'rbconfig'
9
9
 
10
10
  module Gem
11
- VERSION = "3.3.0".freeze
11
+ VERSION = "3.3.1".freeze
12
12
  end
13
13
 
14
14
  # Must be first since it unloads the prelude from 1.9.2
@@ -272,9 +272,6 @@ module Gem
272
272
 
273
273
  unless spec = specs.first
274
274
  msg = "can't find gem #{dep} with executable #{exec_name}"
275
- if dep.filters_bundler? && bundler_message = Gem::BundlerVersionFinder.missing_version_message
276
- msg = bundler_message
277
- end
278
275
  raise Gem::GemNotFoundException, msg
279
276
  end
280
277
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "rubygems-update"
5
- s.version = "3.3.0"
5
+ s.version = "3.3.1"
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
 
@@ -354,41 +354,6 @@ class TestGem < Gem::TestCase
354
354
  assert status.success?, output
355
355
  end
356
356
 
357
- def test_activate_bin_path_gives_proper_error_for_bundler
358
- bundler = util_spec 'bundler', '2' do |s|
359
- s.executables = ['bundle']
360
- end
361
-
362
- install_specs bundler
363
-
364
- File.open("Gemfile.lock", "w") do |f|
365
- f.write <<-L.gsub(/ {8}/, "")
366
- GEM
367
- remote: https://rubygems.org/
368
- specs:
369
-
370
- PLATFORMS
371
- ruby
372
-
373
- DEPENDENCIES
374
-
375
- BUNDLED WITH
376
- 9999
377
- L
378
- end
379
-
380
- File.open("Gemfile", "w") {|f| f.puts('source "https://rubygems.org"') }
381
-
382
- e = assert_raise Gem::GemNotFoundException do
383
- load Gem.activate_bin_path("bundler", "bundle", ">= 0.a")
384
- end
385
-
386
- assert_includes e.message, "Could not find 'bundler' (9999) required by your #{File.expand_path("Gemfile.lock")}."
387
- assert_includes e.message, "To update to the latest version installed on your system, run `bundle update --bundler`."
388
- assert_includes e.message, "To install the missing version, run `gem install bundler:9999`"
389
- refute_includes e.message, "can't find gem bundler (>= 0.a) with executable bundle"
390
- end
391
-
392
357
  def test_activate_bin_path_selects_exact_bundler_version_if_present
393
358
  bundler_latest = util_spec 'bundler', '2.0.1' do |s|
394
359
  s.executables = ['bundle']
@@ -48,30 +48,31 @@ class TestGemBundlerVersionFinder < Gem::TestCase
48
48
  end
49
49
 
50
50
  def test_bundler_version_with_lockfile
51
- bvf.stub(:lockfile_contents, [nil, ""]) do
51
+ bvf.stub(:lockfile_contents, "") do
52
52
  assert_nil bvf.bundler_version
53
53
  end
54
- bvf.stub(:lockfile_contents, [nil, "\n\nBUNDLED WITH\n 1.1.1.1\n"]) do
54
+ bvf.stub(:lockfile_contents, "\n\nBUNDLED WITH\n 1.1.1.1\n") do
55
55
  assert_equal v("1.1.1.1"), bvf.bundler_version
56
56
  end
57
- bvf.stub(:lockfile_contents, [nil, "\n\nBUNDLED WITH\n fjdkslfjdkslfjsldk\n"]) do
57
+ bvf.stub(:lockfile_contents, "\n\nBUNDLED WITH\n fjdkslfjdkslfjsldk\n") do
58
58
  assert_nil bvf.bundler_version
59
59
  end
60
60
  end
61
61
 
62
- def test_bundler_version_with_reason
63
- assert_nil bvf.bundler_version_with_reason
64
- bvf.stub(:lockfile_contents, [nil, "\n\nBUNDLED WITH\n 1.1.1.1\n"]) do
65
- assert_equal ["1.1.1.1", "your lockfile"], bvf.bundler_version_with_reason
62
+ def test_bundler_version
63
+ assert_nil bvf.bundler_version
64
+ bvf.stub(:lockfile_contents, "\n\nBUNDLED WITH\n 1.1.1.1\n") do
65
+ assert_equal "1.1.1.1", bvf.bundler_version.to_s
66
66
 
67
67
  $0 = "bundle"
68
68
  ARGV.replace %w[update --bundler]
69
- assert_nil bvf.bundler_version_with_reason
69
+ assert_nil bvf.bundler_version
70
+
70
71
  ARGV.replace %w[update --bundler=1.1.1.2]
71
- assert_equal ["1.1.1.2", "`bundle update --bundler`"], bvf.bundler_version_with_reason
72
+ assert_equal "1.1.1.2", bvf.bundler_version.to_s
72
73
 
73
74
  ENV["BUNDLER_VERSION"] = "1.1.1.3"
74
- assert_equal ["1.1.1.3", "`$BUNDLER_VERSION`"], bvf.bundler_version_with_reason
75
+ assert_equal "1.1.1.3", bvf.bundler_version.to_s
75
76
  end
76
77
  end
77
78
 
@@ -90,57 +91,35 @@ class TestGemBundlerVersionFinder < Gem::TestCase
90
91
  Dir.chdir(orig_dir)
91
92
  end
92
93
 
93
- assert_nil bvf.bundler_version_with_reason
94
- end
95
-
96
- def test_compatible
97
- assert bvf.compatible?(util_spec("foo"))
98
- assert bvf.compatible?(util_spec("bundler", 1.1))
99
-
100
- bvf.stub(:bundler_version, v("1.1.1.1")) do
101
- assert bvf.compatible?(util_spec("foo"))
102
- assert bvf.compatible?(util_spec("bundler", "1.1.1.1"))
103
- assert bvf.compatible?(util_spec("bundler", "1.1.1.a"))
104
- assert bvf.compatible?(util_spec("bundler", "1.999"))
105
- refute bvf.compatible?(util_spec("bundler", "2.999"))
106
- end
107
-
108
- bvf.stub(:bundler_version, v("2.1.1.1")) do
109
- assert bvf.compatible?(util_spec("foo"))
110
- assert bvf.compatible?(util_spec("bundler", "2.1.1.1"))
111
- assert bvf.compatible?(util_spec("bundler", "2.1.1.a"))
112
- assert bvf.compatible?(util_spec("bundler", "2.999"))
113
- refute bvf.compatible?(util_spec("bundler", "1.999"))
114
- refute bvf.compatible?(util_spec("bundler", "3.0.0"))
115
- end
94
+ assert_nil bvf.bundler_version
116
95
  end
117
96
 
118
- def test_filter
97
+ def test_prioritize
119
98
  versions = %w[1 1.0 1.0.1.1 2 2.a 2.0 2.1.1 3 3.a 3.0 3.1.1]
120
99
  specs = versions.map {|v| util_spec("bundler", v) }
121
100
 
122
- assert_equal %w[1 1.0 1.0.1.1 2 2.a 2.0 2.1.1 3 3.a 3.0 3.1.1], util_filter_specs(specs).map(&:version).map(&:to_s)
101
+ assert_equal %w[1 1.0 1.0.1.1 2 2.a 2.0 2.1.1 3 3.a 3.0 3.1.1], util_prioritize_specs(specs)
123
102
 
124
103
  bvf.stub(:bundler_version, v("2.1.1.1")) do
125
- assert_equal %w[2 2.a 2.0 2.1.1], util_filter_specs(specs).map(&:version).map(&:to_s)
104
+ assert_equal %w[1 1.0 1.0.1.1 2 2.a 2.0 2.1.1 3 3.a 3.0 3.1.1], util_prioritize_specs(specs)
126
105
  end
127
106
  bvf.stub(:bundler_version, v("1.1.1.1")) do
128
- assert_equal %w[1 1.0 1.0.1.1], util_filter_specs(specs).map(&:version).map(&:to_s)
107
+ assert_equal %w[1 1.0 1.0.1.1 2 2.a 2.0 2.1.1 3 3.a 3.0 3.1.1], util_prioritize_specs(specs)
129
108
  end
130
109
  bvf.stub(:bundler_version, v("1")) do
131
- assert_equal %w[1 1.0 1.0.1.1], util_filter_specs(specs).map(&:version).map(&:to_s)
110
+ assert_equal %w[1 1.0 1.0.1.1 2 2.a 2.0 2.1.1 3 3.a 3.0 3.1.1], util_prioritize_specs(specs)
132
111
  end
133
112
  bvf.stub(:bundler_version, v("2.a")) do
134
- assert_equal %w[2.a 2 2.0 2.1.1], util_filter_specs(specs).map(&:version).map(&:to_s)
113
+ assert_equal %w[2.a 1 1.0 1.0.1.1 2 2.0 2.1.1 3 3.a 3.0 3.1.1], util_prioritize_specs(specs)
135
114
  end
136
115
  bvf.stub(:bundler_version, v("3")) do
137
- assert_equal %w[3 3.a 3.0 3.1.1], util_filter_specs(specs).map(&:version).map(&:to_s)
116
+ assert_equal %w[3 1 1.0 1.0.1.1 2 2.a 2.0 2.1.1 3.a 3.0 3.1.1], util_prioritize_specs(specs)
138
117
  end
139
118
  end
140
119
 
141
- def util_filter_specs(specs)
120
+ def util_prioritize_specs(specs)
142
121
  specs = specs.dup
143
- bvf.filter!(specs)
144
- specs
122
+ bvf.prioritize!(specs)
123
+ specs.map(&:version).map(&:to_s)
145
124
  end
146
125
  end
@@ -358,16 +358,12 @@ class TestGemDependency < Gem::TestCase
358
358
 
359
359
  assert_equal [b, b_1], dep.to_specs
360
360
 
361
- Gem::BundlerVersionFinder.stub(:bundler_version_with_reason, ["3.5", "reason"]) do
362
- e = assert_raise Gem::MissingSpecVersionError do
363
- dep.to_specs
364
- end
365
-
366
- assert_match "Could not find 'bundler' (3.5) required by reason.\nTo update to the latest version installed on your system, run `bundle update --bundler`.\nTo install the missing version, run `gem install bundler:3.5`\n", e.message
361
+ Gem::BundlerVersionFinder.stub(:bundler_version, Gem::Version.new("1")) do
362
+ assert_equal [b_1, b], dep.to_specs
367
363
  end
368
364
 
369
- Gem::BundlerVersionFinder.stub(:bundler_version_with_reason, ["2.0.0.pre.1", "reason"]) do
370
- assert_equal [b], dep.to_specs
365
+ Gem::BundlerVersionFinder.stub(:bundler_version, Gem::Version.new("2.0.0.pre.1")) do
366
+ assert_equal [b, b_1], dep.to_specs
371
367
  end
372
368
  end
373
369
 
@@ -117,20 +117,8 @@ class TestKernel < Gem::TestCase
117
117
  assert $:.any? {|p| %r{bundler-1/lib} =~ p }
118
118
  end
119
119
 
120
- def test_gem_bundler_missing_bundler_version
121
- Gem::BundlerVersionFinder.stub(:bundler_version_with_reason, ["55", "reason"]) do
122
- quick_gem 'bundler', '1'
123
- quick_gem 'bundler', '2.a'
124
-
125
- e = assert_raise Gem::MissingSpecVersionError do
126
- gem('bundler')
127
- end
128
- assert_match "Could not find 'bundler' (55) required by reason.", e.message
129
- end
130
- end
131
-
132
120
  def test_gem_bundler_inferred_bundler_version
133
- Gem::BundlerVersionFinder.stub(:bundler_version_with_reason, ["1", "reason"]) do
121
+ Gem::BundlerVersionFinder.stub(:bundler_version, Gem::Version.new("1")) do
134
122
  quick_gem 'bundler', '1'
135
123
  quick_gem 'bundler', '2.a'
136
124
 
@@ -596,31 +596,6 @@ class TestGemRequire < Gem::TestCase
596
596
  assert_empty unresolved_names
597
597
  end
598
598
 
599
- def test_require_bundler_missing_bundler_version
600
- Gem::BundlerVersionFinder.stub(:bundler_version_with_reason, ["55", "reason"]) do
601
- b1 = util_spec('bundler', '1.999999999', nil, "lib/bundler/setup.rb")
602
- b2a = util_spec('bundler', '2.a', nil, "lib/bundler/setup.rb")
603
- install_specs b1, b2a
604
-
605
- e = assert_raise Gem::MissingSpecVersionError do
606
- gem('bundler')
607
- end
608
- assert_match "Could not find 'bundler' (55) required by reason.", e.message
609
- end
610
- end
611
-
612
- def test_require_bundler_with_bundler_version
613
- Gem::BundlerVersionFinder.stub(:bundler_version_with_reason, ["1", "reason"]) do
614
- b1 = util_spec('bundler', '1.999999999', nil, "lib/bundler/setup.rb")
615
- b2 = util_spec('bundler', '2', nil, "lib/bundler/setup.rb")
616
- install_specs b1, b2
617
-
618
- $:.clear
619
- assert_require 'bundler/setup'
620
- assert_equal %w[bundler-1.999999999], loaded_spec_names
621
- end
622
- end
623
-
624
599
  # uplevel is 2.5+ only
625
600
  if RUBY_VERSION >= "2.5"
626
601
  ["", "Kernel."].each do |prefix|
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.3.0
4
+ version: 3.3.1
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-12-21 00:00:00.000000000 Z
19
+ date: 2021-12-22 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
@@ -803,7 +803,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
803
803
  - !ruby/object:Gem::Version
804
804
  version: '0'
805
805
  requirements: []
806
- rubygems_version: 3.3.0
806
+ rubygems_version: 3.3.1
807
807
  signing_key:
808
808
  specification_version: 4
809
809
  summary: RubyGems is a package management framework for Ruby.