class Drupid::Updater::MoveAction

Public Class Methods

new(platform, component, new_path) click to toggle source

new_path must be relative to platform.local_path.

Calls superclass method Drupid::Updater::AbstractAction::new
    # File lib/drupid/updater.rb
705 def initialize(platform, component, new_path)
706   super(platform, component)
707   @destination = Pathname.new(new_path)
708 end

Public Instance Methods

fire!() click to toggle source
    # File lib/drupid/updater.rb
710 def fire!
711   if component.local_path.exist? # may have disappeared in the meantime (e.g., because of an update)
712     dst = platform.local_path + @destination
713     debug "Moving #{component.local_path} to #{dst}"
714     if dst.exist?
715       debug "#{dst} already exists, it will be deleted"
716       dont_debug { dst.rmtree }
717     end
718     dont_debug { dst.parent.mkpath }
719     dont_debug { FileUtils.mv component.local_path.to_s, dst.to_s }
720   else
721     blah "Cannot move #{component.local_path.relative_path_from(platform.local_path)}\n" +
722       "(It does not exist any longer)"
723   end
724   @pending = false
725 end
msg() click to toggle source
    # File lib/drupid/updater.rb
727 def msg
728   src = component.local_path.relative_path_from(platform.local_path)
729   "#{Tty.blue}[Move]#{Tty.white}    #{component.extended_name}:#{Tty.reset} #{src} => #{@destination}"
730 end