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 2019/11/25 19:42:35 UTC

[whimsy] branch master updated: Make setting of root explicit

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


The following commit(s) were added to refs/heads/master by this push:
     new 083860e  Make setting of root explicit
083860e is described below

commit 083860e5197b6a16e0cab3770e76c6e095c60680
Author: Sam Ruby <ru...@intertwingly.net>
AuthorDate: Mon Nov 25 14:42:16 2019 -0500

    Make setting of root explicit
---
 lib/whimsy/asf/config.rb | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/lib/whimsy/asf/config.rb b/lib/whimsy/asf/config.rb
index 1508342..e077283 100644
--- a/lib/whimsy/asf/config.rb
+++ b/lib/whimsy/asf/config.rb
@@ -15,10 +15,14 @@ module ASF
   #
   # Additionally, a search is made for .whimsy files in the current working
   # directory and then working up the directory path and finally in /srv.
-  # If such a .whimsy file is found, it will not only be processed for
-  # overrides to the configuration, it will establish the default root
-  # directory for a number of files/directories (among them, svn, git,
-  # and subscriptions).
+  # If such a .whimsy file is found, it will be processed for
+  # overrides to the configuration.
+  #
+  # The configuration value of :root:, if provided, will establish the default
+  # root directory for a number of files/directories (among them, svn, git, and
+  # subscriptions).  If the value is '.' and the parent directory for this
+  # file contains a `whimsy` subdirectory, then the parent directory will
+  # be considered the root.
   #
   class Config
     @home = ENV['HOME'] || Dir.home(Etc.getpwuid.name)
@@ -45,7 +49,13 @@ module ASF
     end
 
     # capture root
-    @config[:root] ||= @root
+    if @config[:root] == '.'
+      @config[:root] ||= @root
+    elsif @config[:root]
+      @root = @config[:root]
+    else
+      @root = '/srv'
+    end
 
     # allow for test overrides
     @testdata = {}