You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by ru...@apache.org on 2017/05/01 14:43:45 UTC
[whimsy] branch master updated (90803b5 -> 4f54069)
This is an automated email from the ASF dual-hosted git repository.
rubys pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git.
from 90803b5 mail.rb does mapping, and add new idea
new 80f0c37 clone site-check.cgi
new 4f54069 provide an overview of the results with the ability to drill down
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "adds" were already present in the repository and have only
been added to this reference.
Summary of changes:
www/{test/site-check.cgi => site.cgi} | 114 +++++++++++++++++++++++-----------
1 file changed, 77 insertions(+), 37 deletions(-)
copy www/{test/site-check.cgi => site.cgi} (67%)
--
To stop receiving notification emails like this one, please contact
['"commits@whimsical.apache.org" <co...@whimsical.apache.org>'].
[whimsy] 02/02: provide an overview of the results with the ability
to drill down
Posted by ru...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rubys pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git
commit 4f540693d5c67a037a499f4bcefe1f4d1543a4d6
Author: Sam Ruby <ru...@intertwingly.net>
AuthorDate: Mon May 1 10:43:10 2017 -0400
provide an overview of the results with the ability to drill down
---
www/site.cgi | 114 ++++++++++++++++++++++++++++++++++++++++-------------------
1 file changed, 77 insertions(+), 37 deletions(-)
diff --git a/www/site.cgi b/www/site.cgi
index 0410953..c0443ed 100755
--- a/www/site.cgi
+++ b/www/site.cgi
@@ -1,5 +1,14 @@
#!/usr/bin/env ruby
-$LOAD_PATH.unshift File.realpath(File.expand_path('../../../lib', __FILE__))
+
+# ensure that there is a path (even a slash will do) after the script name
+unless ENV['PATH_INFO'] and not ENV['PATH_INFO'].empty?
+ print "Status: 301 Moved Permanently\r\n"
+ print "Location: #{ENV['SCRIPT_URL']}/\r\n"
+ print "\r\n"
+ exit
+end
+
+$LOAD_PATH.unshift File.realpath(File.expand_path('../../lib', __FILE__))
require 'json'
require 'whimsy/asf'
require 'wunderbar'
@@ -40,6 +49,16 @@ def analyze(sites)
]
end
+def label(analysis, links, c, n)
+ if not links[c]
+ 'label-danger'
+ elsif analysis[2].include? c and not analysis[2][c].include? n
+ 'label-warning'
+ else
+ 'label-success'
+ end
+end
+
_html do
_head do
_style %{
@@ -49,6 +68,8 @@ _html do
_body? do
+ path = env['PATH_INFO']
+
local_copy = File.expand_path('../public/site-scan.json').untaint
if File.exist? local_copy
@@ -82,51 +103,70 @@ _html do
end
end
end
- _table.table.table_condensed.table_striped do
- _thead do
- _tr do
- _th! 'Project', data_sort: 'string-ins'
+
+ if path_info =~ %r{/project/(.+)}
+ # details for an individual project
+ project = $1
+ links = sites[project]
+ _h2 sites[project]['display_name']
+ _table.table.table_striped do
+ _tbody do
cols.each do |col|
- _th! data_sort: 'string' do
- _ col.capitalize
- _br
- analysis[0][col].each do |cls, val|
- _ ' '
- _span.label val, class: cls
- end
+ _tr do
+ _td col
+ _td links[col], class: label(analysis, links, col, project)
end
end
end
end
-
- _tbody do
- sites.each do |n, links|
- _tr do
- _td do
- _a! "#{links['display_name']}", href: links['uri']
- end
- cols.each do |c|
- if analysis[2].include? c and not analysis[2][c].include? n
- cls = 'label-warning'
- else
- cls = '' # link not present or link OK
- end
- if not links[c]
- _td ''
- elsif links[c] =~ /^http/
- _td do
- _a links[c].sub(/https?:\/\//, '').
- sub(/(www\.)?apache\.org/i, 'a.o'), href: links[c], class: cls
- end
- else
- _td links[c].gsub(/Apache Software Foundation/,'ASF'), class: cls
- end
+ elsif path_info =~ %r{/check/(.+)}
+ # details for a single check
+ col = $1
+ _h2 col
+ _table.table do
+ _tbody do
+ sites.each do |n, links|
+ _tr class: label(analysis, links, col, n) do
+ _td links['display_name']
+ _td links[col]
end
end
end
end
- end
- end
+ else
+ # overview
+ _table.table.table_condensed.table_striped do
+ _thead do
+ _tr do
+ _th! 'Project', data_sort: 'string-ins'
+ cols.each do |col|
+ _th! data_sort: 'string' do
+ _a col.capitalize, href: "check/#{col}"
+ _br
+ analysis[0][col].each do |cls, val|
+ _ ' '
+ _span.label val, class: cls
+ end
+ end
+ end
+ end
+ end
+
+ _tbody do
+ sites.each do |n, links|
+ _tr do
+ _td do
+ _a "#{links['display_name']}", href: "project/#{n}"
+ end
+ cols.each do |c|
+ _td '', class: label(analysis, links, c, n)
+ end
+ end
+ end
+ end
+ end
+ end
+ end
_script %{
var table = $(".table").stupidtable();
--
To stop receiving notification emails like this one, please contact
"commits@whimsical.apache.org" <co...@whimsical.apache.org>.
[whimsy] 01/02: clone site-check.cgi
Posted by ru...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rubys pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git
commit 80f0c372cea7883c97e74bcf9f07b90c966d162f
Author: Sam Ruby <ru...@intertwingly.net>
AuthorDate: Mon May 1 10:42:44 2017 -0400
clone site-check.cgi
---
www/site.cgi | 147 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 147 insertions(+)
diff --git a/www/site.cgi b/www/site.cgi
new file mode 100755
index 0000000..0410953
--- /dev/null
+++ b/www/site.cgi
@@ -0,0 +1,147 @@
+#!/usr/bin/env ruby
+$LOAD_PATH.unshift File.realpath(File.expand_path('../../../lib', __FILE__))
+require 'json'
+require 'whimsy/asf'
+require 'wunderbar'
+require 'wunderbar/bootstrap'
+require 'wunderbar/jquery/stupidtable'
+require 'net/http'
+
+PAGETITLE = 'Apache TLP Website Link Checks'
+cols = %w( events foundation license sponsorship security thanks copyright trademarks )
+DATAURI = 'https://whimsy.apache.org/public/site-scan.json'
+
+def analyze(sites)
+ success = Hash.new { |h, k| h[k] = Hash.new(&h.default_proc) }
+ counts = Hash.new { |h, k| h[k] = Hash.new(&h.default_proc) }
+ {
+ 'copyright' => %r{Copyright [^.]+ Apache Software Foundation}i, # Do we need '[Tt]he ASF'?
+ # TODO more checks needed here, e.g. ASF registered and 3rd party marks
+ 'trademarks' => %r{trademarks of [Tt]he Apache Software Foundation}i,
+ 'events' => %r{apache.org/events/current-event}i,
+ 'license' => %r{apache.org/licenses/$}i, # should link to parent license page only
+ 'sponsorship' => %r{apache.org/foundation/sponsorship}i,
+ 'security' => %r{apache.org/security}i,
+ 'thanks' => %r{apache.org/foundation/thanks}i
+ }.each do |nam, pat|
+ success[nam] = sites.select{ |k, site| site[nam] =~ pat }.keys
+ counts[nam]['label-success'] = success[nam].count
+ counts[nam]['label-warning'] = 0 # Reorder output
+ counts[nam]['label-danger'] = sites.select{ |k, site| site[nam].nil? }.count
+ counts[nam]['label-warning'] = sites.size - counts[nam]['label-success'] - counts[nam]['label-danger']
+ end
+
+ [
+ counts, {
+ 'label-success' => '# Sites with links to primary ASF page',
+ 'label-warning' => '# Sites with link, but not an expected ASF one',
+ 'label-danger' => '# Sites with no link for this topic'
+ }, success
+ ]
+end
+
+_html do
+ _head do
+ _style %{
+ .table td {font-size: smaller;}
+ }
+ end
+
+ _body? do
+
+ local_copy = File.expand_path('../public/site-scan.json').untaint
+
+ if File.exist? local_copy
+ crawl_time = File.mtime(local_copy).rfc2822
+ sites = JSON.parse(File.read(local_copy))
+ else
+ response = Net::HTTP.get_response(URI(DATAURI))
+ crawl_time = response['last-modified']
+ sites = JSON.parse(response.body)
+ end
+ analysis = analyze(sites)
+
+ _whimsy_header PAGETITLE
+
+ _whimsy_content do
+ _div.panel.panel_default do
+ _div!.panel_heading 'Common Links Found On TLP Sites'
+ _div.panel_body do
+ _ 'Current (beta) status of Apache PMC top level websites vis-a-vis '
+ _a 'required links', href: 'https://www.apache.org/foundation/marks/pmcs#navigation'
+ _ '. '
+ _a 'See crawler code', href: 'https://whimsy.apache.org/tools/site-check.rb'
+ _ ' and '
+ _a 'raw JSON data', href: DATAURI
+ _ ". Last crawl time: #{crawl_time} over #{sites.size} sites."
+ _br
+ _ul do
+ analysis[1].each do |cls, desc|
+ _li.label desc, class: cls
+ end
+ end
+ end
+ end
+ _table.table.table_condensed.table_striped do
+ _thead do
+ _tr do
+ _th! 'Project', data_sort: 'string-ins'
+ cols.each do |col|
+ _th! data_sort: 'string' do
+ _ col.capitalize
+ _br
+ analysis[0][col].each do |cls, val|
+ _ ' '
+ _span.label val, class: cls
+ end
+ end
+ end
+ end
+ end
+
+ _tbody do
+ sites.each do |n, links|
+ _tr do
+ _td do
+ _a! "#{links['display_name']}", href: links['uri']
+ end
+ cols.each do |c|
+ if analysis[2].include? c and not analysis[2][c].include? n
+ cls = 'label-warning'
+ else
+ cls = '' # link not present or link OK
+ end
+ if not links[c]
+ _td ''
+ elsif links[c] =~ /^http/
+ _td do
+ _a links[c].sub(/https?:\/\//, '').
+ sub(/(www\.)?apache\.org/i, 'a.o'), href: links[c], class: cls
+ end
+ else
+ _td links[c].gsub(/Apache Software Foundation/,'ASF'), class: cls
+ end
+ end
+ end
+ end
+ end
+ end
+ end
+
+ _script %{
+ var table = $(".table").stupidtable();
+ table.on("aftertablesort", function (event, data) {
+ var th = $(this).find("th");
+ th.find(".arrow").remove();
+ var dir = $.fn.stupidtable.dir;
+ var arrow = data.direction === dir.ASC ? "↑" : "↓";
+ th.eq(data.column).append('<span class="arrow">' + arrow +'</span>');
+ });
+ }
+ _whimsy_footer({
+ "https://www.apache.org/foundation/marks/pmcs" => "Apache Project Branding Policy",
+ "https://www.apache.org/foundation/marks/resources" => "Trademark Site Map",
+ "https://www.apache.org/foundation/marks/list/" => "Official Apache Trademark List"
+ })
+ end
+end
--
To stop receiving notification emails like this one, please contact
"commits@whimsical.apache.org" <co...@whimsical.apache.org>.