Module: OmniFocus::Rubyforge

Defined in:
lib/omnifocus/rubyforge.rb

Constant Summary collapse

VERSION =
'1.1.0'
RF_URL =
"http://rubyforge.org"

Instance Method Summary collapse

Instance Method Details

#login_to_rubyforgeObject



15
16
17
18
19
20
21
22
# File 'lib/omnifocus/rubyforge.rb', line 15

def 
  m,  = mechanize, "/account/login.php"

  m.get("#{RF_URL}#{}").form_with(:action => ) do |f|
    f.form_loginname = rubyforge.userconfig["username"]
    f.form_pw        = rubyforge.userconfig["password"]
  end.click_button
end

#populate_rubyforge_tasksObject



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/omnifocus/rubyforge.rb', line 24

def populate_rubyforge_tasks
  home = 

  # nuke all the tracker links on "My Page" after "My Submitted Items"
  node = home.root.xpath('//tr[td[text() = "My Submitted Items"]]').first
  loop do
    prev, node = node, node.next
    prev.remove
    break unless node
  end

  group_ids = rubyforge.autoconfig["group_ids"].invert

  rubyforge_tickets = home.links_with(:href => /^.tracker/)
  rubyforge_tickets.each do |link|
    if link.href =~ /func=detail&aid=(\d+)&group_id=(\d+)&atid=(\d+)/ then
      ticket_id, group_id = "RF##{$1}", $2.to_i
      group = group_ids[group_id]

      next unless group

      if existing[ticket_id] then
        project = existing[ticket_id]
        bug_db[project][ticket_id] = true
        next
      end

      warn "scanning ticket RF##{ticket_id}"
      details = link.click.form_with :action => /^.tracker/
      select  = details.field_with   :name   => "category_id"
      project = select.selected_options.first
      project = project ? project.text.downcase : group
      project = group if project =~ /\s/
      title   = "#{ticket_id}: #{link.text}"
      url     = "#{RF_URL}/#{link.href}"

      bug_db[project][ticket_id] = [title, url]
    end
  end
end

#rubyforgeObject



7
8
9
10
11
12
13
# File 'lib/omnifocus/rubyforge.rb', line 7

def rubyforge
  unless defined? @rubyforge then
    @rubyforge = RubyForge.new
    @rubyforge.configure
  end
  @rubyforge
end