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 2019/11/29 21:46:02 UTC

[whimsy] branch master updated: Common documents/* processing

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 21f13b7  Common documents/* processing
21f13b7 is described below

commit 21f13b7482c71ebe4f755a1d40d3d096919982f9
Author: Sebb <se...@apache.org>
AuthorDate: Fri Nov 29 21:45:56 2019 +0000

    Common documents/* processing
---
 lib/whimsy/asf.rb           |  2 +-
 lib/whimsy/asf/ccla.rb      | 22 -----------------
 lib/whimsy/asf/documents.rb | 60 +++++++++++++++++++++++++++++++++++++++++++++
 lib/whimsy/asf/icla.rb      | 19 --------------
 4 files changed, 61 insertions(+), 42 deletions(-)

diff --git a/lib/whimsy/asf.rb b/lib/whimsy/asf.rb
index 50a89dc..2178ae2 100644
--- a/lib/whimsy/asf.rb
+++ b/lib/whimsy/asf.rb
@@ -7,7 +7,7 @@ require_relative 'asf/git'
 require_relative 'asf/watch'
 require_relative 'asf/nominees'
 require_relative 'asf/icla'
-require_relative 'asf/ccla'
+require_relative 'asf/documents'
 require_relative 'asf/auth'
 require_relative 'asf/member'
 require_relative 'asf/podling'
diff --git a/lib/whimsy/asf/ccla.rb b/lib/whimsy/asf/ccla.rb
deleted file mode 100644
index 936f9ff..0000000
--- a/lib/whimsy/asf/ccla.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-require 'json'
-
-module ASF
-
-  # Common class for access to documents/cclas/ directory
-  class CCLAFiles
-
-    # listing of top-level icla file/directory names
-    # Directories are listed without trailing "/"
-    def self.listnames
-      _, list = ASF::SVN.getlisting('cclas') # do we need to cache the listing?
-      list
-    end
-
-    # Does an entry exist?
-    def self.exist?(name)
-      self.listnames.include?(name)
-    end
-    
-  end
-
-end
diff --git a/lib/whimsy/asf/documents.rb b/lib/whimsy/asf/documents.rb
new file mode 100644
index 0000000..7783f6f
--- /dev/null
+++ b/lib/whimsy/asf/documents.rb
@@ -0,0 +1,60 @@
+require 'json'
+
+# Access to documents/* (except member_apps)
+
+module ASF
+
+  # Common class for access to documents/cclas/
+  class CCLAFiles
+
+    # listing of top-level icla file/directory names
+    # Directories are listed without trailing "/"
+    def self.listnames
+      _, list = ASF::SVN.getlisting('cclas') # do we need to cache the listing?
+      list
+    end
+
+    # Does an entry exist?
+    def self.exist?(name)
+      self.listnames.include?(name)
+    end
+    
+  end
+
+  # Common class for access to documents/cclas/
+  class GrantFiles
+
+    # listing of top-level grants file/directory names
+    # Directories are listed without trailing "/"
+    def self.listnames
+      _, list = ASF::SVN.getlisting('grants') # do we need to cache the listing?
+      list
+    end
+
+    # Does an entry exist?
+    def self.exist?(name)
+      self.listnames.include?(name)
+    end
+    
+  end
+
+  # Common class for access to documents/iclas/ directory
+  class ICLAFiles
+    @@ICLAFILES = nil # cache the find if actually needed
+    # search icla files to find match with claRef
+    # Returns the basename or nil if no match
+    def self.match_claRef(claRef)
+      @@ICLAFILES = ASF::SVN['iclas'] unless @@ICLAFILES
+      file = Dir[File.join(@@ICLAFILES, claRef), File.join(@@ICLAFILES, "#{claRef}.*")].first
+      File.basename(file) if file
+    end
+
+    # listing of top-level icla file/directory names
+    # Directories are listed without trailing "/"
+    def self.listnames
+      @@ICLAFILES = ASF::SVN['iclas'] unless @@ICLAFILES
+      Dir[File.join(@@ICLAFILES, '*')]
+    end
+  end
+
+end
diff --git a/lib/whimsy/asf/icla.rb b/lib/whimsy/asf/icla.rb
index d1a6749..76075a3 100644
--- a/lib/whimsy/asf/icla.rb
+++ b/lib/whimsy/asf/icla.rb
@@ -263,23 +263,4 @@ module ASF
     name
   end
 
-  # Common class for access to documents/iclas/ directory
-  class ICLAFiles
-    @@ICLAFILES = nil # cache the find if actually needed
-    # search icla files to find match with claRef
-    # Returns the basename or nil if no match
-    def self.match_claRef(claRef)
-      @@ICLAFILES = ASF::SVN['iclas'] unless @@ICLAFILES
-      file = Dir[File.join(@@ICLAFILES, claRef), File.join(@@ICLAFILES, "#{claRef}.*")].first
-      File.basename(file) if file
-    end
-
-    # listing of top-level icla file/directory names
-    # Directories are listed without trailing "/"
-    def self.listnames
-      @@ICLAFILES = ASF::SVN['iclas'] unless @@ICLAFILES
-      Dir[File.join(@@ICLAFILES, '*')]
-    end
-  end
-
 end