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 557e77a: update cache after successful commit
Date Sun, 06 Mar 2016 03:15:02 GMT
Commit 557e77a50f1d0c9afeaf01e7e0e5413db5c25eea:
    update cache after successful commit


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

------------------------------------------------------------
lib/whimsy/asf/committee.rb                                  | +++++++ --
www/roster/views/actions/committee.json.rb                   | +++++++++ -
------------------------------------------------------------
19 changes: 16 additions, 3 deletions.
------------------------------------------------------------


diff --git a/lib/whimsy/asf/committee.rb b/lib/whimsy/asf/committee.rb
index 46faa81..27cb126 100644
--- a/lib/whimsy/asf/committee.rb
+++ b/lib/whimsy/asf/committee.rb
@@ -52,14 +52,19 @@ def self.load_committee_info
         return @committee_info 
       end
 
-      list = Hash.new {|hash, name| hash[name] = find(name)}
 
       @committee_mtime = File.mtime(file)
       @@svn_change = Time.parse(
         `svn info #{file}`[/Last Changed Date: (.*) \(/, 1]).gmtime
 
+      parse_committee_info File.read(file)
+    end
+
+    def self.parse_committee_info(contents)
+      list = Hash.new {|hash, name| hash[name] = find(name)}
+
       # Split the file on lines starting "* ", i.e. the start of each group in section 3
-      info = File.read(file).split(/^\* /)
+      info = contents.split(/^\* /)
       # Extract the text before first entry in section 3 and split on section headers,
       # keeping sections 1 (COMMITTEES) and 2 (REPORTING).
       head, report = info.shift.split(/^\d\./)[1..2]
diff --git a/www/roster/views/actions/committee.json.rb b/www/roster/views/actions/committee.json.rb
index 97c3021..e6617e3 100644
--- a/www/roster/views/actions/committee.json.rb
+++ b/www/roster/views/actions/committee.json.rb
@@ -53,11 +53,19 @@
       File.write(file, info)
 
       # commit changes
-      Kernel.system 'svn', 'commit', '--quiet',
+      rc = 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}"
+
+      if rc
+        # update cache
+        ASF::Committee.parse_committee_info(info)
+      else
+        # die
+        raise Error.new('Update committee-info.txt failed')
+      end
     end
   end
 

Mime
View raw message