Skip to content

Commit ef1c774

Browse files
committed
refactor(web): replace weblocks with reblocks
weblocks was discontinued in favor of reblocks. More details at https://40ants.com/reblocks/
1 parent d05ef6b commit ef1c774

File tree

3 files changed

+35
-27
lines changed

3 files changed

+35
-27
lines changed

lisp-inference.asd

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,12 @@
2929
:version "0.2.0"
3030
:serial t
3131
:depends-on (:lisp-inference
32-
:weblocks
33-
:weblocks-ui
32+
:reblocks
33+
:reblocks-ui
3434
:clack-handler-hunchentoot
3535
:find-port
36-
:str)
36+
:str
37+
:40ants-routes)
3738
:pathname "web"
3839
:components ((:file "webapp")))
3940

roswell/inference-server.ros

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,20 @@
44
exec ros -Q -- $0 "$@"
55
|#
66

7-
#+quicklisp (defun ensure-dist-installed (dist nick)
8-
(let ((d (ql-dist:find-dist nick)))
9-
(when (not (and d (ql-dist:installedp d)))
10-
(ql-dist:install-dist dist
11-
:prompt nil))))
7+
#+quicklisp
8+
(defun ensure-dist-installed-and-updated (dist nick)
9+
(let ((d (ql-dist:find-dist nick)))
10+
(if (not (and d (ql-dist:installedp d)))
11+
(ql-dist:install-dist dist
12+
:prompt nil))
13+
(ql:update-dist nick :prompt nil)))
1214

1315
(progn ;;init forms
1416
(ros:ensure-asdf)
15-
#+quicklisp (progn
16-
(ensure-dist-installed "http://dist.ultralisp.org" "ultralisp")
17-
(ql:quickload '(lisp-inference/web)))
18-
17+
#+quicklisp
18+
(progn
19+
(ensure-dist-installed-and-updated "http://dist.ultralisp.org" "ultralisp")
20+
(ql:quickload '(lisp-inference/web)))
1921
)
2022

2123
(defpackage :ros.script.lisp-inference/web

web/webapp.lisp

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,26 @@
11
(defpackage lisp-inference/web
22
(:use #:cl
3-
#:weblocks-ui/form
4-
#:weblocks/html)
5-
(:import-from #:weblocks/widget
3+
#:reblocks-ui/form
4+
#:reblocks/html)
5+
(:import-from #:reblocks/widget
66
#:render
77
#:update
88
#:defwidget)
9-
(:import-from #:weblocks/actions
9+
(:import-from #:reblocks/actions
1010
#:make-js-action)
11-
(:import-from #:weblocks/app
11+
(:import-from #:reblocks/app
1212
#:defapp)
13+
(:import-from #:reblocks-ui/core
14+
#:ui-widget)
15+
(:import-from #:reblocks/page
16+
#:init-page)
1317
(:export #:start
1418
#:stop
1519
#:*notes*
1620
#:*proposition*
1721
#:*port*)
1822
(:nicknames #:webapp))
23+
;; reblocks docs: https://40ants.com/reblocks/
1924

2025
(in-package lisp-inference/web)
2126

@@ -30,7 +35,7 @@
3035
:prefix "/"
3136
:description "Lisp Inference Truth Table")
3237

33-
(defwidget table ()
38+
(defwidget table (ui-widget)
3439
((prop
3540
:initarg :prop
3641
:accessor prop)
@@ -57,10 +62,10 @@
5762
(update table))
5863

5964
(defmethod render ((table table))
60-
(with-html
65+
(reblocks/html:with-html ()
6166
(:h1 :align "center" "Lisp Inference Truth Table System")
6267
(:div :align "center"
63-
(with-html-form (:POST (lambda (&key prop &allow-other-keys)
68+
(reblocks-ui/form:with-html-form (:POST (lambda (&key prop &allow-other-keys)
6469
(update-table table prop)))
6570
(:input :type "text"
6671
:name "prop"
@@ -82,17 +87,17 @@
8287
"https://lerax.me/lisp-inference" "lerax.me/lisp-inference"))))
8388

8489
(defun render-note (string)
85-
(with-html
90+
(reblocks/html:with-html ()
8691
(:pre string)))
8792

88-
(defmethod weblocks/session:init ((app truth-table))
89-
(declare (ignorable app))
93+
(defmethod reblocks/page:init-page ((app truth-table) (url-path string) expire-at)
94+
(declare (ignorable app url-path expire-at))
9095
(create-table *proposition*))
9196

9297
(defun start (&optional (port *port*))
93-
(weblocks/debug:on)
94-
(weblocks/server:stop)
95-
(weblocks/server:start :port port))
98+
(reblocks/debug:on)
99+
(reblocks/server:stop)
100+
(reblocks/server:start :port port))
96101

97102
(defun stop ()
98-
(weblocks/server:stop))
103+
(reblocks/server:stop))

0 commit comments

Comments
 (0)