mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[rubygems/rubygems] Revert "Cleaup unnecessary code"
Unclear why, but2e05dadbc5
created some warnings in ruby-core CI, so let's revert it.729ce3a6e1
This commit is contained in:
parent
b91f685a26
commit
b7a61cb485
2 changed files with 20 additions and 0 deletions
|
@ -1,6 +1,15 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
require "rubygems/command_manager"
|
require "rubygems/command_manager"
|
||||||
|
|
||||||
|
##
|
||||||
|
# This is an example of exactly what NOT to do.
|
||||||
|
#
|
||||||
|
# DO NOT include code like this in your rubygems_plugin.rb
|
||||||
|
|
||||||
|
module Gem::Commands
|
||||||
|
remove_const(:InterruptCommand) if defined?(InterruptCommand)
|
||||||
|
end
|
||||||
|
|
||||||
class Gem::Commands::InterruptCommand < Gem::Command
|
class Gem::Commands::InterruptCommand < Gem::Command
|
||||||
def initialize
|
def initialize
|
||||||
super("interrupt", "Raises an Interrupt Exception", {})
|
super("interrupt", "Raises an Interrupt Exception", {})
|
||||||
|
|
|
@ -20,6 +20,8 @@ class TestGem < Gem::TestCase
|
||||||
common_installer_setup
|
common_installer_setup
|
||||||
|
|
||||||
@additional = %w[a b].map {|d| File.join @tempdir, d }
|
@additional = %w[a b].map {|d| File.join @tempdir, d }
|
||||||
|
|
||||||
|
util_remove_interrupt_command
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_self_finish_resolve
|
def test_self_finish_resolve
|
||||||
|
@ -1548,10 +1550,14 @@ class TestGem < Gem::TestCase
|
||||||
with_plugin("load") { Gem.load_env_plugins }
|
with_plugin("load") { Gem.load_env_plugins }
|
||||||
assert_equal :loaded, TEST_PLUGIN_LOAD rescue nil
|
assert_equal :loaded, TEST_PLUGIN_LOAD rescue nil
|
||||||
|
|
||||||
|
util_remove_interrupt_command
|
||||||
|
|
||||||
# Should attempt to cause a StandardError
|
# Should attempt to cause a StandardError
|
||||||
with_plugin("standarderror") { Gem.load_env_plugins }
|
with_plugin("standarderror") { Gem.load_env_plugins }
|
||||||
assert_equal :loaded, TEST_PLUGIN_STANDARDERROR rescue nil
|
assert_equal :loaded, TEST_PLUGIN_STANDARDERROR rescue nil
|
||||||
|
|
||||||
|
util_remove_interrupt_command
|
||||||
|
|
||||||
# Should attempt to cause an Exception
|
# Should attempt to cause an Exception
|
||||||
with_plugin("exception") { Gem.load_env_plugins }
|
with_plugin("exception") { Gem.load_env_plugins }
|
||||||
assert_equal :loaded, TEST_PLUGIN_EXCEPTION rescue nil
|
assert_equal :loaded, TEST_PLUGIN_EXCEPTION rescue nil
|
||||||
|
@ -2101,6 +2107,11 @@ You may need to `bundle install` to install missing gems
|
||||||
spec
|
spec
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def util_remove_interrupt_command
|
||||||
|
Gem::Commands.send :remove_const, :InterruptCommand if
|
||||||
|
Gem::Commands.const_defined? :InterruptCommand
|
||||||
|
end
|
||||||
|
|
||||||
def util_cache_dir
|
def util_cache_dir
|
||||||
File.join Gem.dir, "cache"
|
File.join Gem.dir, "cache"
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue