whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject [whimsy] branch master updated: WHIMSY-271 Centralise committee-info.txt roster update handling
Date Mon, 03 Jun 2019 17:37:27 GMT
This is an automated email from the ASF dual-hosted git repository.

sebb 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 bd9e614  WHIMSY-271 Centralise committee-info.txt roster update handling
bd9e614 is described below

commit bd9e614367754305b6091f454d64241f339bdfbd
Author: Sebb <sebb@apache.org>
AuthorDate: Mon Jun 3 18:37:23 2019 +0100

    WHIMSY-271 Centralise committee-info.txt roster update handling
    
    2 of 2: Update committee code
---
 www/roster/views/actions/committee.json.rb | 58 +++---------------------------
 1 file changed, 4 insertions(+), 54 deletions(-)

diff --git a/www/roster/views/actions/committee.json.rb b/www/roster/views/actions/committee.json.rb
index b39ff99..3bf5856 100644
--- a/www/roster/views/actions/committee.json.rb
+++ b/www/roster/views/actions/committee.json.rb
@@ -37,60 +37,10 @@ if env.password
 
   # 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==@project
-
-        # split block into lines
-        lines = block.strip.split("\n")
-
-        # add or remove people
-        people.each do |person|
-          id = person.id
-          if @action == 'add'
-            unless lines.any? {|line| line.include? "<#{id}@apache.org>"}
-              name = "#{person.public_name.ljust(26)} <#{id}@apache.org>"
-              time = Time.new.gmtime.strftime('%Y-%m-%d')
-              lines << "    #{name.ljust(59)} [#{time}]"
-            end
-          else
-            lines.reject! {|line| line.include? "<#{id}@apache.org>"}
-          end
-        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
-      rc = Kernel.system 'svn', 'commit', '--quiet',
-        '--no-auth-cache', '--non-interactive',
-        '--username', env.user.untaint, '--password', env.password.untaint,
-        tmpdir.untaint, '--message',
-        "#{@project} #{@action == 'add' ? '+' : '-'}= #{who}".untaint
-
-      if rc
-        # update cache
-        ASF::Committee.parse_committee_info(info)
-      else
-        # die
-        raise Exception.new('Update committee-info.txt failed')
-      end
+    message = "#{@project} #{@action == 'add' ? '+' : '-'}= #{who}".untaint
+    ASF::SVN.updateCI message, env do |contents|
+      contents = ASF::Committee.update_roster(contents, @project, people, @action)
+      contents
     end
   end
 


Mime
View raw message