class ASF::Petri

Attributes

description[R]
error[RW]
id[R]
issues[R]
licensing[R]
mailinglists[R]
mentors[R]
name[R]
release[R]
repository[R]
status[R]
website[R]
wiki[R]

Public Class Methods

list() click to toggle source

Array of all Petri culture entries

# File lib/whimsy/asf/petri.rb, line 34
def self.list
  @list = []
  response = Net::HTTP.get_response(URI(PETRI_INFO))
  response.value() # Raises error if not OK
  yaml = YAML.safe_load(response.body, permitted_classes: [Symbol])
  # @mentors = yaml['mentors']
  yaml['cultures'].each do |proj|
    prj = new(proj)
    if yaml['projects'].include? proj
      prj.error = 'Listed as a current project' unless prj.status == 'current'
    else
      prj.error = 'Not listed as a current project' if prj.status == 'current'
    end
    @list << prj
  end
  # Now check against projects listing
  yaml['projects'].each do |proj|
    unless yaml['cultures'].include? proj
      @list << new([proj,{name: '', status: '', error: 'No culture entry found'}])
    end
  end
  @list
end
new(entry) click to toggle source
# File lib/whimsy/asf/petri.rb, line 27
def initialize(entry)
  key, hash = entry
  @id = key
  hash.each { |name, value| instance_variable_set("@#{name}", value) }
end