X-Git-Url: http://gitweb.michael.orlitzky.com/?p=mailshears.git;a=blobdiff_plain;f=lib%2Fmv%2Fmv_dummy_runner.rb;h=7db7c06c9536947b32ad05305fa8601fc7d22da5;hp=ff612ffeb175e7bc4b663c0f18214055f5946890;hb=a731b98f97194b8882c42d3c2b27de75f60d6b05;hpb=72696d3f6e95ef773af9727e9c3459b9038b0fc2 diff --git a/lib/mv/mv_dummy_runner.rb b/lib/mv/mv_dummy_runner.rb index ff612ff..7db7c06 100644 --- a/lib/mv/mv_dummy_runner.rb +++ b/lib/mv/mv_dummy_runner.rb @@ -3,12 +3,39 @@ require 'common/runner' class MvDummyRunner include Runner - def run(plugin, src, dst) - if src.include?('@') then - puts "Would move user: #{src} to #{dst}" - else - puts "Would move domain: #{src} to #{dst}" + def run(cfg, plugin, src, dst) + + if src.is_a?(Domain) or dst.is_a?(Domain) then + msg = 'only users can be moved' + raise NotImplementedError.new(msg) + end + + # Since we're not actually moving anything, the destination + # description is really only useful for seeing whether or not we'd + # be trying to move in on top of an existing account. + src_description = plugin.describe(src) + dst_description = plugin.describe(dst) + + msg = "Would move user #{src} " + + # Only append the extra description if it's useful. + if not src_description.nil? and + not src_description.empty? and + not src_description == src.to_s() then + msg += "(#{src_description}) " end + + msg += "to #{dst}" + + # Only append the extra description if it's useful. + if not dst_description.nil? and + not dst_description.empty? and + not dst_description == dst.to_s() then + msg += " (#{dst_description})" + end + + msg += "." + report(plugin, msg) end end