You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by ru...@apache.org on 2017/10/27 00:45:37 UTC

[whimsy] branch master updated: insert new projects into assigned quarterly reporting periods

This is an automated email from the ASF dual-hosted git repository.

rubys pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git


The following commit(s) were added to refs/heads/master by this push:
     new bbda51a  insert new projects into assigned quarterly reporting periods
bbda51a is described below

commit bbda51a778e92a9d919e2e8e5984230633ddacb0
Author: Sam Ruby <ru...@intertwingly.net>
AuthorDate: Thu Oct 26 20:44:35 2017 -0400

    insert new projects into assigned quarterly reporting periods
---
 lib/whimsy/asf/committee.rb | 50 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)

diff --git a/lib/whimsy/asf/committee.rb b/lib/whimsy/asf/committee.rb
index a612f68..b28c131 100644
--- a/lib/whimsy/asf/committee.rb
+++ b/lib/whimsy/asf/committee.rb
@@ -215,6 +215,56 @@ module ASF
 
     # insert (replacing if necessary) a new committee into committee-info.txt
     def self.establish(contents, pmc, date, people)
+      ########################################################################
+      #         insert into assigned quarterly reporting periods             #
+      ########################################################################
+
+      # split into blocks
+      blocks = contents.split("\n\n")
+
+      # find the reportings schedules
+      index =  blocks.find_index {|section| section =~/January/}
+
+      # extract reporting schedules
+      slots = [
+	blocks[index+0].split("\n"),
+	blocks[index+1].split("\n"),
+	blocks[index+2].split("\n"),
+      ]
+
+      # ensure that spacing is uniform
+      slots.each {|slot| slot.unshift '' unless slot[0] == ''}
+
+      # determine tie breakers between months of the same length
+      preference = [(date.month)%3, (date.month-1)%3, (date.month-2)%3]
+
+      # pick the month with the shortest list
+      slot = (0..2).map {|i| [slots[i].length, preference, i]}.min.last
+
+      # temporarily remove headers
+      headers = slots[slot].shift(3)
+
+      # insert pmc into the reporting schedule
+      slots[slot] << "    " + pmc
+
+      # sort entries, case insensitive
+      slots[slot].sort_by!(&:downcase)
+
+      #restore headers
+      slots[slot].unshift *headers
+
+      # re-insert reporting schedules
+      blocks[index+0] = slots[0].join("\n")
+      blocks[index+1] = slots[1].join("\n")
+      blocks[index+2] = slots[2].join("\n")
+
+      # re-attach blocks
+      contents = blocks.join("\n\n")
+
+      ########################################################################
+      #         insert into COMMITTEE MEMBERSHIP AND CHANGE PROCESS          #
+      ########################################################################
+
       # split into foot, sections (array) and head
       foot = contents[/^=+\s*\Z/]
       contents.sub! /^=+\s*\Z/, ''

-- 
To stop receiving notification emails like this one, please contact
['"commits@whimsical.apache.org" <co...@whimsical.apache.org>'].