You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
777 B
30 lines
777 B
(in-package #:cl-user) |
|
(defpackage rails-to-caveman |
|
(:use #:cl) |
|
(:import-from #:rails-to-caveman.config |
|
#:config) |
|
(:import-from #:clack |
|
#:clackup) |
|
(:export #:start |
|
#:stop)) |
|
(in-package #:rails-to-caveman) |
|
|
|
(defvar *appfile-path* |
|
(asdf:system-relative-pathname :rails-to-caveman #P"app.lisp")) |
|
|
|
(defvar *handler* nil) |
|
|
|
(defun start (&rest args &key server port debug &allow-other-keys) |
|
(declare (ignore server port debug)) |
|
(when *handler* |
|
(restart-case (error "Server is already running.") |
|
(restart-server () |
|
:report "Restart the server" |
|
(stop)))) |
|
(setf *handler* |
|
(apply #'clackup *appfile-path* args))) |
|
|
|
(defun stop () |
|
(prog1 |
|
(clack:stop *handler*) |
|
(setf *handler* nil)))
|
|
|