aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authors-ol <s-ol@users.noreply.github.com>2020-03-03 16:32:49 +0000
committers-ol <s-ol@users.noreply.github.com>2020-03-05 10:36:33 +0000
commit12dc8c05854054e1bb05709afdcdeec5e8b05333 (patch)
treecd07c81075fb311d8f6a1dfd04c66777c9187e51
parentadd index and guide pages (diff)
downloadalive-12dc8c05854054e1bb05709afdcdeec5e8b05333.tar.gz
alive-12dc8c05854054e1bb05709afdcdeec5e8b05333.zip
add Dockerfile for CI
-rw-r--r--.dockerignore2
-rw-r--r--Dockerfile16
-rw-r--r--README.md10
-rw-r--r--extra/docs.moon9
-rw-r--r--lib/pilot.moon4
5 files changed, 36 insertions, 5 deletions
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000..97b243e
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,2 @@
+docs/references
+docs/*.html
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..6374991
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,16 @@
+FROM nickblah/lua:5.3-luarocks-stretch AS build-env
+
+WORKDIR /build
+RUN apt-get update && \
+ apt-get install -y --allow-unauthenticated \
+ build-essential m4 libmarkdown2-dev
+
+RUN luarocks install discount DISCOUNT_INCDIR=/usr/include/x86_64-linux-gnu && \
+ luarocks install moonscript
+
+COPY . /build/
+RUN make docs
+
+FROM nginx:alpine
+COPY --from=build-env /build/docs /usr/share/nginx/html
+RUN chmod 555 -R /usr/share/nginx/html
diff --git a/README.md b/README.md
index 0f1c359..93403f6 100644
--- a/README.md
+++ b/README.md
@@ -9,12 +9,15 @@ text-based language and works without special editor support.
## dependencies
- [MoonScript][moonscript]: `luarocks install moonscript`
-- [luafilesystem][lfs]: `luarocks install luafilesystem`
-- [LPeg][lpeg]: `luarocks install lpeg`
+- [luafilesystem][lfs]*: `luarocks install luafilesystem`
+- [LPeg][lpeg]*: `luarocks install lpeg`
- [osc][osc]: `luarocks install osc`
- [socket][socket]: `luarocks install luasocket`
- [system][system]: `luarocks install luasystem`
-- [discount][discount]: `luarocks install discout` (optional, for docs)
+- [lua-rtmidi][rtmidi]: `luarocks install https://raw.githubusercontent.com/s-ol/lua-rtmidi/master/lua-rtmidi-dev-1.rockspec`
+- [discount][discount]: `luarocks install discount` (optional, for docs)
+
+\* these are also `moonscript` dependencies and do not neet to be installed manually.
## docs
@@ -31,3 +34,4 @@ with `make` the HTML documentation is generated in `docs/`.
[system]: https://github.com/o-lim/luasystem
[socket]: http://w3.impa.br/~diego/software/luasocket/
[discount]: https://luarocks.org/modules/craigb/discount
+[rtmidi]: https://github.com/s-ol/lua-rtmidi/
diff --git a/extra/docs.moon b/extra/docs.moon
index 9e478e9..b9fe88b 100644
--- a/extra/docs.moon
+++ b/extra/docs.moon
@@ -2,7 +2,7 @@ import Value, Scope from require 'core'
import render, layout from require 'extra.layout'
import section, h2, p, ul, li, a, code, r from require 'extra.dom'
-export OUT
+export OUT, require
{ OUT, command } = arg
slurp = (file) ->
@@ -19,6 +19,13 @@ spit OUT, switch command
when 'module'
{ _, _, module, name } = arg
+ require = do
+ old_require = require
+ blacklist = {k, true for k in *{'osc', 'socket', 'system', 'luartmidi'}}
+ (mod, ...) ->
+ return {} if blacklist[mod]
+ old_require mod, ...
+
name or= module
module = Scope.from_table require module
diff --git a/lib/pilot.moon b/lib/pilot.moon
index 7251f55..5c680ed 100644
--- a/lib/pilot.moon
+++ b/lib/pilot.moon
@@ -1,7 +1,8 @@
import Op, EventInput, ValueInput, ColdInput, match from require 'core.base'
import udp from require 'socket'
-conn = udp!
+local conn
+
hex = "0123456789abcdef"
encode = (arg) ->
switch type arg
@@ -16,6 +17,7 @@ send = (...) ->
for i = 1, select '#', ...
tbl = select i, ...
str ..= table.concat [encode v for v in *tbl]
+ conn or= udp!
conn\sendto str, '127.0.0.1', 49161
class play extends Op