guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

03/03: services: cgit: Make project-list permit a file-object.


From: Christopher Baines
Subject: 03/03: services: cgit: Make project-list permit a file-object.
Date: Fri, 18 May 2018 12:25:02 -0400 (EDT)

cbaines pushed a commit to branch master
in repository guix.

commit 6ee3f3dec72f87187226bc11ff190f030169e55a
Author: Christopher Baines <address@hidden>
Date:   Wed Apr 25 08:18:38 2018 +0100

    services: cgit: Make project-list permit a file-object.
    
    Instead of having the service manage the list, it's useful to be able to 
point
    this at an existing file, for example, when using cgit together with 
gitolite.
    
    * gnu/services/cgit.scm (project-list?): New procedure.
    (serialize-project-list): Handle file-object values.
    (<cgit-configuration>): Change the predicate for project-list to allow lists
    and file-objects.
---
 doc/guix.texi         |  2 +-
 gnu/services/cgit.scm | 10 ++++++++--
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 005c059..81ad4f4 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -19241,7 +19241,7 @@ Defaults to @samp{#f}.
 
 @end deftypevr
 
address@hidden address@hidden parameter} list project-list
address@hidden address@hidden parameter} project-list project-list
 A list of subdirectories inside of @code{repository-directory}, relative
 to it, that should loaded as Git repositories.  An empty list means that
 all subdirectories will be loaded.
diff --git a/gnu/services/cgit.scm b/gnu/services/cgit.scm
index 3183535..3289d37 100644
--- a/gnu/services/cgit.scm
+++ b/gnu/services/cgit.scm
@@ -116,6 +116,10 @@
 (define (serialize-file-object field-name val)
   (serialize-string field-name val))
 
+(define (project-list? val)
+  (or (list? val)
+      (file-object? val)))
+
 
 ;;;
 ;;; Serialize <nginx-server-configuration>
@@ -168,7 +172,9 @@
   (if (null? val) ""
       (serialize-field
        'project-list
-       (plain-file "project-list" (string-join val "\n")))))
+       (if (file-object? val)
+           val
+           (plain-file "project-list" (string-join val "\n"))))))
 
 (define (serialize-extra-options extra-options)
   (string-join extra-options "\n" 'suffix))
@@ -547,7 +553,7 @@ disabled.")
    "Flag which, when set to @samp{#t}, will make cgit omit the standard
 header on all pages.")
   (project-list
-   (list '())
+   (project-list '())
    "A list of subdirectories inside of @code{repository-directory}, relative
 to it, that should loaded as Git repositories.  An empty list means that all
 subdirectories will be loaded.")



reply via email to

[Prev in Thread] Current Thread [Next in Thread]