Class: MetaProject::Tracker::Trac::TracTracker

Inherits:
Base
  • Object
show all
Includes:
DigitIssues
Defined in:
lib/meta_project/tracker/trac/trac_tracker.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from DigitIssues

command_pattern, #identifier_examples, issue_pattern, #markup

Methods inherited from Base

classes, #issue

Constructor Details

#initialize(trac_base_url = nil) ⇒ TracTracker

Returns a new instance of TracTracker.



9
10
11
# File 'lib/meta_project/tracker/trac/trac_tracker.rb', line 9

def initialize(trac_base_url=nil)
  @trac_base_url = trac_base_url
end

Instance Attribute Details

#trac_base_urlObject

Returns the value of attribute trac_base_url.



7
8
9
# File 'lib/meta_project/tracker/trac/trac_tracker.rb', line 7

def trac_base_url
  @trac_base_url
end

Instance Method Details

#materialize(issue) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/meta_project/tracker/trac/trac_tracker.rb', line 17

def materialize(issue)
  begin
    url = "#{@trac_base_url}/ticket/#{issue.identifier}"
    html = better_open(url).read
    summary = html[/Ticket ##{issue.identifier}\s*<\/h1>\s*<h2>([^<]*)<\/h2>/n, 1]
    issue.attributes[:summary] = summary
    issue.attributes[:url] = url
  rescue OpenURI::HTTPError => e
    STDERR.puts e.message
  end
  issue
end

#overviewObject



13
14
15
# File 'lib/meta_project/tracker/trac/trac_tracker.rb', line 13

def overview
  "#{@trac_base_url}/report"
end