mirror of
https://gitlab.com/eql/lqml.git
synced 2025-12-05 18:20:33 -08:00
add app template to simplify creating new apps
This commit is contained in:
parent
d7e3d7b46f
commit
3770db1756
23 changed files with 101 additions and 1 deletions
|
|
@ -1,3 +1,14 @@
|
|||
|
||||
Prepare
|
||||
-------
|
||||
|
||||
Please copy the app template files first:
|
||||
```
|
||||
$ cd ..
|
||||
$ ./copy.sh 9999
|
||||
```
|
||||
|
||||
|
||||
Info
|
||||
----
|
||||
|
||||
|
|
|
|||
2
examples/app-template/build/.gitignore
vendored
Normal file
2
examples/app-template/build/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
*
|
||||
!.gitignore
|
||||
2
examples/app-template/lisp/main.lisp
Normal file
2
examples/app-template/lisp/main.lisp
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
(in-package :app)
|
||||
|
||||
4
examples/app-template/lisp/package.lisp
Normal file
4
examples/app-template/lisp/package.lisp
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
(defpackage :app
|
||||
(:use :cl :qml)
|
||||
(:export))
|
||||
|
||||
6
examples/app-template/qml/main.qml
Normal file
6
examples/app-template/qml/main.qml
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
import QtQuick 2.15
|
||||
import QtQuick.Controls 2.15
|
||||
import Lisp 1.0
|
||||
|
||||
Item {
|
||||
}
|
||||
|
|
@ -38,6 +38,8 @@ $ make apk
|
|||
|
||||
$ ./install.sh
|
||||
```
|
||||
Log note: for showing only your own messages, see `log.sh`.
|
||||
|
||||
|
||||
|
||||
Build iOS app
|
||||
|
|
@ -65,4 +67,4 @@ Please note:
|
|||
If you cross-compiled ECL for the simulator, it should work there too, but this
|
||||
is currently only tested on **Intel**.
|
||||
|
||||
Simulator note: ensure the virtual keyboard is shown, see keys `cmd-k`.
|
||||
Simulator note: to show the virtual keyboard, use `cmd-k`.
|
||||
14
examples/app-template/readme.md
Normal file
14
examples/app-template/readme.md
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
|
||||
Run
|
||||
---
|
||||
|
||||
```
|
||||
lqml run.lisp
|
||||
```
|
||||
Optionally pass `-slime` to start a Swank server, and connect from Emacs with
|
||||
`M-x slime-connect`.
|
||||
|
||||
Closing the window quits the app. If you try to kill it with `ctrl-c`, you need
|
||||
an additional `ctrl-d` to exit from ECL. To quit from Slime, do `(qq)` which is
|
||||
short for `(qquit)`.
|
||||
|
||||
52
examples/copy-template.lisp
Normal file
52
examples/copy-template.lisp
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
;;; copies all template files to new directory passed as app name
|
||||
|
||||
(defvar *name* (first (last (ext:command-args))))
|
||||
|
||||
(when (search "copy-template" *name*)
|
||||
(print "Usage: ecl -shell copy-template.lisp <name>.")
|
||||
(terpri)
|
||||
(ext:quit))
|
||||
|
||||
(defun string-substitute (new old string)
|
||||
(let ((len (length old)))
|
||||
(with-output-to-string (s)
|
||||
(do ((e (search old string) (search old string :start2 (+ e len)))
|
||||
(b 0 (+ e len)))
|
||||
((not e) (write-string (subseq string b) s))
|
||||
(write-string (subseq string b e) s)
|
||||
(write-string new s)))))
|
||||
|
||||
(defun copy-stream (from to)
|
||||
(let ((buf (make-array 8192 :element-type (stream-element-type from))))
|
||||
(loop
|
||||
(let ((pos (read-sequence buf from)))
|
||||
(when (zerop pos)
|
||||
(return))
|
||||
(write-sequence buf to :end pos))))
|
||||
(values))
|
||||
|
||||
(defun copy-file (from to)
|
||||
(let ((element-type '(unsigned-byte 8)))
|
||||
(with-open-file (in from :element-type element-type)
|
||||
(with-open-file (out to :element-type element-type
|
||||
:direction :output :if-exists :supersede)
|
||||
(copy-stream in out)
|
||||
(finish-output out)
|
||||
(= (file-length in)
|
||||
(file-length out))))))
|
||||
|
||||
|
||||
(dolist (file (directory "app-template/**/*.*"))
|
||||
(let* ((from (namestring file))
|
||||
(to (string-substitute (format nil "/~A/" *name*)
|
||||
"/app-template/"
|
||||
from)))
|
||||
(if (probe-file to)
|
||||
(format t "~&skipping exisitng file: ~A" to)
|
||||
(progn
|
||||
(format t "~©ing file: ~A" to)
|
||||
(ensure-directories-exist to)
|
||||
(unless (copy-file from to)
|
||||
(error "File ~A could not be copied." to))))))
|
||||
|
||||
(terpri)
|
||||
1
examples/copy.sh
Executable file
1
examples/copy.sh
Executable file
|
|
@ -0,0 +1 @@
|
|||
ecl -shell copy-template.lisp $1
|
||||
6
examples/readme.md
Normal file
6
examples/readme.md
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
To add a new app from the template, run:
|
||||
|
||||
```
|
||||
$ ecl -shell copy-template.lisp <name>
|
||||
```
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue