whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sam Ruby <ru...@apache.org>
Subject [whimsy.git] [1/1] Commit c9a24d5: update committee info.txt
Date Sun, 06 Mar 2016 01:42:37 GMT
Commit c9a24d5b64ef8ae28aef74dfcfcda2e27e671672:
    update committee info.txt


Branch: refs/heads/master
Author: Sam Ruby <rubys@intertwingly.net>
Committer: Sam Ruby <rubys@intertwingly.net>
Pusher: rubys <rubys@apache.org>

------------------------------------------------------------
lib/whimsy/asf/mail.rb                                       | ++ --
www/roster/main.rb                                           | + 
www/roster/views/actions/committee.json.rb                   | ++++++++++++ 
www/roster/views/pmc/pmc.js.rb                               | ++++++ ----
------------------------------------------------------------
62 changes: 56 additions, 6 deletions.
------------------------------------------------------------


diff --git a/lib/whimsy/asf/mail.rb b/lib/whimsy/asf/mail.rb
index 98aff2a..62701c2 100644
--- a/lib/whimsy/asf/mail.rb
+++ b/lib/whimsy/asf/mail.rb
@@ -56,10 +56,10 @@ def self.configure
 
       if sendmail
         # convert string keys to symbols
-        options = Hash[options.map {|key, value| [key.to_sym, value]}]
+        options = Hash[sendmail.map {|key, value| [key.to_sym, value.untaint]}]
 
         # extract delivery method
-        method = options.delete(:delivery_method).to_s.to_sym
+        method = options.delete(:delivery_method).to_sym
       else
         # provide defaults that work on whimsy-vm* infrastructure.  Since
         # procmail is configured with a self-signed certificate, verification
diff --git a/www/roster/main.rb b/www/roster/main.rb
index 217fb41..7f49442 100755
--- a/www/roster/main.rb
+++ b/www/roster/main.rb
@@ -8,6 +8,7 @@
 require 'whimsy/asf/podlings'
 
 require 'mail'
+require 'tmpdir'
 
 require 'wunderbar/sinatra'
 require 'wunderbar/bootstrap/theme'
diff --git a/www/roster/views/actions/committee.json.rb b/www/roster/views/actions/committee.json.rb
index f7818a9..97c3021 100644
--- a/www/roster/views/actions/committee.json.rb
+++ b/www/roster/views/actions/committee.json.rb
@@ -14,6 +14,53 @@
     end
   end
 
+  # update committee-info.txt
+  if @targets.include? 'info'
+    Dir.mktmpdir do |tmpdir|
+      # checkout committers/board
+      Kernel.system 'svn', 'checkout', '--quiet',
+        '--no-auth-cache', '--non-interactive',
+        '--username', env.user.untaint, '--password', env.password.untaint,
+        'https://svn.apache.org/repos/private/committers/board', tmpdir.untaint
+
+      # read in committee-info.txt
+      file = File.join(tmpdir, 'committee-info.txt')
+      info = File.read(file)
+
+      info.scan(/^\* (?:.|\n)*?\n\s*?\n/).each do |block|
+        # find committee
+        next unless ASF::Committee.find(block[/\* (.*?)\s+\(/, 1]).id == @pmc
+
+        # split block into lines
+        lines = block.strip.split("\n")
+
+        # add or remove person
+        if @action == 'add'
+          unless lines.any? {|line| line.include? "<#{@id}@apache.org>"}
+            name = "#{person.public_name.ljust(26)} <#{@id}@apache.org>"
+            lines << "    #{name.ljust(60)}[#{Time.new.strftime('%Y-%m-%d')}]"
+          end
+        else
+          lines.reject! {|line| line.include? "<#{@id}@apache.org>"}
+        end
+
+        # replace committee block with new information
+        info.sub! block, ([lines.shift] + lines.sort).join("\n") + "\n\n"
+        break
+      end
+
+      # write file out to disk
+      File.write(file, info)
+
+      # commit changes
+      Kernel.system 'svn', 'commit', '--quiet',
+        '--no-auth-cache', '--non-interactive',
+        '--username', env.user.untaint, '--password', env.password.untaint,
+        tmpdir.untaint, '--message',
+        "#{@pmc} #{@action == 'add' ? '+' : '-'}= #{@id}"
+    end
+  end
+
   # compose E-mail
   action = (@action == 'add' ? 'added to' : 'removed from')
   if pmc
diff --git a/www/roster/views/pmc/pmc.js.rb b/www/roster/views/pmc/pmc.js.rb
index 1e2402e..f896e1e 100644
--- a/www/roster/views/pmc/pmc.js.rb
+++ b/www/roster/views/pmc/pmc.js.rb
@@ -101,13 +101,13 @@ def render
           if @@person.date == 'pending'
             _button.btn.btn_primary 'Add as a committer and to the PMC',
               # not added yet
-              data_action: 'add pmc commit',
+              data_action: 'add pmc info commit',
               data_target: '#confirm', data_toggle: 'modal',
               data_confirmation: "Add #{@@person.name} to the " +
                 "#{@@committee.display_name} PMC and grant committer access?"
 
             _button.btn.btn_warning 'Add to PMC only', data_target: '#confirm',
-              data_action: 'add pmc', data_toggle: 'modal',
+              data_action: 'add pmc info', data_toggle: 'modal',
               data_confirmation: "Add #{@@person.name} to the " +
                 "#{@@committee.display_name} PMC?"
           elsif not @@person.date
@@ -118,7 +118,8 @@ def render
               data_confirmation: "Remove #{@@person.name} from LDAP?"
 
             _button.btn.btn_success 'Add to committee_info.txt',
-              disabled: true,
+              data_action: 'add info',
+              data_target: '#confirm', data_toggle: 'modal',
               data_confirmation: "Add to #{@@person.name} committee_info.txt"
           elsif not @@person.ldap
              # in committee-info.txt but not in ldap
@@ -128,7 +129,8 @@ def render
               data_confirmation: "Add #{@@person.name} to LDAP?"
 
             _button.btn.btn_warning 'Remove from committee_info.txt',
-              disabled: true,
+              data_action: 'remove info',
+              data_target: '#confirm', data_toggle: 'modal',
               data_confirmation: 
                 "Remove #{@@person.name} from committee_info.txt?"
           else

Mime
View raw message