]>
gitweb.michael.orlitzky.com - mailshears.git/blob - lib/mv/mv_dummy_runner.rb
1 require 'common/runner'
3 # Dummy implementation of a {MvRunner}. Its <tt>run()</tt> method will
4 # tell you what would have been moved, but will not actually perform
10 # Pretend to move *src* to *dst* with *plugin*. Some "what if"
11 # information will be output to stdout. This is useful to see if
12 # there would be (for example) a username collision at *dst* before
13 # attempting the move in earnest.
15 # @param cfg [Configuration] the configuration options to pass to
16 # the *plugin* we're runnning.
18 # @param plugin [Class] plugin class that will perform the move.
20 # @param src [User] the source user to be moved.
22 # @param dst [User] the destination user, to which we will move *src*.
24 def run(cfg
, plugin
, src
, dst
)
26 if src
.is_a
?(Domain
) or dst
.is_a
?(Domain
) then
27 msg
= 'only users can be moved'
28 raise NotImplementedError
.new(msg
)
31 # Since we're not actually moving anything, the destination
32 # description is really only useful for seeing whether or not we'd
33 # be trying to move in on top of an existing account.
34 src_description
= plugin
.describe(src
)
35 dst_description
= plugin
.describe(dst
)
37 msg
= "Would move user "
38 msg +
= add_description(src
, src_description
)
40 add_description(dst
, dst_description
)