diff options
author | 2006-08-13 21:48:59 +0000 | |
---|---|---|
committer | 2006-08-13 21:48:59 +0000 | |
commit | 367625d591fce4afd4fc11e89bdbf4f341d3585a (patch) | |
tree | 8531c47cd345ed55f0f484d39f9834e4a03a09d1 | |
parent | Adding gentoolkit-nichoj (diff) | |
download | nichoj-367625d591fce4afd4fc11e89bdbf4f341d3585a.tar.gz nichoj-367625d591fce4afd4fc11e89bdbf4f341d3585a.tar.bz2 nichoj-367625d591fce4afd4fc11e89bdbf4f341d3585a.zip |
Added devdashboard
svn path=/; revision=52
-rwxr-xr-x | projects/devdashboard/devdashboard.rb | 42 | ||||
-rw-r--r-- | projects/devdashboard/developer.rb | 39 | ||||
-rw-r--r-- | projects/devdashboard/herds.rb | 15 | ||||
-rwxr-xr-x | projects/devdashboard/planetiniparser.rb | 35 | ||||
-rw-r--r-- | projects/devdashboard/userinfo.rb | 35 |
5 files changed, 166 insertions, 0 deletions
diff --git a/projects/devdashboard/devdashboard.rb b/projects/devdashboard/devdashboard.rb new file mode 100755 index 0000000..9bcc449 --- /dev/null +++ b/projects/devdashboard/devdashboard.rb @@ -0,0 +1,42 @@ +#!/usr/bin/ruby -w + +require 'developer.rb' +require 'herds.rb' +require 'userinfo.rb' +require 'planetiniparser.rb' + +include Herds +include UserInfo +include PlanetIniParser + +dev = Developer.new +dev.handle = ARGV[0] +#dev.handle = 'nichoj' + +UserInfo.updateDev(dev) +Herds.updateDev(dev) +PlanetIniParser.updateDev(dev) + + +puts "Name: #{dev.name}" +puts "Username: #{dev.handle}" +puts "Email: #{dev.email}" +puts "PGP Key: #{dev.pgpkey}" +puts "Roles: #{dev.roles}" +unless dev.herds.nil? + puts "Herds: " + dev.herds.each { |herd| puts "\t#{herd}"} +end +puts "Joined: #{dev.joined}" +puts "Birthday: #{dev.birthday}" unless dev.birthday.nil? +puts "Location: #{dev.location}" +unless dev.blogRss.nil? + puts "Blog RSS: #{dev.blogRss}" + puts "Blog Posts: " + dev.blogItems.each { |item| puts "\t#{item.title}" } + puts "Hackergotchi: #{dev.hackergotchi}" unless dev.hackergotchi.nil? +end +puts "Commits RSS: #{dev.ciaRss}" +puts "Commits: " +dev.commitItems.each { |item| puts "\t#{item.title}" } +puts "Bugs RSS: #{dev.myBugsRss}" diff --git a/projects/devdashboard/developer.rb b/projects/devdashboard/developer.rb new file mode 100644 index 0000000..82e0766 --- /dev/null +++ b/projects/devdashboard/developer.rb @@ -0,0 +1,39 @@ +#!/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 + attr_writer :name, :handle, :blogRss, :pgpkey, :email, :joined, :birthday, :roles, :location, :herds, :hackergotchi + + def initialize() + end + + def ciaRss() + return "http://cia.navi.cx/stats/author/#{self.handle}/.rss" + 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 diff --git a/projects/devdashboard/herds.rb b/projects/devdashboard/herds.rb new file mode 100644 index 0000000..06669d9 --- /dev/null +++ b/projects/devdashboard/herds.rb @@ -0,0 +1,15 @@ +#!/usr/bin/ruby -w + +module Herds + def Herds.getHerdsForDev(handle) + line = nil + IO.popen("herdstat -n -q -d #{handle}") do |pipe| + line = pipe.gets + end + line.split + end + + def Herds.updateDev(developer) + developer.herds = Herds.getHerdsForDev(developer.handle) + end +end diff --git a/projects/devdashboard/planetiniparser.rb b/projects/devdashboard/planetiniparser.rb new file mode 100755 index 0000000..051db56 --- /dev/null +++ b/projects/devdashboard/planetiniparser.rb @@ -0,0 +1,35 @@ +#!/usr/bin/ruby -w + +require 'open-uri' +require 'pp' + +module PlanetIniParser + + def PlanetIniParser.updateDev(developer) + planetUri = "http://sources.gentoo.org/viewcvs.py/*checkout*/planet/configs/planet.ini?rev=176" + open(planetUri) do |file| + while line = file.gets do + if line =~ /^\[(.*)\]$/ + url = $1 + next if url == "Planet" or url == "DEFAULT" + + data = {} + while line = file.gets do + line.chomp! + break if line == "" + line =~ /(.*) = (.*)/ + data[$1] = $2 + end + + if data['username'] == developer.handle + if ! data['face'].nil? + developer.hackergotchi = "http://planet.gentoo.org/images/#{data['face']}" + end + developer.blogRss = url + end + end + end + end + +end +end diff --git a/projects/devdashboard/userinfo.rb b/projects/devdashboard/userinfo.rb new file mode 100644 index 0000000..baa0f52 --- /dev/null +++ b/projects/devdashboard/userinfo.rb @@ -0,0 +1,35 @@ +#!/usr/bin/ruby -w +require 'rexml/document' +include REXML + +module UserInfo + def UserInfo.parse(handle) + file = File.new('/home/jnichols/checkouts/gentoo/xml/htdocs/proj/en/devrel/roll-call/userinfo.xml') + doc = Document.new(file) + root = doc.root + user = root.elements["user[@username='" + handle + "']"] + return user + end + + def UserInfo.dump(handle) + user = UserInfo.parse(handle) + puts "username = " + user.attributes["username"] + puts "realname = " + user.elements["realname"].attributes["fullname"] + puts "pgpkey = " + user.elements["pgpkey"].text + puts "email = " + user.elements["email"].text + puts "joined = " + user.elements["joined"].text +# puts "birthday = " + user.elements["birthday"].text + puts "roles = " + user.elements["roles"].text + puts "location = " + user.elements["location"].text + end + def UserInfo.updateDev(developer) + user = UserInfo.parse(developer.handle) + developer.name = user.elements["realname"].attributes["fullname"] + developer.pgpkey = user.elements["pgpkey"].text + developer.email = user.elements["email"].text + developer.joined = user.elements["joined"].text +# developer.birthday = user.elements["birthday"].text + developer.roles = user.elements["roles"].text + developer.location =user.elements["location"].text + end +end |