Sha256: 77c91c5822218b13e54088830987ee769ea358bc75e663bd0a61334cdaa99dd9

Contents?: true

Size: 1.48 KB

Versions: 8

Compression:

Stored size: 1.48 KB

Contents

require 'nokogiri'
require_relative '../asf'

module ASF
  class Podlings
    include Enumerable

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

    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
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
whimsy-asf-0.0.76 lib/whimsy/asf/podlings.rb
whimsy-asf-0.0.75 lib/whimsy/asf/podlings.rb
whimsy-asf-0.0.74 lib/whimsy/asf/podlings.rb
whimsy-asf-0.0.73 lib/whimsy/asf/podlings.rb
whimsy-asf-0.0.72 lib/whimsy/asf/podlings.rb
whimsy-asf-0.0.71 lib/whimsy/asf/podlings.rb
whimsy-asf-0.0.70 lib/whimsy/asf/podlings.rb
whimsy-asf-0.0.69 lib/whimsy/asf/podlings.rb