Class: Basketcase::MoveCommand

Inherits:
DirectoryModificationCommand show all
Defined in:
lib/basketcase.rb

Instance Attribute Summary

Attributes inherited from Command

#comment, #listener, #targets

Instance Method Summary collapse

Methods inherited from DirectoryModificationCommand

#checkout, #find_locked_elements, #unlock_parent_directories

Methods inherited from Command

#accept_args, #effective_targets, #initialize, #option_comment, #option_graphical, #option_recurse, #report, #specified_targets

Methods included from Utils

#mkpath

Constructor Details

This class inherits a constructor from Basketcase::Command

Instance Method Details

#executeObject

Raises:



715
716
717
718
719
720
721
722
723
724
725
726
727
# File 'lib/basketcase.rb', line 715

def execute
  raise UsageException, "expected two arguments" unless (specified_targets.size == 2)
  unlock_parent_directories(specified_targets)
  cleartool_unsafe("move -ncomment #{specified_targets}") do |line|
    case line
    when /^Moved "(.+)" to "(.+)"\./
      report(:REMOVED, mkpath($1))
      report(:ADDED, mkpath($2))
    else
      cannot_deal_with line
    end
  end
end

#helpObject



708
709
710
711
712
713
# File 'lib/basketcase.rb', line 708

def help
  <<EOF
Move/rename an element.
(Parent directories are checked-out automatically)
EOF
end

#synopsisObject



704
705
706
# File 'lib/basketcase.rb', line 704

def synopsis
  "<from> <to>"
end