ruby-changes:61120
From: David <ko1@a...>
Date: Fri, 8 May 2020 14:14:43 +0900 (JST)
Subject: [ruby-changes:61120] 314d7f897c (master): Remove `builder` gem requirement for `gem regenerate_index`
https://git.ruby-lang.org/ruby.git/commit/?id=314d7f897c From 314d7f897ca02c173fa0e3b3e36c69482f71a358 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= <deivid.rodriguez@r...> Date: Sat, 25 Apr 2020 14:09:24 +0200 Subject: Remove `builder` gem requirement for `gem regenerate_index` This requirement was introduced 14 years ago in 7ce7039b390440754954df5efea619e9f57ef823, and I don't think it's necessary anymore. I made several tests introducing UTF-8 characters in gemspec files and generating indexes out of them, and couldn't find any issues. Gemspecs are read with UTF-8 encoding these days. diff --git a/lib/rubygems/indexer.rb b/lib/rubygems/indexer.rb index 4d19986..75bd824 100644 --- a/lib/rubygems/indexer.rb +++ b/lib/rubygems/indexer.rb @@ -11,11 +11,6 @@ rescue LoadError # this rubygems + old ruby https://github.com/ruby/ruby/blob/trunk/lib/rubygems/indexer.rb#L11 else # this rubygems + ruby trunk with bundler rescue_exceptions << Bundler::GemfileNotFound end -begin - gem 'builder' - require 'builder/xchar' -rescue *rescue_exceptions -end ## # Top level class for building the gem repository index. @@ -62,11 +57,6 @@ class Gem::Indexer https://github.com/ruby/ruby/blob/trunk/lib/rubygems/indexer.rb#L57 require 'tmpdir' require 'zlib' - unless defined?(Builder::XChar) - raise "Gem::Indexer requires that the XML Builder library be installed:" + - "\n\tgem install builder" - end - options = { :build_modern => true }.merge options @build_modern = options[:build_modern] diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb index bcb5da5..9f6cdea 100644 --- a/lib/rubygems/specification.rb +++ b/lib/rubygems/specification.rb @@ -1447,13 +1447,7 @@ class Gem::Specification < Gem::BasicSpecification https://github.com/ruby/ruby/blob/trunk/lib/rubygems/specification.rb#L1447 # HACK the #to_s is in here because RSpec has an Array of Arrays of # Strings for authors. Need a way to disallow bad values on gemspec # generation. (Probably won't happen.) - string = string.to_s - - begin - Builder::XChar.encode string - rescue NameError, NoMethodError - string.to_xs - end + string.to_s end ## diff --git a/lib/rubygems/test_case.rb b/lib/rubygems/test_case.rb index 6e9c50d..bb1ce28 100644 --- a/lib/rubygems/test_case.rb +++ b/lib/rubygems/test_case.rb @@ -1544,10 +1544,4 @@ begin https://github.com/ruby/ruby/blob/trunk/lib/rubygems/test_case.rb#L1544 rescue LoadError, Gem::LoadError end -begin - gem 'builder' - require 'builder/xchar' -rescue LoadError, Gem::LoadError -end - require 'rubygems/test_utilities' diff --git a/test/rubygems/test_gem_commands_generate_index_command.rb b/test/rubygems/test_gem_commands_generate_index_command.rb index d8fda32..6b69bcf 100644 --- a/test/rubygems/test_gem_commands_generate_index_command.rb +++ b/test/rubygems/test_gem_commands_generate_index_command.rb @@ -3,10 +3,6 @@ require 'rubygems/test_case' https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_commands_generate_index_command.rb#L3 require 'rubygems/indexer' require 'rubygems/commands/generate_index_command' -unless defined?(Builder::XChar) - warn "generate_index tests are being skipped. Install builder gem." -end - class TestGemCommandsGenerateIndexCommand < Gem::TestCase def setup @@ -83,4 +79,4 @@ class TestGemCommandsGenerateIndexCommand < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_commands_generate_index_command.rb#L79 @ui.error end -end if defined?(Builder::XChar) +end diff --git a/test/rubygems/test_gem_indexer.rb b/test/rubygems/test_gem_indexer.rb index d5f28b8..f20e3c5 100644 --- a/test/rubygems/test_gem_indexer.rb +++ b/test/rubygems/test_gem_indexer.rb @@ -2,10 +2,6 @@ https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_indexer.rb#L2 require 'rubygems/test_case' require 'rubygems/indexer' -unless defined?(Builder::XChar) - warn "Gem::Indexer tests are being skipped. Install builder gem." -end - class TestGemIndexer < Gem::TestCase def setup @@ -360,4 +356,4 @@ class TestGemIndexer < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_indexer.rb#L356 refute File.exist?(file), "#{file} exists" end -end if defined?(Builder::XChar) +end diff --git a/test/rubygems/test_gem_source.rb b/test/rubygems/test_gem_source.rb index 24b8edb..88e89bd 100644 --- a/test/rubygems/test_gem_source.rb +++ b/test/rubygems/test_gem_source.rb @@ -55,8 +55,6 @@ class TestGemSource < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_source.rb#L55 end def test_dependency_resolver_set_file_uri - skip 'install builder gem' unless defined? Builder::XChar - Gem::Indexer.new(@tempdir).generate_index source = Gem::Source.new "file://#{@tempdir}/" -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/