rubygems-update 3.3.22 → 3.3.23

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +19 -0
  3. data/Manifest.txt +1 -0
  4. data/POLICIES.md +38 -5
  5. data/bundler/CHANGELOG.md +18 -0
  6. data/bundler/lib/bundler/build_metadata.rb +2 -2
  7. data/bundler/lib/bundler/cli/init.rb +5 -1
  8. data/bundler/lib/bundler/definition.rb +2 -12
  9. data/bundler/lib/bundler/dsl.rb +0 -1
  10. data/bundler/lib/bundler/gem_version_promoter.rb +6 -7
  11. data/bundler/lib/bundler/index.rb +3 -26
  12. data/bundler/lib/bundler/resolver.rb +7 -11
  13. data/bundler/lib/bundler/rubygems_ext.rb +12 -1
  14. data/bundler/lib/bundler/spec_set.rb +1 -1
  15. data/bundler/lib/bundler/templates/newgem/gitlab-ci.yml.tt +5 -4
  16. data/bundler/lib/bundler/version.rb +1 -1
  17. data/lib/rubygems/gemcutter_utilities.rb +8 -1
  18. data/lib/rubygems/package.rb +9 -4
  19. data/lib/rubygems/platform.rb +17 -1
  20. data/lib/rubygems/resolver.rb +1 -1
  21. data/lib/rubygems.rb +1 -1
  22. data/rubygems-update.gemspec +1 -1
  23. data/test/rubygems/helper.rb +23 -17
  24. data/test/rubygems/packages/Bluebie-legs-0.6.2.gem +0 -0
  25. data/test/rubygems/test_gem.rb +254 -212
  26. data/test/rubygems/test_gem_commands_owner_command.rb +105 -24
  27. data/test/rubygems/test_gem_commands_push_command.rb +44 -23
  28. data/test/rubygems/test_gem_commands_signin_command.rb +28 -3
  29. data/test/rubygems/test_gem_commands_yank_command.rb +9 -9
  30. data/test/rubygems/test_gem_gemcutter_utilities.rb +16 -12
  31. data/test/rubygems/test_gem_package.rb +15 -0
  32. data/test/rubygems/test_gem_platform.rb +35 -0
  33. data/test/rubygems/test_gem_resolver.rb +33 -0
  34. data/test/rubygems/test_require.rb +5 -5
  35. data/test/rubygems/utilities.rb +36 -14
  36. metadata +4 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7155d16d3c9857d2ae7b4dd04e939a77f72fa12f939413f328d77c73b152cc37
4
- data.tar.gz: 5f696b3a1885a97d4f0a518761e8a452a256fe360d428cff409ada562b64fa36
3
+ metadata.gz: f93f67c33abbbb5ea165e7d2682601f04071a38b9b513388d9a5e428dd683297
4
+ data.tar.gz: 15847dcefd91515ea3057a9d1b3ff6da9ae367ee714cbdb43c5537d6fa5e7ea9
5
5
  SHA512:
6
- metadata.gz: 64a732dbbe8b89756cebcc79c9806bf9f0ddd6646d2e527e029fdbcba7ae19bc8b33ae82ccbf4e04dacca81d550af36e6cd31eea0a9950e8210098a827241d89
7
- data.tar.gz: d3bf1303f659b05996386c5cc2f36d4f6bee88a6c187a4cb4f93cd4044b6848c700a653ad3d402af5c48e23d6eaffb8ebd0ff87300377d4cbbb834083f26d836
6
+ metadata.gz: 62659400aed8a1f03108d675fe35674430b1fa5bc2a990ef4bc78fa03072e853b077472a2af0ceace9f7972eb62d8d2c475f9a811f911402a068d28550c26b78
7
+ data.tar.gz: 1ba9446a59bd88a30558850cf20d3b4fabae944e98ef6995e6dcdb940444f41226e923d50f3fac9839f086fce076ad6a4810e1e035b3d0cabce021a4c92dde91
data/CHANGELOG.md CHANGED
@@ -1,3 +1,22 @@
1
+ # 3.3.23 / 2022-10-05
2
+
3
+ ## Enhancements:
4
+
5
+ * Add better error handling for permanent redirect responses. Pull request
6
+ #5931 by jenshenny
7
+ * Installs bundler 2.3.23 as a default gem.
8
+
9
+ ## Bug fixes:
10
+
11
+ * Fix generic arm platform matching against runtime arm platforms with
12
+ eabi modifiers. Pull request #5957 by deivid-rodriguez
13
+ * Fix `Gem::Platform.match` not handling String argument properly. Pull
14
+ request #5939 by flavorjones
15
+ * Fix resolution on non-musl platforms. Pull request #5915 by
16
+ deivid-rodriguez
17
+ * Mask the file mode when extracting files. Pull request #5906 by
18
+ kddnewton
19
+
1
20
  # 3.3.22 / 2022-09-07
