diff options
author | Joshua Nichols <nichoj@gentoo.org> | 2006-08-14 01:29:24 +0000 |
---|---|---|
committer | Joshua Nichols <nichoj@gentoo.org> | 2006-08-14 01:29:24 +0000 |
commit | fe6a2684688bd68a0b47193b7ff47df604dbbf3a (patch) | |
tree | 6db0de733f26323ff2d02bb6c44383eb148bc901 | |
parent | Added devdashboard (diff) | |
download | nichoj-fe6a2684688bd68a0b47193b7ff47df604dbbf3a.tar.gz nichoj-fe6a2684688bd68a0b47193b7ff47df604dbbf3a.tar.bz2 nichoj-fe6a2684688bd68a0b47193b7ff47df604dbbf3a.zip |
Added forum stuff. Added documentation stuff.
svn path=/; revision=53
-rwxr-xr-x | projects/devdashboard/devdashboard.rb | 10 | ||||
-rw-r--r-- | projects/devdashboard/developer.rb | 16 | ||||
-rw-r--r-- | projects/devdashboard/docparser.rb | 58 |
3 files changed, 82 insertions, 2 deletions
diff --git a/projects/devdashboard/devdashboard.rb b/projects/devdashboard/devdashboard.rb index 9bcc449..f868688 100755 --- a/projects/devdashboard/devdashboard.rb +++ b/projects/devdashboard/devdashboard.rb @@ -3,6 +3,7 @@ require 'developer.rb' require 'herds.rb' require 'userinfo.rb' +require 'docparser.rb' require 'planetiniparser.rb' include Herds @@ -16,6 +17,7 @@ dev.handle = ARGV[0] UserInfo.updateDev(dev) Herds.updateDev(dev) PlanetIniParser.updateDev(dev) +dev.documentation = findDocumentation(dev.email) puts "Name: #{dev.name}" @@ -40,3 +42,11 @@ puts "Commits RSS: #{dev.ciaRss}" puts "Commits: " dev.commitItems.each { |item| puts "\t#{item.title}" } puts "Bugs RSS: #{dev.myBugsRss}" +puts "Forums Profile: #{dev.forumsProfile}" + +unless dev.documentation.nil? + puts "Documentation:" + dev.documentation.each do |doc| + puts "\t#{doc.title} : #{doc.role}" + end +end diff --git a/projects/devdashboard/developer.rb b/projects/devdashboard/developer.rb index 82e0766..ea7bd40 100644 --- a/projects/devdashboard/developer.rb +++ b/projects/devdashboard/developer.rb @@ -4,8 +4,8 @@ require 'rss/2.0' require 'open-uri' class Developer - attr_reader :name, :handle, :blogRss, :pgpkey, :email, :joined, :birthday, :roles, :location, :herds, :hackergotchi - attr_writer :name, :handle, :blogRss, :pgpkey, :email, :joined, :birthday, :roles, :location, :herds, :hackergotchi + attr_reader :name, :handle, :blogRss, :pgpkey, :email, :joined, :birthday, :roles, :location, :herds, :hackergotchi, :forumsHandle, :documentation + attr_writer :name, :handle, :blogRss, :pgpkey, :email, :joined, :birthday, :roles, :location, :herds, :hackergotchi, :forumsHandle, :documentation def initialize() end @@ -14,6 +14,18 @@ class Developer 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 diff --git a/projects/devdashboard/docparser.rb b/projects/devdashboard/docparser.rb new file mode 100644 index 0000000..22ed7cc --- /dev/null +++ b/projects/devdashboard/docparser.rb @@ -0,0 +1,58 @@ +#!/usr/bin/ruby -w +require 'rexml/document' +require 'find' + +include REXML + +def isXml? (filename) + filename =~ /\.xml$/ +end + +class Documentation + attr_reader :role, :title, :uri + attr_writer :role, :title, :uri + def initialize(role, title, uri) + self.role = role + self.title = title + self.uri = uri + end +end + +def findDocumentation(target) + documents = [] + Find.find("/home/jnichols/checkouts/gentoo/xml/htdocs") do |filename| + if isXml? filename + file = File.new(filename) + begin + doc = Document.new(file) + + root = doc.root + title_text = nil + case doc.doctype.system + when "/dtd/guide.dtd": + title = root.elements['title'] + title_text = title.text unless title.nil? + + when "/dtd/project.dtd": + longname = root.elements['longname'] + title_text = longname.text unless longname.nil? + else next + end + + + root.elements.each('author') do |author| + role = author.attributes['title'] + email = author.elements['mail'].attributes['link'] + if email == target + documents.push Documentation.new(role, title_text, filename) + end + end + rescue Exception + # catching all exceptions probably is bad :) + end + end + Find.prune if filename =~ /CVS/ + end + + return documents +end |