Class: Basketcase::LsCommand
Instance Attribute Summary
Attributes inherited from Command
#comment, #listener, #targets
Instance Method Summary
collapse
Methods inherited from Command
#accept_args, #effective_targets, #initialize, #option_comment, #option_graphical, #option_recurse, #report, #specified_targets
Methods included from Utils
#mkpath
Instance Method Details
#execute ⇒ Object
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
# File 'lib/basketcase/ls_command.rb', line 33
def execute
args = ''
args += ' -recurse' if @recursive
args += ' -directory' if @directory_only
cleartool("ls #{args} #{effective_targets}") do |line|
case line
when /^(.+)@@(\S+) \[hijacked/
report(:HIJACK, mkpath($1), $2)
when /^(.+)@@(\S+) \[loaded but missing\]/
report(:MISSING, mkpath($1), $2)
when /^(.+)@@\S+\\CHECKEDOUT(?: from (\S+))?/
element_path = mkpath($1)
status = element_path.exist? ? :CO : :MISSING
report(status, element_path, $2 || 'new')
when /^(.+)@@(\S+) +Rule: /
next unless @include_all
report(:OK, mkpath($1), $2)
when /^(.+)/
path = mkpath($1)
if ignored?(path)
log_debug "ignoring #{path}"
next
end
report(:LOCAL, path)
else
cannot_deal_with line
end
end
end
|
#help ⇒ Object
9
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/basketcase/ls_command.rb', line 9
def help
<<EOF
List element status.
-a(ll) Show all files.
(by default, up-to-date files are not reported)
-r(ecurse) Recursively list sub-directories.
(by default, just lists current directory)
EOF
end
|
#option_all ⇒ Object
Also known as:
option_a
21
22
23
|
# File 'lib/basketcase/ls_command.rb', line 21
def option_all
@include_all = true
end
|
#option_directory ⇒ Object
Also known as:
option_d
27
28
29
|
# File 'lib/basketcase/ls_command.rb', line 27
def option_directory
@directory_only = true
end
|
#synopsis ⇒ Object
5
6
7
|
# File 'lib/basketcase/ls_command.rb', line 5
def synopsis
"[<element> ...]"
end
|