Class: Basketcase::DirectoryModificationCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/basketcase.rb

Direct Known Subclasses

AddCommand, MoveCommand, RemoveCommand

Instance Attribute Summary

Attributes inherited from Command

#comment, #listener, #targets

Instance Method Summary collapse

Methods inherited from Command

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

Methods included from Utils

#mkpath

Constructor Details

This class inherits a constructor from Basketcase::Command

Instance Method Details

#checkout(target_list) ⇒ Object



633
634
635
636
# File 'lib/basketcase.rb', line 633

def checkout(target_list)
  return if target_list.empty?
  run(CheckoutCommand, *target_list)
end

#find_locked_elements(paths) ⇒ Object



625
626
627
628
629
630
631
# File 'lib/basketcase.rb', line 625

def find_locked_elements(paths)
  locked_elements = []
  run(LsCommand, '-a', '-d', *paths) do |e|
    locked_elements << e.path if e.status == :OK
  end
  locked_elements
end

#unlock_parent_directories(target_list) ⇒ Object



638
639
640
# File 'lib/basketcase.rb', line 638

def unlock_parent_directories(target_list)
  checkout find_locked_elements(target_list.parents)
end