X-Git-Url: http://gitweb.michael.orlitzky.com/?p=mailshears.git;a=blobdiff_plain;f=lib%2Frm%2Frm_runner.rb;fp=lib%2Frm%2Frm_runner.rb;h=4162ddf531192e549b48eaf10a7760271e402f78;hp=a19004a7a5440fcd23bb22173d3e5fe4d963ed76;hb=df4e02ebf6a4e28a58abcb298a4442a245ad0b15;hpb=d0bfa37fb4be739b31dd97c493764ca19a160182 diff --git a/lib/rm/rm_runner.rb b/lib/rm/rm_runner.rb index a19004a..4162ddf 100644 --- a/lib/rm/rm_runner.rb +++ b/lib/rm/rm_runner.rb @@ -1,24 +1,44 @@ require 'common/errors' require 'common/runner' +# Perform the removal of users/domains using {RmPlugin}s. +# class RmRunner include Runner + # Run *plugin* to remove the users/domains in *targets*. The method + # signature includes the unused *cfg* for consistency with the + # runners that do need a {Configuration}. + # + # @param cfg [Configuration] unused. + # + # @param plugin [Class] plugin class that will perform the removal. + # + # @param targets [Array] the users and domains to be + # removed. + # def run(cfg, plugin, *targets) targets.each do |target| remove_target(plugin, target) end end - private; + protected; + + # Remove *target* using *plugin*. This operation is separate from + # the run() method so that it can be accessed by the prune + # runner. + # + # @param plugin [RmPlugin] the plugin that will remove the *target*. + # + # @param target [User,Domain] the user or domain to remove. + # 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) + plugin.remove(target) msg = "Removed #{target.class.to_s().downcase()} #{target}" # Only append the extra description if it's useful.