batch command line rendering of .clog files

This commit is contained in:
David Botton 2022-08-31 13:58:17 -04:00
parent 417aedd981
commit 780918d1ed
4 changed files with 40 additions and 19 deletions

View file

@ -173,9 +173,17 @@
(let ((app (make-instance 'app-data)))
(setf (connection-data-item body "app-data") app))
(display-splash body)
(start-game body))
(start-game body)
;; When *app-mode* set only run the game once and then shutdown the app
(when *app-mode*
(clog:shutdown)
(uiop:quit)))
(defun start-demo (&key (host "0.0.0.0") (port 8080))
"Start demo."
(defparameter *app-mode* nil)
(defun start-demo (&key (host "0.0.0.0") (port 8080) app)
"Start demo. If app is t, runs one game and shutsdown."
(initialize 'on-new-window :host host :port port)
(open-browser :url (format nil "http://127.0.0.1:~A" port)))
(if app
(setf *app-mode* app)
(open-browser :url (format nil "http://127.0.0.1:~A" port))))

1
run-render Executable file
View file

@ -0,0 +1 @@
sbcl --eval "(ql:quickload :clog/tools)" --eval "(clog-tools:clog-builder :port 0 :app :batch :project $1)"

View file

@ -155,18 +155,26 @@
(add-select-option (designtime-list panel) "" "Missing /tools")
(add-select-option (design-deps panel) "" "Missing /tools"))))
(t
(confirm-dialog panel "Load project?"
(lambda (answer)
(cond (answer
(ql:quickload sel)
(ignore-errors
(ql:quickload (format nil "~A/tools" sel)))
(ql:quickload sel)
(projects-populate panel))
(t
(setf (current-project app) nil)
(setf (text-value (project-list panel)) "None"))))
:title "System not loaded"))))))
(flet ((load-proj (answer)
(cond (answer
(ql:quickload sel)
(ignore-errors
(ql:quickload (format nil "~A/tools" sel)))
(ql:quickload sel)
(projects-populate panel))
(t
(setf (current-project app) nil)
(setf (text-value (project-list panel)) "None")))))
(cond ((eq *app-mode* :batch)
(load-proj t)
(projects-rerender panel)
(clog:shutdown)
(uiop:quit))
(t
(confirm-dialog panel "Load project?"
(lambda (answer)
(load-proj answer))
:title "System not loaded")))))))))
(defun projects-add-dep (panel sys)
(Input-dialog panel "Enter system name:"

View file

@ -2685,8 +2685,11 @@ of controls and double click to select control."
(defun clog-builder (&key (port 8080) (start-browser t)
app project static-root system)
"Start clog-builder. When port is 0 choose a random port. When app is
t, shutdown clog on termination of first window."
"Start clog-builder. When PORT is 0 choose a random port. When APP is
t, shutdown applicatoin on termination of first window. If APP eq :BATCH then
must specific default project :PROJECT and it will be batch rerendered
and shutdown application. You can set the specific STATIC-ROOT or set SYSTEM
to use that asdf system's static root."
(if project
(setf *start-project* (string-downcase (format nil "~A" project)))
(setf *start-project* nil))
@ -2694,7 +2697,7 @@ t, shutdown clog on termination of first window."
(setf static-root (merge-pathnames "./www/"
(asdf:system-source-directory system))))
(when app
(setf *app-mode* t))
(setf *app-mode* app))
(when (eql port 0)
(setf port (clog-connection:random-port)))
(if static-root
@ -2705,4 +2708,5 @@ t, shutdown clog on termination of first window."
(set-on-new-window 'on-attach-builder-page :path "/builder-page")
(set-on-new-window 'on-convert-image :path "/image-to-data")
(when start-browser
(format t "If browser does not start go to http://127.0.0.1:~A/builder" port)
(open-browser :url (format nil "http://127.0.0.1:~A/builder" port))))