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: Switch to reading listing
Date Fri, 29 Nov 2019 22:27:40 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 f7377bb  Switch to reading listing
f7377bb is described below

commit f7377bbd8e86e12a4b1a0610e606d608d73fe0c4
Author: Sebb <sebb@apache.org>
AuthorDate: Fri Nov 29 22:27:33 2019 +0000

    Switch to reading listing
---
 lib/whimsy/asf/documents.rb | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/lib/whimsy/asf/documents.rb b/lib/whimsy/asf/documents.rb
index 7783f6f..0d477b5 100644
--- a/lib/whimsy/asf/documents.rb
+++ b/lib/whimsy/asf/documents.rb
@@ -40,20 +40,16 @@ module ASF
 
   # Common class for access to documents/iclas/ directory
   class ICLAFiles
-    @@ICLAFILES = nil # cache the find if actually needed
+    @@tag = nil
     # 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, '*')]
+      @@tag, list = ASF::SVN.getlisting('iclas', @@tag)
+      if list
+        @@list = list.map
+      end
+      # Match either full name (e.g. directory) or stem (e.g. name.pdf)
+      file = @@list.select{|l| l == claRef || l.start_with?("#{claRef}.") }.first
     end
   end
 


Mime
View raw message