Class: Piston::Commands::Status
- Inherits:
-
Base
- Object
- Base
- Piston::Commands::Status
show all
- Defined in:
- lib/piston/commands/status.rb
Instance Attribute Summary
Attributes inherited from Base
#options
Instance Method Summary
collapse
Methods inherited from Base
#force, #guess_wc, #initialize, logger, #logger, #quiet, #verbose, #working_copy!
Instance Method Details
#run(wcdir) ⇒ Object
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/piston/commands/status.rb', line 6
def run(wcdir)
handler = guess_wc(wcdir).class
props = Hash.new
logger.debug {"Get info of #{wcdir}"}
working_copy = handler.new(wcdir)
working_copy.validate!
props.update(working_copy.info)
props[:locally_modified] = 'M' if working_copy.locally_modified
props[:remotely_modified] = 'M' if show_updates && working_copy.remotely_modified
printf "%1s%1s %6s %s (%s)\n", props[:locally_modified],
props[:remotely_modified], props["lock"] ? 'locked' : '', wcdir.to_s, props["repository_url"]
end
|
#show_updates ⇒ Object
24
25
26
|
# File 'lib/piston/commands/status.rb', line 24
def show_updates
options[:show_updates]
end
|
#start(*args) ⇒ Object
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/piston/commands/status.rb', line 28
def start(*args)
paths = args.flatten.map {|d| Pathname.new(d).expand_path}
paths = find_local_piston_folders if paths.empty?
paths.each do |wcdir|
begin
run(wcdir)
rescue Piston::WorkingCopy::NotWorkingCopy
puts "#{wcdir} is not a working copy"
end
end
end
|