2
21
 
3
22
  ## Enhancements:
data/Manifest.txt CHANGED
@@ -577,6 +577,7 @@ test/rubygems/invalidchild_cert.pem
577
577
  test/rubygems/invalidchild_cert_32.pem
578
578
  test/rubygems/invalidchild_key.pem
579
579
  test/rubygems/package/tar_test_case.rb
580
+ test/rubygems/packages/Bluebie-legs-0.6.2.gem
580
581
  test/rubygems/packages/ascii_binder-0.1.10.1.gem
581
582
  test/rubygems/packages/ill-formatted-platform-1.0.0.10.gem
582
583
  test/rubygems/plugin/exception/rubygems_plugin.rb
data/POLICIES.md CHANGED
@@ -42,8 +42,19 @@ at version 2.7, so when RubyGems 2.8 is released, it will only support Ruby
42
42
 
43
43
  ## Release Process
44
44
 
45
- Releases of new versions should follow these steps, to ensure the process is
46
- smooth and no needed steps are missed.
45
+ ### Permissions
46
+
47
+ You'll need the following environment variables set to release RubyGems &
48
+ Bundler:
49
+
50
+ * AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY: to be able to push RubyGems zip
51
+ files to s3 so that they appear at RubyGems [download page].
52
+
53
+ * GITHUB_RELEASE_PAT: A [GitHub PAT] with repo permissions, in order to push
54
+ GitHub releases and to use the GitHub API for changelog generation.
55
+
56
+ [download page]: https://rubygems.org/pages/download
57
+ [GitHub PAT]: https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token
47
58
 
48
59
  ### Recommendations for security releases
49
60
 
@@ -54,14 +65,36 @@ smooth and no needed steps are missed.
54
65
  have to work on weekends.
55
66
  * Continue with the regular release process below.
56
67
 
68
+ ### Automatic changelog and backport generation
69
+
70
+ PR labels and titles are used to automatically generate changelogs for patch and
71
+ minor releases.
72
+
73
+ When releasing, a changelog generation script goes through all PRs that have
74
+ never made it into a release, and selects only the ones with specific labels as
75
+ detailed in the `.changelog.yml` and `bundler/.changelog.yml` files. Those
76
+ particular PRs get backported to the stable branch and included in the release
77
+ changelog.
78
+
79
+ If PRs don't have a proper label, they won't be backported to patch releases.
80
+
81
+ If you want a PR to be backported to a patch level release, but don't want to
82
+ include it in the changelog, you can use the special `rubygems: backport` and
83
+ `bundler: backport` labels. For example, this is useful when backporting a PR
84
+ generates conflicts that are solved by backporting another PR with no user
85
+ visible changes. You can use these special labels to also backport the other PR
86
+ and not get any conflicts.
57
87
 
58
88
  ### Steps for patch releases
59
89
 
60
90
  * Confirm all PRs that you want backported are properly tagged with `rubygems:
61
91
  <type>` or `bundler: <type>` labels at GitHub.
62
- * Run `rake prepare_release[<target_version>]`, create a PR and merge it
63
- to the stable branch once CI passes.
64
- * Switch to the stable branch and pull the PR just merged.
92
+ * Run `rake prepare_release[<target_version>]`. This will create a PR to the
93
+ stable branch with the backports included in the release, and proper
94
+ changelogs and version bumps. It will also create a PR to merge release
95
+ changelogs into master.
96
+ * Once CI passes, merge the release PR, switch to the stable branch and pull
97
+ the PR just merged.
65
98
  * Release `bundler` with `(cd bundler && bin/rake release)`.
