You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by se...@apache.org on 2017/04/25 15:25:40 UTC
[whimsy] branch master updated: Put parse into separate function to
allow test of individual sites
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 7cf0ef1 Put parse into separate function to allow test of individual sites
7cf0ef1 is described below
commit 7cf0ef102d248239496253d5449b260a34619719
Author: Sebb <se...@apache.org>
AuthorDate: Tue Apr 25 16:25:38 2017 +0100
Put parse into separate function to allow test of individual sites
---
tools/site-check.rb | 36 ++++++++++++++++++++++--------------
1 file changed, 22 insertions(+), 14 deletions(-)
diff --git a/tools/site-check.rb b/tools/site-check.rb
index bbd7a9c..a548c6e 100755
--- a/tools/site-check.rb
+++ b/tools/site-check.rb
@@ -28,22 +28,13 @@ def fetch(uri)
end
end
-# scan all committees, including non-pmcs
-ASF::Committee.load_committee_info
-committees = (ASF::Committee.list + ASF::Committee.nonpmcs).uniq
-
-results = {}
-
-committees.sort_by {|committee| committee.name}.each do |committee|
- next unless committee.site
-
- # fetch, parse committee site
- uri, request, response = fetch(committee.site)
+def parse(site, name)
+ uri, request, response = fetch(site)
doc = Nokogiri::HTML(response.body)
# default data
data = {
- display_name: committee.display_name,
+ display_name: name,
uri: uri.to_s,
events: nil,
foundation: nil,
@@ -88,8 +79,25 @@ committees.sort_by {|committee| committee.name}.each do |committee|
data[:sponsorship] = uri + a['href'].strip
end
end
-
- results[committee.name] = data
+ return data
end
+results = {}
+
+if ARGV.length == 2
+ site = ARGV.shift
+ name = ARGV.shift
+ results[name] = parse(site, name)
+else
+ # scan all committees, including non-pmcs
+ ASF::Committee.load_committee_info
+ committees = (ASF::Committee.list + ASF::Committee.nonpmcs).uniq
+
+ committees.sort_by {|committee| committee.name}.each do |committee|
+ next unless committee.site
+
+ # fetch, parse committee site
+ results[committee.name] = parse(committee.site, committee.display_name)
+ end
+end
puts JSON.pretty_generate(results)
--
To stop receiving notification emails like this one, please contact
['"commits@whimsical.apache.org" <co...@whimsical.apache.org>'].