]> gitweb.michael.orlitzky.com - mailshears.git/blobdiff - lib/rm/rm_dummy_runner.rb
Don't fail if the source user doesn't exist during an AgendavMv.
[mailshears.git] / lib / rm / rm_dummy_runner.rb
index 2ab25e80a3e402f5ba3c21214b30a768d6c2cd2c..2b1f14d66af40e91514aad00fb21a0f6d87596d2 100644 (file)
@@ -1,19 +1,34 @@
 require 'common/runner'
 
+# Dummy implementation of a {RmRunner}. Its <tt>run()</tt> method will
+# tell you what would have been removed, but will not actually perform
+# the operation.
+#
 class RmDummyRunner
   include Runner
 
-  def run(plugin, *targets)
+
+  # Pretend to remove *targets*. Some "what if"
+  # information will be output to stdout.
+  #
+  # This dummy runner is not particularly useful on its own. About the
+  # only thing it does is let you know that the users/domains in
+  # *targets* do in fact exist (through their descriptions). It's used
+  # to good effect by {PruneDummyRunner}, though.
+  #
+  # @param cfg [Configuration] the configuration options to pass to
+  #   the *plugin* we're runnning.
+  #
+  # @param plugin [RmPlugin] plugin that will perform the move.
+  #
+  # @param targets [Array<User,Domain>] the users and domains to be
+  #   removed.
+  #
+  def run(cfg, plugin, *targets)
     targets.each do |target|
       target_description = plugin.describe(target)
-      msg =  "Would remove #{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 =  "Would remove #{target.class.to_s().downcase()} "
+      msg += add_description(target, target_description)
       msg += '.'
 
       report(plugin, msg)