+Shell, +A LOT
[lineal.git] / src / webui / serv.lisp
blob50ec28a7954a46f371f4c552f942354381842ec1
2 ;;; In the :lineal.webui package.
4 (format t "serv.lisp is loading...~%")
6 (format t "Using ASDF, you better have it loaded already...~%")
7 (use-package :asdf)
8 (format t "... looks like it worked.~%")
10 (format t "Loading package dependencies.~%")
12 ;V Load the required libraries using V
13 ;V functions best with the lisp. V
14 (mapcar
15 (lambda (pkg)
16 (format t "Loading ~A...~%" pkg)
17 #+(or :sbcl :mcl :ecl :cmucl)
18 (require pkg)
19 #-(or :sbcl :mcl :ecl :cmucl)
20 (asdf:operate 'asdf:load-op pkg)
21 (format t "... ~A loaded.~%" pkg))
22 (list :hunchentoot :cl-who :parenscript))
24 (format t "Compiling and loading source tree...~%")
25 ;V Compile and Load V
26 (compile-lineal :compile-all (boundp 'compile-all))
28 (format t "Generating JavaScript files if needed...~%")
29 (lineal.webui::recompile-ps)
30 (format t "... success! We are now w3c complaint!~%")
32 ;V Enact any config options.V
33 (when (boundp 'tmp-directory)
34 (ensure-directories-exist
35 (symbol-value 'tmp-directory))
36 (setf lineal.webui::*tmp-directory*
37 (symbol-value 'tmp-directory))
38 (format t "Custom tmp directory set to: ~A~%"
39 (truename (symbol-value 'tmp-directory))))
41 (when (boundp 'log-file)
42 (open (ensure-directories-exist
43 (symbol-value 'log-file))
44 :direction :probe :if-does-not-exist :create)
45 (setf (lineal.webui::log-file)
46 (symbol-value 'log-file))
47 (format t "Custom log file will be at: ~A~%"
48 (truename (symbol-value 'log-file))))
50 ;V Load up restore file.V
51 (when (boundp 'restore-from-file)
52 (let ((file (symbol-value 'restore-from-file)))
53 (unless (pathnamep file)
54 (setq file (make-pathname :name "captured_session")))
55 (format t "Restoring session from: \"~A\"...~%"
56 (namestring file))
57 (princ (lineal::local-restore file))
58 (fresh-line)))
60 ;V Start server at specified port. V
61 (let ((the-port (if (boundp 'port)
62 (symbol-value 'port) 41938)))
63 (format t "Starting Lineal on port ~A... " the-port)
64 (lineal.webui:start-server :port the-port)
65 (format t "OK~%Now point your bowser to ~
66 http://localhost:~A/ and have at it!~%"
67 the-port))
69 (import 'lineal::local-capture :cl-user)