summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xprojects/devdashboard/devdashboard.rb52
-rw-r--r--projects/devdashboard/developer.rb44
-rw-r--r--projects/devdashboard/herds.rb41
-rw-r--r--projects/devdashboard/userinfo.rb40
4 files changed, 133 insertions, 44 deletions
diff --git a/projects/devdashboard/devdashboard.rb b/projects/devdashboard/devdashboard.rb
index aeaae68..0d02f0c 100755
--- a/projects/devdashboard/devdashboard.rb
+++ b/projects/devdashboard/devdashboard.rb
@@ -12,48 +12,20 @@ include UserInfo
include PlanetIniParser
include MetadataHelper
-dev = Developer.new
-dev.handle = ARGV[0]
+#dev = Developer.new
+#
+#UserInfo.updateDev(dev)
+#Herds.updateDev(dev)
+#MetadataHelper.updateDev(dev)
+#PlanetIniParser.updateDev(dev)
+#dev.documentation = findDocumentation(dev.email)
-UserInfo.updateDev(dev)
-Herds.updateDev(dev)
-MetadataHelper.updateDev(dev)
-PlanetIniParser.updateDev(dev)
-dev.documentation = findDocumentation(dev.email)
+developers = UserInfo.indexUsers()
+herds = Herds.indexHerds(developers)
-
-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}"
-puts "Forums Profile: #{dev.forumsProfile}"
-puts "Packages:"
-unless dev.packages.nil?
- dev.packages.each { |package| puts "\t#{package}" }
+developers.each do |email, dev|
+ dev.print
+ puts
end
-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 4856137..52ba3db 100644
--- a/projects/devdashboard/developer.rb
+++ b/projects/devdashboard/developer.rb
@@ -4,10 +4,12 @@ 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
+ attr_reader :name, :handle, :blogRss, :pgpkey, :email, :joined, :birthday, :roles, :location, :herds, :hackergotchi, :forumsHandle, :documentation, :packages, :status
+ attr_writer :name, :handle, :blogRss, :pgpkey, :email, :joined, :birthday, :roles, :location, :herds, :hackergotchi, :forumsHandle, :documentation, :packages, :status
def initialize()
+ self.herds = Array.new
+ self.packages = Array.new
end
def ciaRss()
@@ -48,4 +50,42 @@ class Developer
def blogItems()
parseRssForItems(self.blogRss)
end
+
+ def print()
+ puts "Name: #{self.name}" unless self.name.nil?
+ puts "Username: #{self.handle}"
+ puts "Status: #{self.status}"
+ puts "Email: #{self.email}"
+ puts "PGP Key: #{self.pgpkey}" unless self.pgpkey.nil?
+ puts "Roles: #{self.roles}" unless self.roles.nil?
+ unless self.herds.empty?
+ puts "Herds: "
+ self.herds.each { |herd| puts "\t#{herd.name}"}
+ end
+ puts "Joined: #{self.joined}" unless self.joined.nil?
+ puts "Birthday: #{self.birthday}" unless self.birthday.nil?
+ puts "Location: #{self.location}" unless self.location.nil?
+ unless self.blogRss.nil?
+ puts "Blog RSS: #{self.blogRss}"
+ puts "Blog Posts: "
+ self.blogItems.each { |item| puts "\t#{item.title}" }
+ puts "Hackergotchi: #{self.hackergotchi}" unless self.hackergotchi.nil?
+ end
+ #puts "Commits RSS: #{self.ciaRss}"
+ #puts "Commits: "
+ #self.commitItems.each { |item| puts "\t#{item.title}" }
+ #puts "Bugs RSS: #{self.myBugsRss}"
+ puts "Forums Profile: #{self.forumsProfile}"
+ unless self.packages.empty?
+ puts "Packages:"
+ self.packages.each { |package| puts "\t#{package}" }
+ end
+
+ unless self.documentation.nil?
+ puts "Documentation:"
+ self.documentation.each do |doc|
+ puts "\t#{doc.title} : #{doc.role}"
+ end
+ end
+ end
end
diff --git a/projects/devdashboard/herds.rb b/projects/devdashboard/herds.rb
index 06669d9..e8dec6b 100644
--- a/projects/devdashboard/herds.rb
+++ b/projects/devdashboard/herds.rb
@@ -1,6 +1,47 @@
#!/usr/bin/ruby -w
module Herds
+ class Herd
+ attr_reader :name, :description, :email, :packages, :developers
+ attr_writer :name, :description, :email, :packages, :developers
+ def initialize(name)
+ self.name = name
+ self.packages = []
+ self.developers = []
+ end
+ end
+
+ def Herds.indexHerds(developers)
+ herdsxml = '/local/home/checkouts/gentoo-website/xml/htdocs/proj/en/metastructure/herds/herds.xml'
+ file = File.new(herdsxml)
+ doc = Document.new(file)
+ root = doc.root
+
+ root.elements.each('herd') do |herdnode|
+ namenode = herdnode.elements['name']
+ emailnode = herdnode.elements['email']
+ descriptionnode = herdnode.elements['description']
+ projectnode = herdnode.elements['maintainingproject']
+
+ herd = Herd.new(namenode.text)
+ herd.email = emailnode.text unless emailnode.nil?
+ herd.description = descriptionnode.text unless descriptionnode.nil?
+
+ # look for maintainers if not part of a project
+ if projectnode.nil?
+ herdnode.elements.each('maintainer') do |maintainer|
+ email = maintainer.elements['email'].text
+ developer = developers[email]
+ unless developer.nil?
+ developer.herds.push(herd)
+ herd.developers.push(developer)
+ end
+ end
+# else
+ end
+ end
+ end
+
def Herds.getHerdsForDev(handle)
line = nil
IO.popen("herdstat -n -q -d #{handle}") do |pipe|
diff --git a/projects/devdashboard/userinfo.rb b/projects/devdashboard/userinfo.rb
index f508f4e..9f71223 100644
--- a/projects/devdashboard/userinfo.rb
+++ b/projects/devdashboard/userinfo.rb
@@ -3,10 +3,46 @@ require 'rexml/document'
include REXML
module UserInfo
- def UserInfo.parse(handle)
+ def UserInfo.indexUsers()
+ developers = {}
+ root = UserInfo.getRoot()
+
+ root.elements.each('user') do |usernode|
+ developer = Developer.new
+
+ developer.handle = usernode.attributes['username']
+ developer.name = usernode.elements["realname"].attributes["fullname"]
+ developer.pgpkey = usernode.elements["pgpkey"].text
+ developer.email = usernode.elements["email"].text
+ developer.joined = usernode.elements["joined"].text
+# developer.birthday = user.elements["birthday"].text
+ rolesnode = usernode.elements["roles"]
+ developer.roles = rolesnode.text unless rolesnode.nil?
+
+ statusnode = usernode.elements['status']
+ if statusnode.nil?
+ developer.status = 'active'
+ else
+ developer.status = statusnode.text
+ end
+
+ locationnode = usernode.elements["location"]
+ developer.location = locationnode.text unless locationnode.nil?
+
+ developers[developer.email] = developer
+ end
+ return developers
+ end
+
+ def UserInfo.getRoot()
file = File.new('/local/home/checkouts/gentoo-website/xml/htdocs/proj/en/devrel/roll-call/userinfo.xml')
doc = Document.new(file)
- root = doc.root
+
+ return doc.root
+ end
+
+ def UserInfo.parse(handle)
+ root = UserInfo.getRoot()
user = root.elements["user[@username='" + handle + "']"]
return user
end