diff options
author | Arun Isaac | 2022-12-24 00:40:35 +0000 |
---|---|---|
committer | Arun Isaac | 2022-12-24 19:27:59 +0000 |
commit | 49e8367d19ba921063d350559f4a7bb9d2ab55cc (patch) | |
tree | 40075d81663a464e2c13ea78f963cfc43f39259f | |
parent | 6f56c8a021ce51244525c4043d59a99d09fbedba (diff) | |
download | tissue-49e8367d19ba921063d350559f4a7bb9d2ab55cc.tar.gz tissue-49e8367d19ba921063d350559f4a7bb9d2ab55cc.tar.lz tissue-49e8367d19ba921063d350559f4a7bb9d2ab55cc.zip |
bin: Expose new development web server.
* bin/tissue: Import (tissue web dev).
(tissue-web-dev): Run the new development web server.
(main): Remove web-build command.
(print-usage): Delist deprecated web-build command. Update synopsis of
web-dev command.
(tissue-web-build): Delete function.
-rwxr-xr-x | bin/tissue | 52 |
1 files changed, 9 insertions, 43 deletions
@@ -47,6 +47,7 @@ exec guile --no-auto-compile -s "$0" "$@" (tissue search) (tissue tissue) (tissue utils) + (tissue web dev) (tissue web server) (tissue web static)) @@ -284,37 +285,11 @@ Serve repositories specified in CONFIG-FILE over HTTP. ,@parameters)))))) (assq-ref args 'hosts))))))) -(define tissue-web-build - (match-lambda* - (("--help") - (format #t "Usage: ~a web-build WEBSITE-DIRECTORY -Build website of current repository. -" - (command-line-program))) - ((website-directory) - (let ((config (load-config))) - (guard (c (else (format (current-error-port) - "Building website failed.~%") - (raise c))) - (call-with-temporary-directory - (lambda (temporary-output-directory) - (build-website (git-top-level) - temporary-output-directory - (tissue-configuration-web-css config) - (tissue-configuration-web-files config)) - (delete-file-recursively website-directory) - (rename-file temporary-output-directory - website-directory) - (chmod website-directory #o755)) - (dirname website-directory)))) - (format (current-error-port) - "Built website.~%")))) - (define tissue-web-dev (match-lambda* (("--help") - (format #t "Usage: ~a web-dev WEBSITE-DIRECTORY -Serve built website and issues of current repository. + (format #t "Usage: ~a web-dev +Serve website and issues of current repository. --port=PORT run web server listening on PORT (default: 8080) --listen-repl=P run REPL server listening on port or path P @@ -330,21 +305,14 @@ Serve built website and issues of current repository. (string->number arg) result)))) invalid-option - (lambda (arg result) - (acons 'website-directory arg result)) + unrecognized-argument '((port . 8080))))) - (unless (assq-ref args 'website-directory) - (raise (condition (make-user-error-condition) - (make-message-condition "Argument WEBSITE-DIRECTORY is required.")))) (when (assq-ref args 'listen-repl) (start-repl (assq-ref args 'listen-repl))) - (start-web-server (make-socket-address - AF_INET (inet-pton AF_INET "127.0.0.1") (assq-ref args 'port)) - `(("localhost" - (css . ,(tissue-configuration-web-css (load-config))) - (repository-directory . ,(repository-directory (current-git-repository))) - (website-directory . ,(assq-ref args 'website-directory)) - (xapian-directory . ,%xapian-index)))))))) + (start-dev-web-server (assq-ref args 'port) + %xapian-index + (tissue-configuration-web-css (load-config)) + (tissue-configuration-web-files (load-config))))))) (define (print-usage) (format #t "Usage: ~a COMMAND [OPTIONS] [ARGS] @@ -356,8 +324,7 @@ COMMAND must be one of the sub-commands listed below: repl run a Guile script in a tissue environment Develop: - web-build build website of current repository - web-dev serve built website and issues of current repository + web-dev serve website and issues of current repository Deploy: web serve one or more repositories over HTTP @@ -540,7 +507,6 @@ Pull latest from upstream repositories. ("search" tissue-search) ("show" tissue-show) ("repl" tissue-repl) - ("web-build" tissue-web-build) ("web-dev" tissue-web-dev) (invalid-command (format (current-error-port) "Invalid command `~a'~%~%" |