class ASF::Site

A list of ASF sites, formed by parsing asf/infrastructure/site/trunk/content from svn.

Public Class Methods

find(committee) click to toggle source

find the site for a give committee.

# File lib/whimsy/asf/site.rb, line 93
def self.find(committee)
  committee = committee.name if ASF::Committee == committee
  list[committee]
end
list() click to toggle source

a Hash of all sites. Keys are the committee names. Values are a hash with :link, and <tt>:text<tt> values.

# File lib/whimsy/asf/site.rb, line 57
def self.list
  templates = ASF::SVN['asf/infrastructure/site/trunk/content']
  file = "#{templates}/index.html"
  if not File.exist?(file)
    Wunderbar.error "Unable to find 'infrastructure/site/trunk/content'"
    return {}
  end
  return @@list if not @@list.empty? and File.mtime(file) == @@mtime
  @@mtime = File.mtime(file)

  @@list = @@default

  Committee.load_committee_info
  doc = Nokogiri::HTML.parse(File.read(file))
  list = doc.at("#by_name")
  if list
    list.search('a').each do |a|
      @@list[Committee.find(a.text).name] = 
        {link: a['href'], text: a['title']}
    end
  end

  list = doc.at("#by_category")
  if list
    list.search('a').each do |a|
      if a['title']
        @@list[Committee.find(a.text).name] = 
          {link: a['href'], text: a['title']}
      end
    end
  end

  @@list
end