diff options
-rwxr-xr-x | bin/tissue | 97 | ||||
-rw-r--r-- | tissue/conditions.scm | 27 | ||||
-rw-r--r-- | tissue/web/server.scm | 1 | ||||
-rw-r--r-- | tissue/web/static.scm | 1 |
4 files changed, 45 insertions, 81 deletions
@@ -37,7 +37,6 @@ exec guile --no-auto-compile -s "$0" "$@" (git) (xapian wrap) (xapian xapian) - (tissue conditions) (tissue document) (tissue git) (tissue issue) @@ -311,57 +310,51 @@ top-level of the git repository." ((_ "run-web" args ...) (apply tissue-run-web args)) ((_ command args ...) - (guard (c ((issue-file-not-found-error? c) - (display (string-append "No such file or directory: " - (issue-file-not-found-error-issue-file c)) - (current-error-port)) - (newline (current-error-port)) - (exit #f))) - (call-with-current-directory (git-top-level) - (lambda () - (parameterize ((%aliases (tissue-configuration-aliases (load-config)))) - ;; Create hidden tissue directory unless it exists. - (unless (file-exists? %state-directory) - (mkdir %state-directory)) - ;; Ensure index exists rebuilding it if it is stale. - (let ((current-head - (oid->string (reference-name->oid - (current-git-repository) "HEAD")))) - (unless (and (file-exists? %xapian-index) - (string=? (call-with-database %xapian-index - (cut Database-get-metadata <> "commit")) - current-head)) - (guard (c (else (delete-xapian-index) - (display "Building xapian index failed." - (current-error-port)) - (raise c))) - (delete-xapian-index) - (call-with-writable-database %xapian-index - (lambda (db) - (for-each (lambda (indexed-document) - (let* ((document (slot-set ((indexed-document-reader indexed-document)) - 'web-uri - (indexed-document-web-uri indexed-document))) - (term-generator (document-term-generator document))) - (index-text! term-generator (document-type document) #:prefix "XT") - (replace-document! db - (document-id-term document) - (TermGenerator-get-document term-generator)))) - (tissue-configuration-indexed-documents (load-config))) - (WritableDatabase-set-metadata db "commit" current-head)))))) - ;; Handle sub-command. - (apply (match command - ("search" tissue-search) - ("show" tissue-show) - ("repl" tissue-repl) - ("web" tissue-web) - ("index" tissue-index) - (invalid-command - (format (current-error-port) "Invalid command `~a'~%~%" - invalid-command) - (print-usage) - (exit #f))) - args)))))) + (call-with-current-directory (git-top-level) + (lambda () + (parameterize ((%aliases (tissue-configuration-aliases (load-config)))) + ;; Create hidden tissue directory unless it exists. + (unless (file-exists? %state-directory) + (mkdir %state-directory)) + ;; Ensure index exists rebuilding it if it is stale. + (let ((current-head + (oid->string (reference-name->oid + (current-git-repository) "HEAD")))) + (unless (and (file-exists? %xapian-index) + (string=? (call-with-database %xapian-index + (cut Database-get-metadata <> "commit")) + current-head)) + (guard (c (else (delete-xapian-index) + (display "Building xapian index failed." + (current-error-port)) + (raise c))) + (delete-xapian-index) + (call-with-writable-database %xapian-index + (lambda (db) + (for-each (lambda (indexed-document) + (let* ((document (slot-set ((indexed-document-reader indexed-document)) + 'web-uri + (indexed-document-web-uri indexed-document))) + (term-generator (document-term-generator document))) + (index-text! term-generator (document-type document) #:prefix "XT") + (replace-document! db + (document-id-term document) + (TermGenerator-get-document term-generator)))) + (tissue-configuration-indexed-documents (load-config))) + (WritableDatabase-set-metadata db "commit" current-head)))))) + ;; Handle sub-command. + (apply (match command + ("search" tissue-search) + ("show" tissue-show) + ("repl" tissue-repl) + ("web" tissue-web) + ("index" tissue-index) + (invalid-command + (format (current-error-port) "Invalid command `~a'~%~%" + invalid-command) + (print-usage) + (exit #f))) + args))))) ;; tissue is an alias for `tissue search' ((_) (main "tissue" "search")))) diff --git a/tissue/conditions.scm b/tissue/conditions.scm deleted file mode 100644 index b2ae543..0000000 --- a/tissue/conditions.scm +++ /dev/null @@ -1,27 +0,0 @@ -;;; tissue --- Text based issue tracker -;;; Copyright © 2022 Arun Isaac <arunisaac@systemreboot.net> -;;; -;;; This file is part of tissue. -;;; -;;; tissue is free software: you can redistribute it and/or modify it -;;; under the terms of the GNU General Public License as published by -;;; the Free Software Foundation, either version 3 of the License, or -;;; (at your option) any later version. -;;; -;;; tissue is distributed in the hope that it will be useful, but -;;; WITHOUT ANY WARRANTY; without even the implied warranty of -;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;;; General Public License for more details. -;;; -;;; You should have received a copy of the GNU General Public License -;;; along with tissue. If not, see <https://www.gnu.org/licenses/>. - -(define-module (tissue conditions) - #:use-module (rnrs conditions) - #:export (issue-file-not-found-error - issue-file-not-found-error? - issue-file-not-found-error-issue-file)) - -(define-condition-type &issue-file-not-found-error &error - issue-file-not-found-error issue-file-not-found-error? - (issue-file issue-file-not-found-error-issue-file)) diff --git a/tissue/web/server.scm b/tissue/web/server.scm index be783db..06fb8de 100644 --- a/tissue/web/server.scm +++ b/tissue/web/server.scm @@ -33,7 +33,6 @@ (case symbol ((parse-query) 'xapian:parse-query) (else symbol)))) - #:use-module (tissue conditions) #:use-module (tissue document) #:use-module (tissue search) #:use-module (tissue utils) diff --git a/tissue/web/static.scm b/tissue/web/static.scm index d9a2fb1..bc759b2 100644 --- a/tissue/web/static.scm +++ b/tissue/web/static.scm @@ -29,7 +29,6 @@ #:use-module (skribilo evaluator) #:use-module (skribilo reader) #:use-module (web uri) - #:use-module (tissue conditions) #:use-module (tissue git) #:use-module (tissue issue) #:use-module (tissue utils) |