Class: DarcsReporter

Inherits:
MotiroReporter show all
Defined in:
app/reporters/darcs_reporter.rb

Instance Method Summary collapse

Methods inherited from MotiroReporter

add, button, #buttons, #cache?, caching, #channel_title, #latest_headline, #name, #params_for, reporter_name, title

Constructor Details

#initialize(conn = DarcsConnection.new) ⇒ DarcsReporter



26
27
28
# File 'app/reporters/darcs_reporter.rb', line 26

def initialize(conn=DarcsConnection.new)
  @connection = conn
end

Instance Method Details

#author_from_darcs_id(id) ⇒ Object



43
44
45
46
# File 'app/reporters/darcs_reporter.rb', line 43

def author_from_darcs_id(id)
  md = id.match(/@/)
  return md.pre_match if md
end

#headline(rid) ⇒ Object



39
40
41
# File 'app/reporters/darcs_reporter.rb', line 39

def headline(rid)
  parse_headlines(@connection.changes(rid)).first
end

#headlinesObject



35
36
37
# File 'app/reporters/darcs_reporter.rb', line 35

def headlines
  parse_headlines(@connection.changes(:all))
end

#latest_headlines(rid = '') ⇒ Object



30
31
32
33
# File 'app/reporters/darcs_reporter.rb', line 30

def latest_headlines(rid='')
  @connection.pull
  parse_headlines(@connection.changes)
end

#time_from_darcs_date(date) ⇒ Object



48
49
50
51
52
# File 'app/reporters/darcs_reporter.rb', line 48

def time_from_darcs_date(date)
  md = date.match(/(\d\d\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)/)
  nums = md[1..6].collect do |s| s.to_i end
  Time.utc(nums[0], nums[1], nums[2], nums[3], nums[4], nums[5], nums[6])
end