Class: Basketcase::AddCommand

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



409
410
411
412
413
414
415
416
417
418
419
420
421
# File 'lib/basketcase.rb', line 409

def execute
  unlock_parent_directories(specified_targets)
  cleartool_unsafe("mkelem -ncomment #{specified_targets}") do |line|
    case line
    when /^Created element /
      # ignore
    when /^Checked out "(.+)" from version "(\S+)"\./
      report(:ADDED, mkpath($1), $2)
    else
      cannot_deal_with line
    end
  end
end

#helpObject



402
403
404
405
406
407
# File 'lib/basketcase.rb', line 402

def help
  <<EOF
Add elements to the repository.
(Parent directories are checked-out automatically)
EOF
end

#synopsisObject



398
399
400
# File 'lib/basketcase.rb', line 398

def synopsis
  "<element> ..."
end