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



356
357
358
359
# File 'lib/basketcase.rb', line 356

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

#find_locked_elements(paths) ⇒ Object



348
349
350
351
352
353
354
# File 'lib/basketcase.rb', line 348

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



361
362
363
# File 'lib/basketcase.rb', line 361

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