66
99
  * Release `rubygems` with `rake release`.
67
100
 
data/bundler/CHANGELOG.md CHANGED
@@ -1,3 +1,21 @@
1
+ # 2.3.23 (October 5, 2022)
2
+
3
+ ## Enhancements:
4
+
5
+ - Update GitLab CI template with new one [#5944](https://github.com/rubygems/rubygems/pull/5944)
6
+
7
+ ## Bug fixes:
8
+
9
+ - Fix `bundle init` not respecting umask in generated gem's Gemfile [#5947](https://github.com/rubygems/rubygems/pull/5947)
10
+
11
+ ## Performance:
12
+
13
+ - Further speed up Bundler by not sorting specs unnecessarily [#5868](https://github.com/rubygems/rubygems/pull/5868)
14
+
15
+ ## Documentation:
16
+
17
+ - Update Bundler new feature instructions [#5912](https://github.com/rubygems/rubygems/pull/5912)
18
+
1
19
  # 2.3.22 (September 7, 2022)
2
20
 
3
21
  ## 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 = "2022-09-07".freeze
8
- @git_commit_sha = "44fb4c9ef5".freeze
7
+ @built_at = "2022-10-05".freeze
8
+ @git_commit_sha = "250d9d485d".freeze
9
9
  @release = true
10
10
  # end ivars
11
11
 
@@ -32,7 +32,11 @@ module Bundler
32
32
  file << spec.to_gemfile
33
33
  end
34
34
  else
35
- FileUtils.cp(File.expand_path("../templates/#{gemfile}", __dir__), gemfile)
35
+ File.open(File.expand_path("../templates/#{gemfile}", __dir__), "r") do |template|
36
+ File.open(gemfile, "wb") do |destination|
37
+ IO.copy_stream(template, destination)
38
+ end
39
+ end
36
40
  end
37
41
 
38
42
  puts "Writing new #{gemfile} to #{SharedHelpers.pwd}/#{gemfile}"
@@ -106,6 +106,7 @@ module Bundler
106
106
  @locked_gems = nil
107
107
  @locked_deps = {}
108
108
  @locked_specs = SpecSet.new([])
109
+ @originally_locked_specs = @locked_specs
109
110
  @locked_sources = []
110
111
  @locked_platforms = []
111
112
  end
@@ -149,18 +150,7 @@ module Bundler
149
150
  end
150
151
 
151
152
  def gem_version_promoter
152
- @gem_version_promoter ||= begin
153
- locked_specs =
154
- if unlocking? && @locked_specs.empty? && !@lockfile_contents.empty?
155
- # Definition uses an empty set of locked_specs to indicate all gems
156
- # are unlocked, but GemVersionPromoter needs the locked_specs
157
- # for conservative comparison.
158
- Bundler::SpecSet.new(@locked_gems.specs)
159
- else
160
- @locked_specs
161
- end
162
- GemVersionPromoter.new(locked_specs, @unlock[:gems])
163
- end
153
+ @gem_version_promoter ||= GemVersionPromoter.new(@originally_locked_specs, @unlock[:gems])
164
154
  end
165
155
 
166
156
  def resolve_only_locally!
@@ -67,7 +67,6 @@ module Bundler
67
67
 
68
68
  gemspecs = Gem::Util.glob_files_in_dir("{,*}.gemspec", expanded_path).map {|g| Bundler.load_gemspec(g) }.compact
69
69
  gemspecs.reject! {|s| s.name != name } if name
70
- Index.sort_specs(gemspecs)
71
70
  specs_by_name_and_version = gemspecs.group_by {|s| [s.name, s.version] }
72
71
 
73
72
  case specs_by_name_and_version.size
@@ -116,15 +116,14 @@ module Bundler
116
116
  end
117
117
 
118
118
  def sort_dep_specs(spec_groups, locked_spec)
119
- return spec_groups unless locked_spec
120
- @gem_name = locked_spec.name
121
- @locked_version = locked_spec.version
119
+ @locked_version = locked_spec&.version
120
+ @gem_name = locked_spec&.name
122
121
 
123
122
  result = spec_groups.sort do |a, b|
124
123
  @a_ver = a.version
125
124
  @b_ver = b.version
126
125
 
127
- unless @prerelease_specified[@gem_name]
126
+ unless @gem_name && @prerelease_specified[@gem_name]
128
127
  a_pre = @a_ver.prerelease?
129
128
  b_pre = @b_ver.prerelease?
130
129
 
@@ -148,7 +147,7 @@ module Bundler
148
147
  end
149
148
 
150
149
  def either_version_older_than_locked
151
- @a_ver < @locked_version || @b_ver < @locked_version
150
+ @locked_version && (@a_ver < @locked_version || @b_ver < @locked_version)
152
151
  end
153
152
 
154
153
  def segments_do_not_match(level)
@@ -157,7 +156,7 @@ module Bundler
157
156
  end
158
157
 
159
158
  def unlocking_gem?
160
- unlock_gems.empty? || unlock_gems.include?(@gem_name)
159
+ unlock_gems.empty? || (@gem_name && unlock_gems.include?(@gem_name))
161
160
  end
162
161
 
163
162
  # Specific version moves can't always reliably be done during sorting
@@ -165,7 +164,7 @@ module Bundler
165
164
  def post_sort(result)
166
165
  # default :major behavior in Bundler does not do this
167
166
  return result if major?
168
- if unlocking_gem?
167
+ if unlocking_gem? || @locked_version.nil?
169
168
  result
170
169
  else
171
170
  move_version_to_end(result, @locked_version)
@@ -57,36 +57,13 @@ module Bundler
57
57
  # Search this index's specs, and any source indexes that this index knows
58
58
  # about, returning all of the results.
59
59
  def search(query)
60
- sort_specs(unsorted_search(query))
61
- end
62
-
63
- def unsorted_search(query)
64
60
  results = local_search(query)
65
-
66
- seen = results.map(&:full_name).uniq unless @sources.empty?
61
+ return results unless @sources.any?
67
62
 
68
63
  @sources.each do |source|
69
- source.unsorted_search(query).each do |spec|
70
- next if seen.include?(spec.full_name)
71
-
72
- seen << spec.full_name
73
- results << spec
74
- end
64
+ results.concat(source.search(query))
75
65
  end
76
-
77
- results
78
- end
79
- protected :unsorted_search
80
-
81
- def self.sort_specs(specs)
82
- specs.sort_by do |s|
83
- platform_string = s.platform.to_s
84
- [s.version, platform_string == RUBY ? NULL : platform_string]
85
- end
86
- end
87
-
88
- def sort_specs(specs)
89
- self.class.sort_specs(specs)
66
+ results.uniq(&:full_name)
90
67
  end
91
68
 
92
69
  def local_search(query)
@@ -42,8 +42,7 @@ module Bundler
42
42
  remove_from_candidates(spec)
43
43
  end
44
44
 
45
- @gem_version_promoter.prerelease_specified = @prerelease_specified = {}
46
- requirements.each {|dep| @prerelease_specified[dep.name] ||= dep.prerelease? }
45
+ requirements.each {|dep| prerelease_specified[dep.name] ||= dep.prerelease? }
47
46
 
48
47
  verify_gemfile_dependencies_are_found!(requirements)
49
48
  result = @resolver.resolve(requirements).
@@ -127,13 +126,6 @@ module Bundler
127
126
  results = results_for(dependency) + locked_results
128
127
  results = results.select {|spec| requirement_satisfied_by?(locked_requirement, nil, spec) } if locked_requirement
129
128
 
130
- if !@prerelease_specified[name] && locked_results.empty?
131
- # Move prereleases to the beginning of the list, so they're considered
132
- # last during resolution.
133
- pre, results = results.partition {|spec| spec.version.prerelease? }
134
- results = pre + results
135
- end
136
-
137
129
  if results.any?
138
130
  results = @gem_version_promoter.sort_versions(dependency, results)
139
131
 
@@ -221,6 +213,10 @@ module Bundler
221
213
  @base.base_requirements
222
214
  end
223
215
 
216
+ def prerelease_specified
217
+ @gem_version_promoter.prerelease_specified
218
+ end
219
+
224
220
  def remove_from_candidates(spec)
225
221
  @base.delete(spec)
226
222
 
@@ -255,7 +251,7 @@ module Bundler
255
251
  all - 1_000_000
256
252
  else
257
253
  search = search_for(dependency)
258
- search = @prerelease_specified[dependency.name] ? search.count : search.count {|s| !s.version.prerelease? }
254
+ search = prerelease_specified[dependency.name] ? search.count : search.count {|s| !s.version.prerelease? }
259
255
  search - all
260
256
  end
261
257
  end
@@ -284,7 +280,7 @@ module Bundler
284
280
  end
285
281
 
286
282
  def gem_not_found_message(name, requirement, source, extra_message = "")
287
- specs = source.specs.search(name)
283
+ specs = source.specs.search(name).sort_by {|s| [s.version, s.platform.to_s] }
288
284
  matching_part = name
289
285
  requirement_label = SharedHelpers.pretty_dependency(requirement)
290
286
  cache_message = begin
@@ -261,10 +261,21 @@ module Gem
261
261
  # version
262
262
  (
263
263
  (@os != "linux" && (@version.nil? || other.version.nil?)) ||
264
- (@os == "linux" && (other.version == "gnu#{@version}" || other.version == "musl#{@version}" || @version == "gnu#{other.version}")) ||
264
+ (@os == "linux" && (normalized_linux_version_ext == other.normalized_linux_version_ext || ["musl#{@version}", "musleabi#{@version}", "musleabihf#{@version}"].include?(other.version))) ||
265
265
  @version == other.version
266
266
  )
267
267
  end
268
+
269
+ # This is a copy of RubyGems 3.3.23 or higher `normalized_linux_method`.
270
+ # Once only 3.3.23 is supported, we can use the method in RubyGems.
271
+ def normalized_linux_version_ext
272
+ return nil unless @version
273
+
274
+ without_gnu_nor_abi_modifiers = @version.sub(/\Agnu/, "").sub(/eabi(hf)?\Z/, "")
275
+ return nil if without_gnu_nor_abi_modifiers.empty?
276
+
277
+ without_gnu_nor_abi_modifiers
278
+ end
268
279
  end
269
280
  end
270
281
 
@@ -176,7 +176,7 @@ module Bundler
176
176
  def lookup
177
177
  @lookup ||= begin
178
178
  lookup = Hash.new {|h, k| h[k] = [] }
179
- Index.sort_specs(@specs).reverse_each do |s|
179
+ @specs.each do |s|
180
180
  lookup[s.name] << s
181
181
  end
182
182
  lookup
@@ -1,8 +1,9 @@
1
- image: ruby:<%= RUBY_VERSION %>
1
+ default:
2
+ image: ruby:<%= RUBY_VERSION %>
2
3
 
3
- before_script:
4
- - gem install bundler -v <%= Bundler::VERSION %>
5
- - bundle install
4
+ before_script:
5
+ - gem install bundler -v <%= Bundler::VERSION %>
6
+ - bundle install
6
7
 
7
8
  example_job:
8
9
  script:
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: false
2
2
 
3
3
  module Bundler
4
- VERSION = "2.3.22".freeze
4
+ VERSION = "2.3.23".freeze
5
5
 
6
6
  def self.bundler_major_version
7
7
  @bundler_major_version ||= VERSION.split(".").first.to_i
@@ -201,7 +201,8 @@ module Gem::GemcutterUtilities
201
201
  # block was given or shows the response body to the user.
202
202
  #
203
203
  # If the response was not successful, shows an error to the user including
204
- # the +error_prefix+ and the response body.
204
+ # the +error_prefix+ and the response body. If the response was a permanent redirect,
205
+ # shows an error to the user including the redirect location.
205
206
 
206
207
  def with_response(response, error_prefix = nil)
207
208
  case response
@@ -211,6 +212,12 @@ module Gem::GemcutterUtilities
211
212
  else
212
213
  say clean_text(response.body)
213
214
  end
215
+ when Net::HTTPPermanentRedirect, Net::HTTPRedirection then
216
+ message = "The request has redirected permanently to #{response['location']}. Please check your defined push host URL."
217
+ message = "#{error_prefix}: #{message}" if error_prefix
218
+
219
+ say clean_text(message)
220
+ terminate_interaction(ERROR_CODE)
214
221
  else
215
222
  message = response.body
216
223
  message = "#{error_prefix}: #{message}" if error_prefix
@@ -444,10 +444,10 @@ EOM
444
444
  directories << mkdir
445
445
  end
446
446
 
447
- File.open destination, "wb" do |out|
448
- out.write entry.read
447
+ if entry.file?
448
+ File.open(destination, "wb") {|out| out.write entry.read }
449
449
  FileUtils.chmod file_mode(entry.header.mode), destination
450
- end if entry.file?
450
+ end
451
451
 
452
452
  verbose destination
453
453
  end
@@ -467,7 +467,12 @@ EOM
467
467
  end
468
468
 
469
469
  def file_mode(mode) # :nodoc:
470
- ((mode & 0111).zero? ? data_mode : prog_mode) || mode
470
+ ((mode & 0111).zero? ? data_mode : prog_mode) ||
471
+ # If we're not using one of the default modes, then we're going to fall
472
+ # back to the mode from the tarball. In this case we need to mask it down
473
+ # to fit into 2^16 bits (the maximum value for a mode in CRuby since it
474
+ # gets put into an unsigned short).
475
+ (mode & ((1 << 16) - 1))
471
476
  end
472
477
 
473
478
  ##
@@ -22,6 +22,7 @@ class Gem::Platform
22
22
  end
23
23
 
24
24
  def self.match_platforms?(platform, platforms)
25
+ platform = Gem::Platform.new(platform) unless platform.is_a?(Gem::Platform)
25
26
  platforms.any? do |local_platform|
26
27
  platform.nil? ||
27
28
  local_platform == platform ||
@@ -162,6 +163,9 @@ class Gem::Platform
162
163
  # runtime platform "no version" stands for 'gnu'. To be able to disinguish
163
164
  # these, the method receiver is the gem platform, while the argument is
164
165
  # the runtime platform.
166
+ #
167
+ #--
168
+ # NOTE: Until it can be removed, changes to this method must also be reflected in `bundler/lib/bundler/rubygems_ext.rb`
165
169
 
166
170
  def ===(other)
167
171
  return nil unless Gem::Platform === other
@@ -180,11 +184,23 @@ class Gem::Platform
180
184
  # version
181
185
  (
182
186
  (@os != "linux" && (@version.nil? || other.version.nil?)) ||
183
- (@os == "linux" && (other.version == "gnu#{@version}" || other.version == "musl#{@version}" || @version == "gnu#{other.version}")) ||
187
+ (@os == "linux" && (normalized_linux_version == other.normalized_linux_version || ["musl#{@version}", "musleabi#{@version}", "musleabihf#{@version}"].include?(other.version))) ||
184
188
  @version == other.version
185
189
  )
186
190
  end
187
191
 
192
+ #--
193
+ # NOTE: Until it can be removed, changes to this method must also be reflected in `bundler/lib/bundler/rubygems_ext.rb`
194
+
195
+ def normalized_linux_version
196
+ return nil unless @version
197
+
198
+ without_gnu_nor_abi_modifiers = @version.sub(/\Agnu/, "").sub(/eabi(hf)?\Z/, "")
199
+ return nil if without_gnu_nor_abi_modifiers.empty?
200
+
201
+ without_gnu_nor_abi_modifiers
202
+ end
203
+
188
204
  ##
189
205
  # Does +other+ match this platform? If +other+ is a String it will be
190
206
  # converted to a Gem::Platform first. See #=== for matching rules.
@@ -246,7 +246,7 @@ class Gem::Resolver
246
246
 
247
247
  sources.each do |source|
248
248
  groups[source].
249
- sort_by {|spec| [spec.version, Gem::Platform.local =~ spec.platform ? 1 : 0] }.
249
+ sort_by {|spec| [spec.version, spec.platform =~ Gem::Platform.local ? 1 : 0] }.
250
250
  map {|spec| ActivationRequest.new spec, dependency }.
251
251
  each {|activation_request| activation_requests << activation_request }
252
252
  end
data/lib/rubygems.rb CHANGED
@@ -8,7 +8,7 @@
8
8
  require "rbconfig"
9
9
 
10
10
  module Gem
11
- VERSION = "3.3.22".freeze
11
+ VERSION = "3.3.23".freeze
12
12
  end
13
13
 
14
14
  # Must be first since it unloads the prelude from 1.9.2
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "rubygems-update"
5
- s.version = "3.3.22"
5
+ s.version = "3.3.23"
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
 
@@ -2,26 +2,11 @@
2
2
 
3
3
  require "rubygems"
4
4
 
5
- # If bundler gemspec exists, add to stubs
6
- bundler_gemspec = File.expand_path("../../bundler/bundler.gemspec", __dir__)
7
- if File.exist?(bundler_gemspec)
8
- Gem::Specification.dirs.unshift File.dirname(bundler_gemspec)
9
- Gem::Specification.class_variable_set :@@stubs, nil
10
- Gem::Specification.stubs
11
- Gem::Specification.dirs.shift
12
- end
13
-
14
5
  begin
15
6
  gem "test-unit", "~> 3.0"
16
7
  rescue Gem::LoadError
17
8
  end
18
9
 
19
- if File.exist?(bundler_gemspec)
20
- require_relative "../../bundler/lib/bundler"
21
- else
22
- require "bundler"
23
- end
24
-
25
10
  require "test/unit"
26
11
 
27
12
  ENV["JARS_SKIP"] = "true" if Gem.java_platform? # avoid unnecessary and noisy `jar-dependencies` post install hook
@@ -409,7 +394,6 @@ class Gem::TestCase < Test::Unit::TestCase
409
394
  Gem.loaded_specs.clear
410
395
  Gem.instance_variable_set(:@activated_gem_paths, 0)
411
396
  Gem.clear_default_specs
412
- Bundler.reset!
413
397
 
414
398
  Gem.configuration.verbose = true
415
399
  Gem.configuration.update_sources = true
@@ -465,7 +449,7 @@ class Gem::TestCase < Test::Unit::TestCase
465
449
 
466
450
  FileUtils.rm_rf @tempdir
467
451
 
468
- ENV.replace(@orig_env)
452
+ restore_env
469
453
 
470
454
  Gem::ConfigFile.send :remove_const, :SYSTEM_WIDE_CONFIG_FILE
471
455
  Gem::ConfigFile.send :const_set, :SYSTEM_WIDE_CONFIG_FILE,
@@ -575,6 +559,7 @@ class Gem::TestCase < Test::Unit::TestCase
575
559
  Dir.chdir directory do
576
560
  unless File.exist? ".git"
577
561
  system @git, "init", "--quiet"
562
+ system @git, "checkout", "-b", "master", "--quiet"
578
563
  system @git, "config", "user.name", "RubyGems Tests"
579
564
  system @git, "config", "user.email", "rubygems@example"
580
565
  end
@@ -1301,6 +1286,10 @@ Also, a list:
1301
1286
  $LOAD_PATH.find {|p| p == File.dirname($LOADED_FEATURES.find {|f| f.end_with?("/rubygems.rb") }) }
1302
1287
  end
1303
1288
 
1289
+ def bundler_path
1290
+ $LOAD_PATH.find {|p| p == File.dirname($LOADED_FEATURES.find {|f| f.end_with?("/bundler.rb") }) }
1291
+ end
1292
+
1304
1293
  def with_clean_path_to_ruby
1305
1294
  orig_ruby = Gem.ruby
1306
1295
 
@@ -1581,6 +1570,23 @@ Also, a list:
1581
1570
  PUBLIC_KEY = nil
1582
1571
  PUBLIC_CERT = nil
1583
1572
  end if Gem::HAVE_OPENSSL
1573
+
1574
+ private
1575
+
1576
+ def restore_env
1577
+ unless Gem.win_platform?
1578
+ ENV.replace(@orig_env)
1579
+ return
1580
+ end
1581
+
1582
+ # Fallback logic for Windows below to workaround
1583
+ # https://bugs.ruby-lang.org/issues/16798. Can be dropped once all
1584
+ # supported rubies include the fix for that.
1585
+
1586
+ ENV.clear
1587
+
1588
+ @orig_env.each {|k, v| ENV[k] = v }
1589
+ end
1584
1590
  end
1585
1591
 
1586
1592
  # https://github.com/seattlerb/minitest/blob/13c48a03d84a2a87855a4de0c959f96800100357/lib/minitest/mock.rb#L192