Class: ASF::Podlings

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/whimsy/asf/podlings.rb

Instance Method Summary collapse

Instance Method Details

#eachObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/whimsy/asf/podlings.rb', line 16

def each
  incubator_content = ASF::SVN['asf/incubator/public/trunk/content']
  podlings = Nokogiri::XML(File.read("#{incubator_content}/podlings.xml"))
  podlings.search('podling').map do |node|

    reporting = node.at('reporting')
    if reporting
      group = reporting['group']
      monthly = reporting.text.split(/,\s*/) if reporting['monthly']
      reporting = %w(January April July October) if group == '1'
      reporting = %w(February May August November) if group == '2'
      reporting = %w(March June September December) if group == '3'
      reporting.rotate! until quarter.include? reporting.first

      if monthly
        monthly.shift until monthly.empty? or quarter.include? monthly.first
        reporting = (monthly + reporting).uniq
      end
    end

    data = {
      name: node['name'],
      status: node['status'],
      reporting: reporting,
      description: node.at('description').text,
      mentors: node.search('mentor').map {|mentor| mentor['username']}
    }
    data[:champion] = node.at('champion')['availid'] if node.at('champion')
    yield node['resource'], data
  end
end

#quarterObject



8
9
10
11
12
13
14
# File 'lib/whimsy/asf/podlings.rb', line 8

def quarter
  [
    Date.today.strftime('%B'),
    Date.today.next_month.strftime('%B'),
    Date.today.next_month.next_month.strftime('%B')
  ]
end