Class: Git::Trac::Runner::Cleanup
- Inherits:
-
Base
- Object
- Base
- Git::Trac::Runner::Cleanup
show all
- Defined in:
- lib/git/trac/runner/cleanup.rb
Overview
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#abort, #add_local_option, command, #command, #each_attachment, #each_ticket_or_attachment, #fetch_or_abort, #fetch_unless_local, #initialize, #missing_argument, #one_attachment, #options, #parse_attachment, #repository, #system, #too_many_arguments
Class Method Details
.summary ⇒ Object
7
8
9
|
# File 'lib/git/trac/runner/cleanup.rb', line 7
def self.summary
"Remove old branches for a ticket"
end
|
Instance Method Details
#add_options(opts) ⇒ Object
24
25
26
27
28
29
30
31
32
|
# File 'lib/git/trac/runner/cleanup.rb', line 24
def add_options(opts)
opts.on("-a","--all", "cleanup all tickets") { options[:all] = true }
opts.on("--only-branches", "cleanup branches only, not remote heads") do |b|
options[:only_branches] = true
end
opts.on("--[no-]rebased","also cleanup rebased attachments") do |b|
options[:rebased] = b
end
end
|
#banner_arguments ⇒ Object
11
12
13
|
# File 'lib/git/trac/runner/cleanup.rb', line 11
def banner_arguments
"[options] [<attachment>...]"
end
|
#description ⇒ Object
15
16
17
18
19
20
21
22
|
# File 'lib/git/trac/runner/cleanup.rb', line 15
def description
<<-EOF
Remove remote heads for a given ticket (e.g., trac/12345/work.patch). Also
removes branches that point to one of these heads. Branches that have been
committed to will not be removed. The default is to target tickets that have
been closed, but you can also specify ticket numbers explicitly or use --all.
EOF
end
|
#run ⇒ Object
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/git/trac/runner/cleanup.rb', line 34
def run
if options[:all]
repository.working_tickets.each do |t|
t.cleanup(options)
end
elsif @argv.any?
each_ticket_or_attachment do |ticket_or_attachment|
ticket_or_attachment.cleanup(options)
end
else
repository.working_tickets.each do |t|
t.cleanup(options) unless t.open?
end
end
end
|