You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by Sam Ruby <ru...@apache.org> on 2016/02/24 18:08:07 UTC

[whimsy.git] [1/1] Commit 829688c: parsing json from repo > parsing html from web

Commit 829688cff029c2eaab4284065c7ce9addeb71792:
    parsing json from repo > parsing html from web


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

------------------------------------------------------------
lib/whimsy/asf/icla.rb                                       | ++++ -------
repository.yml                                               | +++ 
------------------------------------------------------------
23 changes: 10 additions, 13 deletions.
------------------------------------------------------------


diff --git a/lib/whimsy/asf/icla.rb b/lib/whimsy/asf/icla.rb
index 05b70cd..2201e1d 100644
--- a/lib/whimsy/asf/icla.rb
+++ b/lib/whimsy/asf/icla.rb
@@ -1,3 +1,5 @@
+require 'json'
+
 module ASF
 
   class ICLA
@@ -228,18 +230,10 @@ def icla?
   # Search archive for historical records of people who were committers
   # but never submitted an ICLA (some of which are still ASF members or
   # members of a PMC).
-  def self.search_archive_by_id(value)
-    require 'net/http'
-    require 'nokogiri'
-    historical_committers = 'http://people.apache.org/~rubys/committers.html'
-    doc = Nokogiri::HTML(Net::HTTP.get(URI.parse(historical_committers)))
-    doc.search('tr').each do |tr|
-      tds = tr.search('td')
-      next unless tds.length == 3
-      return tds[1].text if tds[0].text == value
-    end
-    nil
-  rescue
-    nil
+  def self.search_archive_by_id(id)
+    archive = ASF::SVN['private/foundation/officers/historic']
+    name = JSON.parse(File.read("#{archive}/committers.json"))[id]
+    name = id if name and name.empty?
+    name
   end
 end
diff --git a/repository.yml b/repository.yml
index c27ca61..74762d7 100644
--- a/repository.yml
+++ b/repository.yml
@@ -48,6 +48,9 @@
     url: private/foundation/officers
     depth: files
 
+  officers_historic:
+    url: private/foundation/officers/historic
+
   prospects:
     url: private/foundation/Fundraising/prospects
     depth: files