2016-02-01 15:43:26 +03:00
|
|
|
# frozen_string_literal: true
|
2009-06-10 01:38:59 +04:00
|
|
|
require 'rubygems/command_manager'
|
|
|
|
|
2010-04-22 12:24:42 +04:00
|
|
|
##
|
|
|
|
# This is an example of exactly what NOT to do.
|
|
|
|
#
|
|
|
|
# DO NOT include code like this in your rubygems_plugin.rb
|
|
|
|
|
2016-04-28 03:33:08 +03:00
|
|
|
module Gem::Commands
|
|
|
|
remove_const(:InterruptCommand) if defined?(InterruptCommand)
|
|
|
|
end
|
|
|
|
|
2009-06-10 01:38:59 +04:00
|
|
|
class Gem::Commands::InterruptCommand < Gem::Command
|
|
|
|
|
|
|
|
def initialize
|
|
|
|
super('interrupt', 'Raises an Interrupt Exception', {})
|
|
|
|
end
|
|
|
|
|
|
|
|
def execute
|
|
|
|
raise Interrupt, "Interrupt exception"
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
Gem::CommandManager.instance.register_command :interrupt
|
|
|
|
|