rubygems-update 3.2.1 → 3.2.2

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: 4528e626d1fed9c0dcbc5c43bd3145e3fe11ad95331342b6d73d48e7d1173e42
4
- data.tar.gz: bfb5d478718b397bb6b355571bc3349db1c8e2cded98ea5889f70a3a0fe3ca32
3
+ metadata.gz: 89d8b149374def285695109ddc454c37bce9e4237c234c5effd43d9cf4ccc26a
4
+ data.tar.gz: d47581abe6eeacc1037e20a882df82001f5742fb33418d38829c788bb341f073
5
5
  SHA512:
6
- metadata.gz: 5692fa6e596bcd8a9d702451d5c2f7f52b336e4c367ba9cc050f1f56feab4c7d2d5e705e286cc70eeec2b042292e06878083000d3852df18e966305c543ceb6f
7
- data.tar.gz: 4493b5d9b76a7867c7dc81f8bde7d7078bc836d1bded817424024d341ff491b38cb8a46ada2047b6c1788a78e18313b66fb8a070e059275ed46dd3d7cda5c8b6
6
+ metadata.gz: 34fe6a294d1aaed49dc46a1a3aecdc211a2fb308a88ab352cbc732a0b9dc8ffdedc0e87302efc29275972051f77a275b8caf3c436538dcbb43e569b75ce1e429
7
+ data.tar.gz: 10af836317bb8539971af80345a129963d56149affab1a89498abde570c31802a374246c0cee85bf3bdfd6c37d6dcfd1db33677b4db9c5514d6cd5102741be89
@@ -1,3 +1,15 @@
1
+ === 3.2.2 / 2020-12-17
2
+
3
+ Bug fixes:
4
+
5
+ * Fix issue where CLI commands making more than one request to
6
+ rubygems.org needing an OTP code would crash or ask for the code twice.
7
+ Pull request #4162 by sonalkr132
8
+ * Fix building rake extensions that require openssl. Pull request #4165 by
9
+ deivid-rodriguez
10
+ * Fix `gem update --system` displaying too many changelog entries. Pull
11
+ request #4145 by deivid-rodriguez
12
+
1
13
  === 3.2.1 / 2020-12-14
2
14
 
3
15
  Enhancements:
@@ -12,7 +24,7 @@ Bug fixes:
12
24
  * Fix Resolver::APISet to always include prereleases when necessary. Pull
13
25
  request #4113 by deivid-rodriguez
14
26
 
15
- === 3.2.0 / 2020-12-7
27
+ === 3.2.0 / 2020-12-07
16
28
 
17
29
  Enhancements:
18
30
 
@@ -68,7 +80,7 @@ Performance:
68
80
  * Don't change ruby process CWD when building extensions. Pull request
69
81
  #3498 by deivid-rodriguez
70
82
 
71
- === 3.2.0.rc.2 / 2020-10-8
83
+ === 3.2.0.rc.2 / 2020-10-08
72
84
 
73
85
  Enhancements:
74
86
 
@@ -682,3 +682,4 @@ test/rubygems/test_remote_fetch_error.rb
682
682
  test/rubygems/test_require.rb
683
683
  test/rubygems/wrong_key_cert.pem
684
684
  test/rubygems/wrong_key_cert_32.pem
685
+ test/test_changelog_generator.rb
@@ -1,3 +1,10 @@
1
+ # 2.2.2 (December 17, 2020)
2
+
3
+ ## Bug fixes:
4
+
5
+ - Fix resolver crash when a candidate has 0 matching platforms [#4163](https://github.com/rubygems/rubygems/pull/4163)
6
+ - Restore change to copy global with/without config locally upon `bundle install` [#4154](https://github.com/rubygems/rubygems/pull/4154)
7
+
1
8
  # 2.2.1 (December 14, 2020)
2
9
 
3
10
  ## Bug fixes:
@@ -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-14".freeze
8
- @git_commit_sha = "b98d6b2035".freeze
7
+ @built_at = "2020-12-17".freeze
8
+ @git_commit_sha = "d85cd5b7c3".freeze
9
9
  @release = true
10
10
  # end ivars
11
11
 
@@ -152,18 +152,27 @@ module Bundler
152
152
 
153
153
  check_for_group_conflicts_in_cli_options
154
154
 
155
+ Bundler.settings.set_command_option :with, nil if options[:with] == []
156
+ Bundler.settings.set_command_option :without, nil if options[:without] == []
157
+
155
158
  with = options.fetch(:with, [])
156
159
  with |= Bundler.settings[:with].map(&:to_s)
157
160
  with -= options[:without] if options[:without]
158
- with = nil if options[:with] == []
159
161
 
160
162
  without = options.fetch(:without, [])
161
163
  without |= Bundler.settings[:without].map(&:to_s)
162
164
  without -= options[:with] if options[:with]
163
- without = nil if options[:without] == []
164
165
 
165
- Bundler.settings.set_command_option :without, without
166
- Bundler.settings.set_command_option :with, with
166
+ options[:with] = with
167
+ options[:without] = without
168
+
169
+ unless Bundler.settings[:without] == options[:without] && Bundler.settings[:with] == options[:with]
170
+ # need to nil them out first to get around validation for backwards compatibility
171
+ Bundler.settings.set_command_option :without, nil
172
+ Bundler.settings.set_command_option :with, nil
173
+ Bundler.settings.set_command_option :without, options[:without] - options[:with]
174
+ Bundler.settings.set_command_option :with, options[:with]
175
+ end
167
176
  end
168
177
 
169
178
  def normalize_settings
@@ -190,7 +199,7 @@ module Bundler
190
199
 
191
200
  Bundler.settings.set_command_option_if_given :clean, options["clean"]
192
201
 
193
- normalize_groups if options[:without] || options[:with]
202
+ normalize_groups
194
203
 
195
204
  options[:force] = options[:redownload]
196
205
  end
@@ -155,6 +155,8 @@ module Bundler
155
155
  search.each do |sg|
156
156
  next unless sg.for?(platform)
157
157
  sg_all_platforms = sg.copy_for(self.class.sort_platforms(@platforms).reverse)
158
+ next unless sg_all_platforms
159
+
158
160
  selected_sgs << sg_all_platforms
159
161
 
160
162
  next if sg_all_platforms.activated_platforms == [Gem::Platform::RUBY]
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: false
2
2
 
3
3
  module Bundler
4
- VERSION = "2.2.1".freeze
4
+ VERSION = "2.2.2".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.1".freeze
11
+ VERSION = "3.2.2".freeze
12
12
  end
13
13
 
14
14
  # Must be first since it unloads the prelude from 1.9.2
@@ -105,7 +105,6 @@ permission to.
105
105
  rubygems_api_request method, "api/v1/gems/#{name}/owners", scope: get_owner_scope(method: method) do |request|
106
106
  request.set_form_data 'email' => owner
107
107
  request.add_field "Authorization", api_key
108
- request.add_field "OTP", options[:otp] if options[:otp]
109
108
  end
110
109
  end
111
110
 
@@ -91,7 +91,6 @@ The push command will use ~/.gem/credentials to authenticate to a server, but yo
91
91
  request.add_field "Content-Length", request.body.size
92
92
  request.add_field "Content-Type", "application/octet-stream"
93
93
  request.add_field "Authorization", api_key
94
- request.add_field "OTP", options[:otp] if options[:otp]
95
94
  end
96
95
  end
97
96
 
@@ -74,7 +74,6 @@ data you will need to change them immediately and yank your gem.
74
74
  name = get_one_gem_name
75
75
  response = rubygems_api_request(method, api, host, scope: get_yank_scope) do |request|
76
76
  request.add_field("Authorization", api_key)
77
- request.add_field("OTP", options[:otp]) if options[:otp]
78
77
 
79
78
  data = {
80
79
  'gem_name' => name,
@@ -19,7 +19,7 @@ class Gem::Ext::RakeBuilder < Gem::Ext::Builder
19
19
  rake = rake.shellsplit
20
20
  else
21
21
  begin
22
- rake = [Gem.ruby, "-I#{File.expand_path("..", __dir__)}", "-rrubygems", Gem.bin_path('rake', 'rake')]
22
+ rake = [Gem.ruby, "-I#{File.expand_path("../..", __dir__)}", "-rrubygems", Gem.bin_path('rake', 'rake')]
23
23
  rescue Gem::Exception
24
24
  rake = [Gem.default_exec_format % 'rake']
25
25
  end
@@ -94,20 +94,16 @@ module Gem::GemcutterUtilities
94
94
  end
95
95
 
96
96
  uri = URI.parse "#{self.host}/#{path}"
97
-
98
- request_method = Net::HTTP.const_get method.to_s.capitalize
99
- response = Gem::RemoteFetcher.fetcher.request(uri, request_method, &block)
97
+ response = request_with_otp(method, uri, &block)
100
98
 
101
99
  if mfa_unauthorized?(response)
102
- response = Gem::RemoteFetcher.fetcher.request(uri, request_method) do |req|
103
- req.add_field "OTP", get_otp
104
- block.call(req)
105
- end
100
+ ask_otp
101
+ response = request_with_otp(method, uri, &block)
106
102
  end
107
103
 
108
104
  if api_key_forbidden?(response)
109
105
  update_scope(scope)
110
- Gem::RemoteFetcher.fetcher.request(uri, request_method, &block)
106
+ request_with_otp(method, uri, &block)
111
107
  else
112
108
  response
113
109
  end
@@ -117,11 +113,6 @@ module Gem::GemcutterUtilities
117
113
  response.kind_of?(Net::HTTPUnauthorized) && response.body.start_with?('You have enabled multifactor authentication')
118
114
  end
119
115
 
120
- def get_otp
121
- say 'You have enabled multi-factor authentication. Please enter OTP code.'
122
- ask 'Code: '
123
- end
124
-
125
116
  def update_scope(scope)
126
117
  sign_in_host = self.host
127
118
  pretty_host = pretty_host(sign_in_host)
@@ -135,7 +126,7 @@ module Gem::GemcutterUtilities
135
126
  response = rubygems_api_request(:put, "api/v1/api_key",
136
127
  sign_in_host, scope: scope) do |request|
137
128
  request.basic_auth email, password
138
- request.add_field "OTP", options[:otp] if options[:otp]
129
+ request["OTP"] = options[:otp] if options[:otp]
139
130
  request.body = URI.encode_www_form({:api_key => api_key }.merge(update_scope_params))
140
131
  end
141
132
 
@@ -168,7 +159,7 @@ module Gem::GemcutterUtilities
168
159
  response = rubygems_api_request(:post, "api/v1/api_key",
169
160
  sign_in_host, scope: scope) do |request|
170
161
  request.basic_auth email, password
171
- request.add_field "OTP", options[:otp] if options[:otp]
162
+ request["OTP"] = options[:otp] if options[:otp]
172
163
  request.body = URI.encode_www_form({ name: key_name }.merge(scope_params))
173
164
  end
174
165
 
@@ -229,6 +220,20 @@ module Gem::GemcutterUtilities
229
220
 
230
221
  private
231
222
 
223
+ def request_with_otp(method, uri, &block)
224
+ request_method = Net::HTTP.const_get method.to_s.capitalize
225
+
226
+ Gem::RemoteFetcher.fetcher.request(uri, request_method) do |req|
227
+ req["OTP"] = options[:otp] if options[:otp]
228
+ block.call(req)
229
+ end
230
+ end
231
+
232
+ def ask_otp
233
+ say 'You have enabled multi-factor authentication. Please enter OTP code.'
234
+ options[:otp] = ask 'Code: '
235
+ end
236
+
232
237
  def pretty_host(host)
233
238
  if Gem::DEFAULT_HOST == host
234
239
  'RubyGems.org'
@@ -38,7 +38,7 @@ class Gem::FakeFetcher
38
38
  @paths = []
39
39
  end
40
40
 
41
- def find_data(path, nargs = 3)
41
+ def find_data(path)
42
42
  return Gem.read_binary path.path if URI === path and 'file' == path.scheme
43
43
 
44
44
  if URI === path and "URI::#{path.scheme.upcase}" != path.class.name
@@ -54,10 +54,11 @@ class Gem::FakeFetcher
54
54
  raise Gem::RemoteFetcher::FetchError.new("no data for #{path}", path)
55
55
  end
56
56
 
57
- data = @data[path]
58
-
59
- data.flatten! and return data.shift(nargs) if data.respond_to?(:flatten!)
60
- data
57
+ if @data[path].kind_of?(Array) && @data[path].first.kind_of?(Array)
58
+ @data[path].shift
59
+ else
60
+ @data[path]
61
+ end
61
62
  end
62
63
 
63
64
  def fetch_path(path, mtime = nil, head = false)
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "rubygems-update"
5
- s.version = "3.2.1"
5
+ s.version = "3.2.2"
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
 
@@ -404,11 +404,13 @@ class TestGemCommandsPushCommand < Gem::TestCase
404
404
  assert_equal '111111', @fetcher.last_request['OTP']
405
405
  end
406
406
 
407
- def test_sending_gem_unathorized_api_key
407
+ def test_sending_gem_unathorized_api_key_with_mfa_enabled
408
+ response_mfa_enabled = "You have enabled multifactor authentication but your request doesn't have the correct OTP code. Please check it and retry."
408
409
  response_forbidden = "The API key doesn't have access"
409
410
  response_success = 'Successfully registered gem: freewill (1.0.0)'
410
411
 
411
412
  @fetcher.data["#{@host}/api/v1/gems"] = [
413
+ [response_mfa_enabled, 401, 'Unauthorized'],
412
414
  [response_forbidden, 403, 'Forbidden'],
413
415
  [response_success, 200, "OK"],
414
416
  ]
@@ -417,17 +419,54 @@ class TestGemCommandsPushCommand < Gem::TestCase
417
419
  @cmd.instance_variable_set :@host, @host
418
420
  @cmd.instance_variable_set :@scope, :push_rubygem
419
421
 
420
- @ui = Gem::MockGemUi.new "some@mail.com\npass\n"
422
+ @ui = Gem::MockGemUi.new "11111\nsome@mail.com\npass\n"
421
423
  use_ui @ui do
422
424
  @cmd.send_gem(@path)
423
425
  end
424
426
 
427
+ mfa_notice = "You have enabled multi-factor authentication. Please enter OTP code."
425
428
  access_notice = "The existing key doesn't have access of push_rubygem on https://rubygems.example. Please sign in to update access."
429
+ assert_match mfa_notice, @ui.output
426
430
  assert_match access_notice, @ui.output
427
431
  assert_match "Email:", @ui.output
428
432
  assert_match "Password:", @ui.output
429
433
  assert_match "Added push_rubygem scope to the existing API key", @ui.output
430
434
  assert_match response_success, @ui.output
435
+ assert_equal '11111', @fetcher.last_request['OTP']
436
+ end
437
+
438
+ def test_sending_gem_with_no_local_creds
439
+ Gem.configuration.rubygems_api_key = nil
440
+
441
+ response_mfa_enabled = "You have enabled multifactor authentication but your request doesn't have the correct OTP code. Please check it and retry."
442
+ response_success = 'Successfully registered gem: freewill (1.0.0)'
443
+
444
+ @fetcher.data["#{@host}/api/v1/gems"] = [
445
+ [response_success, 200, "OK"],
446
+ ]
447
+
448
+ @fetcher.data["#{@host}/api/v1/api_key"] = [
449
+ [response_mfa_enabled, 401, 'Unauthorized'],
450
+ ["", 200, "OK"],
451
+ ]
452
+
453
+ @cmd.instance_variable_set :@scope, :push_rubygem
454
+ @cmd.options[:args] = [@path]
455
+ @cmd.options[:host] = @host
456
+
457
+ @ui = Gem::MockGemUi.new "some@mail.com\npass\n11111\n"
458
+ use_ui @ui do
459
+ @cmd.execute
460
+ end
461
+
462
+ mfa_notice = "You have enabled multi-factor authentication. Please enter OTP code."
463
+ assert_match mfa_notice, @ui.output
464
+ assert_match "Enter your https://rubygems.example credentials.", @ui.output
465
+ assert_match "Email:", @ui.output
466
+ assert_match "Password:", @ui.output
467
+ assert_match "Signed in with API key:", @ui.output
468
+ assert_match response_success, @ui.output
469
+ assert_equal '11111', @fetcher.last_request['OTP']
431
470
  end
432
471
 
433
472
  private
@@ -47,6 +47,31 @@ class TestGemExtRakeBuilder < Gem::TestCase
47
47
  end
48
48
  end
49
49
 
50
+ def test_class_no_openssl_override
51
+ create_temp_mkrf_file('task :default')
52
+
53
+ rake = util_spec 'rake' do |s|
54
+ s.executables = %w[rake]
55
+ s.files = %w[bin/rake]
56
+ end
57
+
58
+ output = []
59
+
60
+ write_file File.join(@tempdir, 'bin', 'rake') do |fp|
61
+ fp.puts "#!/usr/bin/ruby"
62
+ fp.puts "require 'openssl'; puts OpenSSL"
63
+ end
64
+
65
+ install_gem rake
66
+
67
+ Gem::Ext::RakeBuilder.build 'mkrf_conf.rb', @dest_path, output, [''], nil, @ext
68
+
69
+ output = output.join "\n"
70
+
71
+ assert_match "OpenSSL", output
72
+ assert_match %r{^#{Regexp.escape Gem.ruby} mkrf_conf\.rb}, output
73
+ end
74
+
50
75
  def test_class_build_no_mkrf_passes_args
51
76
  output = []
52
77
 
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "minitest/autorun"
4
+ require_relative "../util/changelog"
5
+ require "rubygems/commands/setup_command"
6
+
7
+ class ChangelogTest < Minitest::Test
8
+ def setup
9
+ @changelog = Changelog.for_rubygems(Gem::VERSION)
10
+ end
11
+
12
+ def test_format_header
13
+ Time.stub :now, Time.new(2020, 1, 1) do
14
+ assert_match Gem::Commands::SetupCommand::HISTORY_HEADER, @changelog.send(:format_header)
15
+ end
16
+ end
17
+ end
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.1
4
+ version: 3.2.2
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-14 00:00:00.000000000 Z
19
+ date: 2020-12-17 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
@@ -762,6 +762,7 @@ files:
762
762
  - test/rubygems/test_require.rb
763
763
  - test/rubygems/wrong_key_cert.pem
764
764
  - test/rubygems/wrong_key_cert_32.pem
765
+ - test/test_changelog_generator.rb
765
766
  homepage: https://rubygems.org
766
767
  licenses:
767
768
  - Ruby
@@ -785,7 +786,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
785
786
  - !ruby/object:Gem::Version
786
787
  version: '0'
787
788
  requirements: []
788
- rubygems_version: 3.2.0
789
+ rubygems_version: 3.2.1
789
790
  signing_key:
790
791
  specification_version: 4
791
792
  summary: RubyGems is a package management framework for Ruby.