whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sebastian Bazley <s...@apache.org>
Subject [whimsy.git] [1/1] Commit da32233: Script to generate committer JSON data
Date Fri, 22 Jan 2016 17:41:43 GMT
Commit da32233072f344e76f043be0dc5a62cd49de80da:
    Script to generate committer JSON data


Branch: refs/heads/master
Author: Sebb <sebb@apache.org>
Committer: Sebb <sebb@apache.org>
Pusher: sebb <sebb@apache.org>

------------------------------------------------------------
www/roster/public_ldap_committers.rb                         | +++++++++ 
------------------------------------------------------------
70 changes: 70 additions, 0 deletions.
------------------------------------------------------------


diff --git a/www/roster/public_ldap_committers.rb b/www/roster/public_ldap_committers.rb
new file mode 100644
index 0000000..37b3fb9
--- /dev/null
+++ b/www/roster/public_ldap_committers.rb
@@ -0,0 +1,70 @@
+# Creates JSON output with the following format:
+#
+# {
+#   "last_updated": "2016-01-20 00:47:45 UTC",
+#   "git_info": "9d1cefc  2016-01-22T11:44:14+00:00",
+#   "committers": { // committers who have valid login shells
+#     "uid": "Public Name",
+#     ...
+#   },
+#   "committers_nologin": { // committers with invalid login shells
+#     "uid": "Public Name",
+#     ...
+#   },
+#   "non_committers": { // entries in 'ou=people,dc=apache,dc=org' who are not committers
+#     "uid": "Public Name",
+#     ...
+# }
+#
+
+require 'bundler/setup'
+
+require 'whimsy/asf'
+
+GITINFO = ASF.library_gitinfo rescue '?'
+
+# parse arguments for output file name
+if ARGV.length == 0 or ARGV.first == '-'
+  output = STDOUT
+else
+  output = File.open(ARGV.first, 'w')
+end
+
+ldap = ASF.init_ldap
+exit 1 unless ldap
+
+# gather committer info
+ids = {}
+# banned or deceased or emeritus or ...
+ban = {}
+# people entries that are not committers (and not in nologin)
+non = {}
+
+peeps = ASF::Person.preload('loginShell',{}) # needed for the banned? method
+
+ASF.committers.sort_by {|a| a.id}.each do |entry|
+    if entry.banned?
+        ban[entry.id] = entry.public_name 
+    else
+        ids[entry.id] = entry.public_name 
+    end
+end
+
+peeps.sort_by {|a| a.name}.each do |e|
+  if ASF.committers.include? e
+  else
+      non[e.name] = e.public_name
+  end
+end
+
+info = {
+  last_updated: ASF::ICLA.svn_change,
+  git_info: GITINFO,
+  committers: ids,
+  committers_nologin: ban,
+  non_committers: non,
+}
+
+# output results
+output.puts JSON.pretty_generate(info)
+output.close

Mime
View raw message