Code to rake in the specs with the wiki

Ace Suares ace at suares.an
Fri Jul 24 15:56:37 UTC 2009



this is ruby with the Hpricot gem.

gem install Hpricot

code:

require 'rubygems'
require 'hpricot'
require 'open-uri'

# fetch the overview
doc = Hpricot(open("https://wiki.edubuntu.org/CategoryEdubuntuSpec"))

# use only the class searchresults
result = doc/"div.searchresults"
(result/"a").each do |a|
   # hack instead of error handling.
   if not a.attributes['href'] == 
"/CategoryEdubuntuSpec?highlight=%28CategoryEdubuntuSpec%29" and not 
a.attributes['href'] == 
"/DedicatedLTSPSSH?highlight=%28CategoryEdubuntuSpec%29" and not 
a.attributes['href'] == 
"/EdubuntuCleanupEffort?highlight=%28CategoryEdubuntuSpec%29"
    puts a # print the link
    # open the linked document
    doc = Hpricot(open("https://wiki.edubuntu.org" + 
a.attributes['href']))
    spec = doc/"a.interwiki" # interwiki is generated by 
UbuntuSpec:name-of-spec
    # open the spec
    doc = Hpricot(open( spec[0].attributes['href'] ))
    status = doc/"table.summary" # spec status is nicely held in summary 
table
    puts status
    puts "<BR /><BR />"
  end
end





More information about the edubuntu-devel mailing list