rubygems-update 3.2.33 → 3.2.34

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: c0ad3f54099eb51ea11d57eb8da10dd84729d075b26073b687ed49f7e7f8b018
4
- data.tar.gz: fa02cdd3863c8ead6ebc2594f6e7c4b0065a8dff28eb9412cf16c18e5e38e05e
3
+ metadata.gz: a8c702a4165527b22d31e1cb41e0e5bc94e75428b2a69a48f5e4565df627e885
4
+ data.tar.gz: 2dd36e7a22f82691fe39d1384d37270843bf6705b929e92e8d6d501af21db430
5
5
  SHA512:
6
- metadata.gz: 5416de9788161fd52b5619e8579134cc6abf4431819d23e56f06ae1b0fd5e511db5fb042b67824dc7a257403ab982528f52e39895f9f56d69472f86827d1a756
7
- data.tar.gz: 61d7407de87425e910d2dd2282dfb1de6b6ed472aac1cb5059387c946bdd3564c4bc65d3d6d8d07587010185bbd06679cb1d77e718672ee0de3be6a813f00b7b
6
+ metadata.gz: f77785a6aac66c4e68e2f73b794c0d642cf8a962192ece73fd6e208c79ec1c29a6e824cb065c40f25b97c06aa5feb827efe8ce4419d2d103843758ae7514b378
7
+ data.tar.gz: b90468d920c7f6ea3217858d74ebfa2fe7e162f7408cb61987284e381f4d91d6e258d574c7f8cbc70a429b872521c50f26a92db48a3dee5394a70534acddb848
@@ -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-07".freeze
8
- @git_commit_sha = "9b5e2a350b".freeze
7
+ @built_at = "2023-02-06".freeze
8
+ @git_commit_sha = "c07c26df9e".freeze
9
9
  @release = true
10
10
  # end ivars
11
11
 
@@ -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,11 @@ 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
110
  if force || !content.include?(replacement)
112
111
  success = content.gsub!(regexp, string)
113
112
 
114
- File.open(destination, "wb") { |file| file.write(content) }
113
+ File.open(destination, "wb") { |file| file.write(content) } unless pretend?
115
114
  success
116
115
  end
117
116
  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,3 +1,3 @@
1
1
  class Bundler::Thor
2
- VERSION = "1.1.0"
2
+ VERSION = "1.2.1"
3
3
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: false
2
2
 
3
3
  module Bundler
4
- VERSION = "2.2.33".freeze
4
+ VERSION = "2.2.34".freeze
5
5
 
6
6
  def self.bundler_major_version
7
7
  @bundler_major_version ||= VERSION.split(".").first.to_i
@@ -5,7 +5,7 @@ require_relative '../deprecate'
5
5
 
6
6
  class Gem::Commands::ServerCommand < Gem::Command
7
7
  extend Gem::Deprecate
8
- rubygems_deprecate_command
8
+ rubygems_deprecate_command("3.3.0")
9
9
 
10
10
  def initialize
11
11
  super 'server', 'Documentation and gem repository HTTP server',
@@ -96,7 +96,7 @@ module Gem::Deprecate
96
96
  end
97
97
 
98
98
  # Deprecation method to deprecate Rubygems commands
99
- def rubygems_deprecate_command
99
+ def rubygems_deprecate_command(version = Gem::Deprecate.next_rubygems_major_version)
100
100
  class_eval do
101
101
  define_method "deprecated?" do
102
102
  true
@@ -104,7 +104,7 @@ module Gem::Deprecate
104
104
 
105
105
  define_method "deprecation_warning" do
106
106
  msg = [ "#{self.command} command is deprecated",
107
- ". It will be removed in Rubygems #{Gem::Deprecate.next_rubygems_major_version}.\n",
107
+ ". It will be removed in Rubygems #{version}.\n",
108
108
  ]
109
109
 
110
110
  alert_warning "#{msg.join}" unless Gem::Deprecate.skip
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
- require_relative "deprecate"
2
+ require_relative "version"
3
3
 
4
4
  ##
5
5
  # A Requirement is a set of one or more version restrictions. It supports a
@@ -9,6 +9,8 @@
9
9
  require_relative 'deprecate'
10
10
  require_relative 'basic_specification'
11
11
  require_relative 'stub_specification'
12
+ require_relative 'platform'
13
+ require_relative 'requirement'
12
14
  require_relative 'specification_policy'
13
15
  require_relative 'util/list'
14
16
 
data/lib/rubygems.rb CHANGED
@@ -8,7 +8,7 @@
8
8
  require 'rbconfig'
9
9
 
10
10
  module Gem
11
- VERSION = "3.2.33".freeze
11
+ VERSION = "3.2.34".freeze
12
12
  end
13
13
 
14
14
  # Must be first since it unloads the prelude from 1.9.2
@@ -1293,7 +1293,12 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
1293
1293
  end
1294
1294
 
1295
1295
  def default_gem_load_paths
1296
- @default_gem_load_paths ||= $LOAD_PATH[load_path_insert_index..-1]
1296
+ @default_gem_load_paths ||= $LOAD_PATH[load_path_insert_index..-1].map do |lp|
1297
+ expanded = File.expand_path(lp)
1298
+ next expanded unless File.exist?(expanded)
1299
+
1300
+ File.realpath(expanded)
1301
+ end
1297
1302
  end
1298
1303
  end
1299
1304
 
@@ -1310,37 +1315,19 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
1310
1315
  autoload :Licenses, File.expand_path('rubygems/util/licenses', __dir__)
1311
1316
  autoload :NameTuple, File.expand_path('rubygems/name_tuple', __dir__)
1312
1317
  autoload :PathSupport, File.expand_path('rubygems/path_support', __dir__)
