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 27d50c2  Allow auth path to be overridden for testing
27d50c2 is described below

commit 27d50c27990aecff887a81795094695dfc16dc11
Author: Sebb <s...@apache.org>
AuthorDate: Sat Aug 12 16:58:30 2017 +0100

    Allow auth path to be overridden for testing
---
 lib/whimsy/asf/auth.rb | 25 +++++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)

diff --git a/lib/whimsy/asf/auth.rb b/lib/whimsy/asf/auth.rb
index d96fe65..32dd2bf 100644
--- a/lib/whimsy/asf/auth.rb
+++ b/lib/whimsy/asf/auth.rb
@@ -12,16 +12,24 @@ module ASF
 
     # Select a given <tt>-authorization-template</tt>, valid values are
     # <tt>asf</tt> and <tt>pit</tt>.
-    def initialize(file='asf')
+    # The optional <tt>auth_path</tt> parameter allows the directory path to 
be overridden
+    # This is intended for testing only
+    def initialize(file='asf',auth_path=nil)
       # TODO - should this read the Git repo directly?
       # Probably not: this file is read frequently so would need to be cached 
anyway
       # The Git clone is updated every 10 minutes which should be sufficiently 
recent
-      auth = ASF::Git.find('infrastructure-puppet')
-      if auth
-        @auth = auth + '/modules/subversion_server/files/authorization'
+      if auth_path
+        require 'wunderbar'
+        Wunderbar.warn "Overriding Git infrastructure-puppet auth path as: 
#{auth_path}"
+        @auth = auth_path
       else
-        # SVN copy is no longer in use - see INFRA-11452
-        raise Exception.new("Cannot find Git: infrastructure-puppet")
+        auth = ASF::Git.find('infrastructure-puppet')
+        if auth
+          @auth = auth + '/modules/subversion_server/files/authorization'
+        else
+          # SVN copy is no longer in use - see INFRA-11452
+          raise Exception.new("Cannot find Git: infrastructure-puppet")
+        end
       end
       @file = file
     end
@@ -44,6 +52,11 @@ module ASF
       arr
     end
 
+    # Return the auth path used to find asf-auth and pit-auth
+    def path
+      @auth
+    end
+
     unless Enumerable.instance_methods.include? :to_h
       # backwards compatibility for Ruby versions <= 2.0
       def to_h

-- 
To stop receiving notification emails like this one, please contact
['"commits@whimsical.apache.org" <commits@whimsical.apache.org>'].

Reply via email to