X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;ds=sidebyside;f=lib%2Frm%2Frm_dummy_runner.rb;h=2b1f14d66af40e91514aad00fb21a0f6d87596d2;hb=2ba18d3c7a998fdb05c8b81759c2540f83b44bff;hp=477608f8e77318e535ef671eca0bb7a629a5d0ad;hpb=6f2bc0181c6bb900e37d04ea722beec54486b87e;p=mailshears.git
diff --git a/lib/rm/rm_dummy_runner.rb b/lib/rm/rm_dummy_runner.rb
index 477608f..2b1f14d 100644
--- a/lib/rm/rm_dummy_runner.rb
+++ b/lib/rm/rm_dummy_runner.rb
@@ -1,17 +1,37 @@
require 'common/runner'
+# Dummy implementation of a {RmRunner}. Its run() 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] the users and domains to be
+ # removed.
+ #
+ def run(cfg, plugin, *targets)
targets.each do |target|
- if target.include?('@') then
- user_description = plugin.describe_user(target)
- report(plugin, "Would remove user: #{target} (#{user_description})")
- else
- domain_description = plugin.describe_domain(target)
- report(plugin, "Would remove domain: #{target} (#{domain_description})")
- end
+ target_description = plugin.describe(target)
+ msg = "Would remove #{target.class.to_s().downcase()} "
+ msg += add_description(target, target_description)
+ msg += '.'
+
+ report(plugin, msg)
end
end