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: Centralise SVN private-public classification
Date Mon, 25 Nov 2019 19:00:01 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 a27ab24  Centralise SVN private-public classification
a27ab24 is described below

commit a27ab2440870d7aea8b4945236a1758818c62e4d
Author: Sebb <sebb@apache.org>
AuthorDate: Mon Nov 25 18:59:57 2019 +0000

    Centralise SVN private-public classification
---
 lib/whimsy/asf/svn.rb    | 27 +++++++++++++++++++++++++--
 tools/wwwdocs.rb         | 12 ------------
 www/members/repo-use.cgi |  2 +-
 3 files changed, 26 insertions(+), 15 deletions(-)

diff --git a/lib/whimsy/asf/svn.rb b/lib/whimsy/asf/svn.rb
index 6a00b1b..5c00143 100644
--- a/lib/whimsy/asf/svn.rb
+++ b/lib/whimsy/asf/svn.rb
@@ -69,10 +69,15 @@ module ASF
       self.find!(name)
     end
 
+    # Get all the SVN repo entries
+    def self.repo_entries
+      self.repos # refresh @@repository_entries
+      @@repository_entries[:svn]
+    end
+
     # fetch a repository entry by name
     def self.repo_entry(name)
-      self.repos # refresh @@repository_entries
-      @@repository_entries[:svn][name]
+      self.repo_entries[name]
     end
 
     # fetch a repository entry by name - abort if not found
@@ -84,6 +89,21 @@ module ASF
       entry
     end
 
+    # get private and public repo names
+    # @return [['private1', 'privrepo2', ...], ['public1', 'pubrepo2', ...]
+    def self.private_public
+      prv = []
+      pub = []
+      self.repo_entries().each do |name, entry|
+        if entry['url'].start_with? 'asf/'
+          pub << name
+        else
+          prv << name
+        end
+      end
+      return prv, pub
+    end
+
     # fetch a repository URL by name
     def self.svnurl(name)
       entry = self.repo_entry(name) or return nil
@@ -374,6 +394,9 @@ module ASF
     end
   end
 
+  def self.classify_repos()
+    
+  end
 end
 
 if __FILE__ == $0 # local testing
diff --git a/tools/wwwdocs.rb b/tools/wwwdocs.rb
index 3c02bd5..5090ee0 100755
--- a/tools/wwwdocs.rb
+++ b/tools/wwwdocs.rb
@@ -15,7 +15,6 @@ AUTHMAP = { # From whimsy-vm4.apache.org.yaml
   'ASF Secretarial Team' => 'text-danger'
 }
 AUTHPUBLIC = 'glyphicon-eye-open'
-IS_PRIVATE = /\A(private|infra\/infrastructure)/
 ASFSVN = /ASF::SVN/
 SCANDIRSVN = "../"
 WWWAUTH = /WWW-Authenticate: Basic realm/
@@ -117,17 +116,6 @@ def get_annotated_scan(dir)
   return annotate_scan(scan, auth)
 end
 
-# Read repository.yml for all :svn dirs names to scan for
-# @return [['private1', 'privrepo2', ...], ['public1', 'pubrepo2', ...]
-def read_repository(repofile)
-  svn = YAML.load_file(repofile)[:svn]
-  repos = [[], []]
-  svn.each do |repo, data|
-    data['url'] =~ IS_PRIVATE ? repos[0] << repo : repos[1] << repo
-  end
-  return repos
-end
-
 # Build a regex union from ASFSVN and an array
 # @return Regexp.union(r...)
 def build_regexp(list)
diff --git a/www/members/repo-use.cgi b/www/members/repo-use.cgi
index 88a276f..50ab893 100755
--- a/www/members/repo-use.cgi
+++ b/www/members/repo-use.cgi
@@ -27,7 +27,7 @@ _html do
         emit_authmap
       }
     ) do
-      priv, pub = read_repository(File.expand_path('../../../repository.yml', __FILE__))
+      priv, pub = ASF::SVN.private_public
       priv = build_regexp(priv)
       pub = build_regexp(pub)
       scan = scan_dir_svn('../../', [priv, pub])


Mime
View raw message