require 'common/errors' require 'common/runner' class RmRunner include Runner def run(plugin, *targets) targets.each do |target| remove_target(plugin, target) end end private; def remove_target(plugin, target) # Wrap the "remove this thing" operation so that it can be reused # in the prine plugin. target_description = plugin.describe(target) begin plugin.delete(target) msg = "Removed #{target.class.to_s().downcase()} #{target}" # Only append the extra description if it's useful. if not target_description.nil? and not target_description.empty? and not target_description == target.to_s() then msg += " (#{target_description})" end msg += '.' report(plugin, msg) rescue NonexistentDomainError, NonexistentUserError => e report(plugin, "#{target.class.to_s()} #{e.to_s} not found.") end end end