Module: Werk::Trac

Included in:
Base
Defined in:
lib/werk/trac.rb

Instance Method Summary collapse

Instance Method Details

#ticket_actions(ticket_id) ⇒ Object



28
29
30
31
# File 'lib/werk/trac.rb', line 28

def ticket_actions(ticket_id)
  setup_trac
  @trac.tickets.actions(ticket_id)
end

#ticket_annotate(ticket_id, comment, attributes = {}) ⇒ Object



33
34
35
36
# File 'lib/werk/trac.rb', line 33

def ticket_annotate(ticket_id, comment, attributes = {})
  setup_trac
  @trac.tickets.update ticket_id.to_i, comment, attributes, false
end

#ticket_list(*args) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/werk/trac.rb', line 6

def ticket_list(*args)
  setup_trac
  conditions = {}
  conditions[:owner] = @trac_user unless args.include? "--everyone"
  conditions[:status] = "!closed" unless args.include? "--all"
  @trac.tickets.query(conditions).each do |ticket_id|
    ticket_show(ticket_id, :oneline)
  end
end

#ticket_show(ticket_id, format = :long) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/werk/trac.rb', line 16

def ticket_show(ticket_id, format = :long)
  setup_trac
  ticket = ticket_get(ticket_id)
  case format
  when :long
    template = File.read(File.join(File.dirname(__FILE__), '..', '..', 'templates', 'ticket_show.erb'))
    ERB.new(template).result(ticket.send :binding)
  when :oneline
    "#{ticket.id}: #{ticket.summary} (#{ticket.status})"
  end
end