summaryrefslogtreecommitdiff
blob: 4856137851dc9a14b617577bfa3156dc9462568f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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
#!/usr/bin/ruby -w

require 'rss/2.0'
require 'open-uri'

class Developer
    attr_reader :name, :handle, :blogRss, :pgpkey, :email, :joined, :birthday, :roles, :location, :herds, :hackergotchi, :forumsHandle, :documentation, :packages
    attr_writer :name, :handle, :blogRss, :pgpkey, :email, :joined, :birthday, :roles, :location, :herds, :hackergotchi, :forumsHandle, :documentation, :packages

    def initialize()
    end

    def ciaRss()
        return "http://cia.navi.cx/stats/author/#{self.handle}/.rss"
    end

    def forumsProfile()
        myhandle = self.forumsHandle
        myhandle = self.handle if myhandle.nil?
        "http://forums.gentoo.org/profile.php?mode=viewprofile&u=#{myhandle}"
    end

    def forumsPosts()
        myhandle = self.forumsHandle
        myhandle = self.handle if myhandle.nil?
        "http://forums.gentoo.org/search.php?search_author=#{myhandle}"
    end

    def myBugsRss()
        "http://bugs.gentoo.org/buglist.cgi?query_format=advanced&short_desc_type=allwordssubstr&short_desc=&long_desc_type=substring&long_desc=&bug_file_loc_type=allwordssubstr&bug_file_loc=&status_whiteboard_type=allwordssubstr&status_whiteboard=&keywords_type=allwords&keywords=&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&emailreporter1=1&emailtype1=exact&email1=#{self.handle}%40gentoo.org&emailassigned_to2=1&emailreporter2=1&emailcc2=1&emailtype2=substring&email2=&bugidtype=include&bug_id=&chfieldfrom=&chfieldto=Now&chfieldvalue=&query_based_on=My%20Open%20Bugs&field0-0-0=noop&type0-0-0=noop&value0-0-0=&ctype=rss"
    end

    def parseRssForItems(feed)
        items = nil
        open(feed) do |http|
            rss_source = http.read
            rss = RSS::Parser.parse(rss_source, true)
            if rss.nil?
                rss = RSS::Parser.parse(rss_source, true, false)
            end
            items = rss.items
        end
        return items
    end
    def commitItems()
        parseRssForItems(self.ciaRss)
    end
    def blogItems()
        parseRssForItems(self.blogRss)
    end
end