1313
- autoload :Platform, File.expand_path('rubygems/platform', __dir__)
1314
1318
  autoload :RequestSet, File.expand_path('rubygems/request_set', __dir__)
1315
- autoload :Requirement, File.expand_path('rubygems/requirement', __dir__)
1316
1319
  autoload :Resolver, File.expand_path('rubygems/resolver', __dir__)
1317
1320
  autoload :Source, File.expand_path('rubygems/source', __dir__)
1318
1321
  autoload :SourceList, File.expand_path('rubygems/source_list', __dir__)
1319
1322
  autoload :SpecFetcher, File.expand_path('rubygems/spec_fetcher', __dir__)
1320
- autoload :Specification, File.expand_path('rubygems/specification', __dir__)
1321
1323
  autoload :Util, File.expand_path('rubygems/util', __dir__)
1322
1324
  autoload :Version, File.expand_path('rubygems/version', __dir__)
1323
1325
  end
1324
1326
 
1325
1327
  require_relative 'rubygems/exceptions'
1328
+ require_relative 'rubygems/specification'
1326
1329
 
1327
1330
  # REFACTOR: This should be pulled out into some kind of hacks file.
1328
- begin
1329
- ##
1330
- # Defaults the Ruby implementation wants to provide for RubyGems
1331
-
1332
- require "rubygems/defaults/#{RUBY_ENGINE}"
1333
- rescue LoadError
1334
- end
1335
-
1336
- ##
1337
- # Loads the default specs.
1338
- Gem::Specification.load_defaults
1339
-
1340
- require_relative 'rubygems/core_ext/kernel_gem'
1341
- require_relative 'rubygems/core_ext/kernel_require'
1342
- require_relative 'rubygems/core_ext/kernel_warn'
1343
-
1344
1331
  begin
1345
1332
  ##
1346
1333
  # Defaults the operating system (or packager) wants to provide for RubyGems.
@@ -1356,3 +1343,19 @@ rescue StandardError => e
1356
1343
  "the problem and ask for help."
1357
1344
  raise e.class, msg
1358
1345
  end
1346
+
1347
+ begin
1348
+ ##
1349
+ # Defaults the Ruby implementation wants to provide for RubyGems
1350
+
1351
+ require "rubygems/defaults/#{RUBY_ENGINE}"
1352
+ rescue LoadError
1353
+ end
1354
+
1355
+ ##
1356
+ # Loads the default specs.
1357
+ Gem::Specification.load_defaults
1358
+
1359
+ require_relative 'rubygems/core_ext/kernel_gem'
1360
+ require_relative 'rubygems/core_ext/kernel_require'
1361
+ require_relative 'rubygems/core_ext/kernel_warn'
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "rubygems-update"
5
- s.version = "3.2.33"
5
+ s.version = "3.2.34"
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
 
@@ -311,4 +311,29 @@ class TestGemCommandManager < Gem::TestCase
311
311
  ensure
312
312
  Gem::Commands.send(:remove_const, :FooCommand)
313
313
  end
314
+
315
+ def test_deprecated_command_with_version
316
+ require "rubygems/command"
317
+ foo_command = Class.new(Gem::Command) do
318
+ extend Gem::Deprecate
319
+
320
+ rubygems_deprecate_command("9.9.9")
321
+
322
+ def execute
323
+ say "pew pew!"
324
+ end
325
+ end
326
+
327
+ Gem::Commands.send(:const_set, :FooCommand, foo_command)
328
+ @command_manager.register_command(:foo, foo_command.new("foo"))
329
+
330
+ use_ui @ui do
331
+ @command_manager.process_args(%w[foo])
332
+ end
333
+
334
+ assert_equal "pew pew!\n", @ui.output
335
+ assert_match(/WARNING: foo command is deprecated. It will be removed in Rubygems 9.9.9/, @ui.error)
336
+ ensure
337
+ Gem::Commands.send(:remove_const, :FooCommand)
338
+ end
314
339
  end
@@ -63,6 +63,11 @@ class TestGemSourceGit < Gem::TestCase
63
63
  end
64
64
 
65
65
  def test_checkout_submodules
66
+ # We need to allow to checkout submodules with file:// protocol
67
+ # CVE-2022-39253
68
+ # https://lore.kernel.org/lkml/xmqq4jw1uku5.fsf@gitster.g/
69
+ system(@git, *%W[config --global protocol.file.allow always])
70
+
66
71
  source = Gem::Source::Git.new @name, @repository, 'master', true
67
72
 
68
73
  git_gem 'b'
@@ -22,6 +22,29 @@ class GemTest < Gem::TestCase
22
22
  "the problem and ask for help."
23
23
  end
24
24
 
25
+ def test_operating_system_customizing_default_dir
26
+ pend "does not apply to truffleruby" if RUBY_ENGINE == 'truffleruby'
27
+ pend "loads a custom defaults/jruby file that gets in the middle" if RUBY_ENGINE == 'jruby'
28
+
29
+ # On a non existing default dir, there should be no gems
30
+
31
+ path = util_install_operating_system_rb <<-RUBY
32
+ module Gem
33
+ def self.default_dir
34
+ File.expand_path("foo")
35
+ end
36
+ end
37
+ RUBY
38
+
39
+ output = Gem::Util.popen(
40
+ *ruby_with_rubygems_and_fake_operating_system_in_load_path(path),
41
+ '-e',
42
+ "require \"rubygems\"; puts Gem::Specification.stubs.map(&:full_name)",
43
+ {:err => [:child, :out]}
44
+ ).strip
45
+ assert_empty output
46
+ end
47
+
25
48
  private
26
49
 
27
50
  def util_install_operating_system_rb(content)
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.33
4
+ version: 3.2.34
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-07 00:00:00.000000000 Z
19
+ date: 2023-02-06 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