You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by Sam Ruby <ru...@apache.org> on 2015/12/08 15:49:50 UTC
[whimsy.git] [1/1] Commit 2df57e1: add reporting to podling information
Commit 2df57e1c3c432d26b8fed507ed5cf40f65969739:
add reporting to podling information
Branch: refs/heads/master
Author: Sam Ruby <ru...@intertwingly.net>
Committer: Sam Ruby <ru...@intertwingly.net>
Pusher: rubys <ru...@apache.org>
------------------------------------------------------------
lib/whimsy/asf/podlings.rb | +++++++++++++
------------------------------------------------------------
25 changes: 25 additions, 0 deletions.
------------------------------------------------------------
diff --git a/lib/whimsy/asf/podlings.rb b/lib/whimsy/asf/podlings.rb
index 5108b4e..bf1e26a 100644
--- a/lib/whimsy/asf/podlings.rb
+++ b/lib/whimsy/asf/podlings.rb
@@ -5,13 +5,38 @@ 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']}
}