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 2018/01/06 13:41:04 UTC

[whimsy] branch master updated: rough in a script to modify PMC chairs

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 27e591b  rough in a script to modify PMC chairs
27e591b is described below

commit 27e591b9d6350d89bd3c3aca058ff57e7070d342
Author: Sam Ruby <ru...@intertwingly.net>
AuthorDate: Sat Jan 6 08:40:42 2018 -0500

    rough in a script to modify PMC chairs
---
 Rakefile                  |  9 +++++++--
 tools/modify_pmcchairs.rb | 34 ++++++++++++++++++++++++++++++++++
 2 files changed, 41 insertions(+), 2 deletions(-)

diff --git a/Rakefile b/Rakefile
index 0e4d07e..badaf2b 100644
--- a/Rakefile
+++ b/Rakefile
@@ -7,7 +7,7 @@ Gem::PackageTask.new(spec) do |pkg|
 end
 
 # update gems and restart applications as needed
-task :update do
+task :update, [:command] do |task, args|
   # locate system ruby
   sysruby = File.realpath(`which ruby`.chomp)
   sysruby = "#{File.dirname(sysruby)}/%s#{sysruby[/ruby([.\d]*)$/, 1]}"
@@ -33,7 +33,7 @@ task :update do
       end
 
       bundler = 'bundle' unless File.exist?(bundler)
-      system "#{bundler} update"
+      system "#{bundler} #{args.command || 'update'}"
     end
   end
 
@@ -62,6 +62,11 @@ task :update do
   File.utime new_baseline, new_baseline, update_file
 end
 
+# pristine version of update
+task :pristine do
+  Rake::Task[:update].invoke('pristine')
+end
+
 task :config do
   $LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
   require 'whimsy/asf/config'
diff --git a/tools/modify_pmcchairs.rb b/tools/modify_pmcchairs.rb
new file mode 100755
index 0000000..96f3cc1
--- /dev/null
+++ b/tools/modify_pmcchairs.rb
@@ -0,0 +1,34 @@
+#!/usr/bin/env ruby
+$LOAD_PATH.unshift File.realpath(File.expand_path('../../lib', __FILE__))
+
+#
+# add/remove people from PMC Chairs
+#
+
+require 'whimsy/asf'
+
+# extract action to be performed
+action = ARGV.delete('--add') || ARGV.delete("--rm")
+
+# map arguments provided to people
+people = ARGV.map {|id| ASF::Person[id]}
+
+# validate ids
+ARGV.zip(people).map do |id, person|
+  unless person
+    STDERR.puts "invalid id: #{id}"
+    exit 1
+  end
+end
+
+# get the list from LDAP to be updated
+chairs = ASF::Service.find('pmc-chairs')
+
+# execute the action
+if action == '--add' and not people.empty?
+  ASF::LDAP.bind { chairs.add(people) }
+elsif action == '-rm' and not people.empty?
+  ASF::LDAP.bind { chairs.remove(people) }
+else
+  STDERR.puts "Usage: #{$PROGRAM_NAME} (--add|--rm) list..."
+end

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