diff options
Diffstat (limited to 'bin/tissue')
-rwxr-xr-x | bin/tissue | 86 |
1 files changed, 45 insertions, 41 deletions
@@ -108,7 +108,7 @@ Show the text of FILE. " (command-line-program))) ((file) - (call-with-file-in-git (current-git-repository) file + (call-with-input-file file (lambda (port) (port-transduce (compose @@ -152,7 +152,7 @@ Show the text of FILE. (define (load-config) "Load configuration and return <tissue-configuration> object." - (call-with-file-in-git (current-git-repository) "tissue.scm" + (call-with-input-file "tissue.scm" (compose eval-string get-string-all))) (define tissue-repl @@ -278,7 +278,10 @@ Serve repositories specified in CONFIG-FILE over HTTP. (parameterize ((%current-git-repository (repository-open repository-directory))) (cons name - `((project . ,(load-config)) + `((project . ,(call-with-temporary-checkout repository-directory + (lambda (temporary-checkout) + (call-with-current-directory temporary-checkout + load-config)))) (repository-directory . ,repository-directory) (website-directory . ,(string-append state-directory "/" name "/website")) (xapian-directory . ,(string-append state-directory "/" name "/xapian")) @@ -401,44 +404,45 @@ HOSTNAME." (format (current-error-port) "Cloned upstream repository.~%") repository))))) - (let ((config (load-config))) - (parameterize ((%aliases (tissue-configuration-aliases config))) - (call-with-temporary-checkout (git-top-level) - (lambda (temporary-repository-clone) - ;; Add the top level of the git repository to the - ;; load path since there may be user-written - ;; modules in the repository. - ;; TODO: Though not strictly required, it would - ;; be better to remove the added load path once - ;; done. - (add-to-load-path temporary-repository-clone) - ;; Index. - (unless (file-exists? "xapian") - (mkdir "xapian")) - (let ((xapian-directory (canonicalize-path "xapian"))) - (call-with-current-directory temporary-repository-clone - (cut index - xapian-directory - (tissue-configuration-indexed-documents config))) - (format (current-error-port) - "Indexed latest changes.~%")) - ;; Build website. - (let ((website-directory "website")) - (guard (c (else (format (current-error-port) - "Building website failed.~%") - (raise c))) - (call-with-temporary-directory - (lambda (temporary-output-directory) - (call-with-current-directory temporary-repository-clone - (cut build-website - temporary-output-directory - (tissue-configuration-web-files config))) - (delete-file-recursively website-directory) - (rename-file temporary-output-directory - website-directory))) - (chmod website-directory #o755) - (format (current-error-port) - "Built website.~%")))))))))))))) + (call-with-temporary-checkout (git-top-level) + (lambda (temporary-repository-clone) + (let ((config (call-with-current-directory temporary-repository-clone + load-config))) + (parameterize ((%aliases (tissue-configuration-aliases config))) + ;; Add the top level of the git repository to the + ;; load path since there may be user-written + ;; modules in the repository. + ;; TODO: Though not strictly required, it would + ;; be better to remove the added load path once + ;; done. + (add-to-load-path temporary-repository-clone) + ;; Index. + (unless (file-exists? "xapian") + (mkdir "xapian")) + (let ((xapian-directory (canonicalize-path "xapian"))) + (call-with-current-directory temporary-repository-clone + (cut index + xapian-directory + (tissue-configuration-indexed-documents config))) + (format (current-error-port) + "Indexed latest changes.~%")) + ;; Build website. + (let ((website-directory "website")) + (guard (c (else (format (current-error-port) + "Building website failed.~%") + (raise c))) + (call-with-temporary-directory + (lambda (temporary-output-directory) + (call-with-current-directory temporary-repository-clone + (cut build-website + temporary-output-directory + (tissue-configuration-web-files config))) + (delete-file-recursively website-directory) + (rename-file temporary-output-directory + website-directory))) + (chmod website-directory #o755) + (format (current-error-port) + "Built website.~%")))))))))))))) (define tissue-pull (match-lambda* |