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 c2ed275: Scripts to create JSON for unix groups and committees
Date Fri, 22 Jan 2016 18:15:20 GMT
Commit c2ed275d8333d6dffa4bb563a1f3c555d2783d39:
    Scripts to create JSON for unix groups and committees


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

------------------------------------------------------------
www/roster/public_ldap_committees.rb                         | +++++++++++++ 
www/roster/public_ldap_groups.rb                             | +++++++++++++ 
------------------------------------------------------------
103 changes: 103 additions, 0 deletions.
------------------------------------------------------------


diff --git a/www/roster/public_ldap_committees.rb b/www/roster/public_ldap_committees.rb
new file mode 100644
index 0000000..72a0f22
--- /dev/null
+++ b/www/roster/public_ldap_committees.rb
@@ -0,0 +1,51 @@
+# 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",
+#   "committees": {
+#     "abdera": [
+#       "uid",
+#       ...
+#     ],
+#     ...
+#   },
+# }
+#
+
+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
+entries = {}
+
+ASF::Committee.list.sort_by {|a| a.name}.each do |entry|
+    m = []
+    entry.members.sort_by {|a| a.name}.each do |e|
+        m << e.name
+    end
+    entries[entry.name] = m
+end
+
+info = {
+  last_updated: ASF::ICLA.svn_change,
+  git_info: GITINFO,
+  committees: entries,
+}
+
+# output results
+output.puts JSON.pretty_generate(info)
+output.close
diff --git a/www/roster/public_ldap_groups.rb b/www/roster/public_ldap_groups.rb
new file mode 100644
index 0000000..e03d5c3
--- /dev/null
+++ b/www/roster/public_ldap_groups.rb
@@ -0,0 +1,52 @@
+# 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",
+#   "groups": {
+#     "abdera": [
+#       "uid",
+#       ...
+#     ],
+#     ...
+#   },
+# }
+#
+
+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
+entries = {}
+
+ASF::Group.list.sort_by {|a| a.name}.each do |entry|
+    next if entry.name == 'committers'
+    m = []
+    entry.members.sort_by {|a| a.name}.each do |e|
+        m << e.name
+    end
+    entries[entry.name] = m
+end
+
+info = {
+  last_updated: ASF::ICLA.svn_change,
+  git_info: GITINFO,
+  groups: entries,
+}
+
+# output results
+output.puts JSON.pretty_generate(info)
+output.close

Mime
View raw message