aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authors-ol <s+removethis@s-ol.nu>2021-03-06 15:13:48 +0000
committers-ol <s+removethis@s-ol.nu>2021-03-06 15:13:48 +0000
commitdcf14ccfa1648cc375912b6da33a220033f3d63a (patch)
tree693e7c523801ef563e176c40962eb485bd685ace
parentbasic caching for fileder tree and conversion results (diff)
downloadmmm-dcf14ccfa1648cc375912b6da33a220033f3d63a.tar.gz
mmm-dcf14ccfa1648cc375912b6da33a220033f3d63a.zip
drop Tup dependency
-rw-r--r--.gitignore7
-rw-r--r--Dockerfile11
-rw-r--r--Tupfile4
-rw-r--r--Tuprules.tup4
-rw-r--r--build/bundle_module.moon51
-rw-r--r--build/bundle_modules.moon35
-rw-r--r--build/import.moon1
-rw-r--r--build/server.moon1
-rw-r--r--mmm/Tupdefault4
-rw-r--r--tup.config1
10 files changed, 40 insertions, 79 deletions
diff --git a/.gitignore b/.gitignore
index f7b8c9a..96cb06d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,8 +1 @@
-db.sqlite3
-root/static/style/text$css.css
root/static/mmm/text$lua.lua
-##### TUP GITIGNORE #####
-##### Lines below automatically generated by Tup.
-##### Do not edit.
-.tup
-/.gitignore
diff --git a/Dockerfile b/Dockerfile
index 3c718c5..996b358 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,11 +1,8 @@
FROM nickblah/lua:5.3-luarocks-stretch
-RUN echo "deb http://ppa.launchpad.net/jonathonf/tup/ubuntu xenial main" \
- >/etc/apt/sources.list.d/tup.list
RUN apt-get update && \
- apt-get install -y --allow-unauthenticated \
- build-essential m4 tup sassc \
- libmarkdown2-dev libsqlite3-dev libssl-dev
+ apt-get install -y \
+ build-essential m4 sassc libmarkdown2-dev libsqlite3-dev libssl-dev
RUN luarocks install discount DISCOUNT_INCDIR=/usr/include/x86_64-linux-gnu
RUN luarocks install sqlite3 && \
luarocks install moonscript && \
@@ -15,7 +12,9 @@ RUN luarocks install sqlite3 && \
COPY . /code
WORKDIR /code
-RUN tup init && tup generate build-static.sh && ./build-static.sh
+RUN mkdir -p root/static/mmm && \
+ find mmm -name '*.moon' | \
+ moon build/bundle_modules.moon 'root/static/mmm/text$lua.lua'
EXPOSE 8000
ENTRYPOINT ["moon", "build/server.moon"]
diff --git a/Tupfile b/Tupfile
deleted file mode 100644
index 66c31ab..0000000
--- a/Tupfile
+++ /dev/null
@@ -1,4 +0,0 @@
-include_rules
-
-# bundle for client loading
-: mmm/.bundle.lua | <modules> |> ^ WRAP %d^ moon &(build)/bundle_module.moon '%o' --wrap %f |> root/static/mmm/text$lua.lua
diff --git a/Tuprules.tup b/Tuprules.tup
deleted file mode 100644
index eec602c..0000000
--- a/Tuprules.tup
+++ /dev/null
@@ -1,4 +0,0 @@
-.gitignore
-
-&root = .
-&build = build
diff --git a/build/bundle_module.moon b/build/bundle_module.moon
deleted file mode 100644
index 1c6b5f6..0000000
--- a/build/bundle_module.moon
+++ /dev/null
@@ -1,51 +0,0 @@
-output_name = assert arg[1], "please specify the output directory"
-
-escape = (str) -> string.format '%q', str
-
-readfile = (name) ->
- file = io.open name, 'r'
- with file\read '*all'
- file\close
-
-with io.open output_name, 'w'
- -- final wrap mode
- if arg[2] == '--wrap'
- assert #arg == 3, "too many arguments for 'wrap' mode"
- bundle = arg[3]
-
- bundle = dofile bundle
- \write "local p = package.preload\n"
- for { :module, :file, :source } in *bundle
- module = escape module
- \write "if not p[#{module}] then p[#{module}] = load(#{escape source}, #{escape file}) end\n"
-
- -- iterative bundling mode
- else
- \write "return {\n"
-
- this = assert arg[2]
- addmod = (module, file, source) ->
- modname = "#{this}.#{module}"
- modname = this if module == 'init'
- \write "
-{
- module = #{escape modname},
- file = #{escape "#{this}/#{file}"},
- source = #{escape source},
-},"
-
- for file in *arg[3,]
- if dirname = file\match '^([%w-_]+)/%.bundle%.lua$'
- bundle = dofile file
- for { :module, :file, :source } in *bundle
- addmod module, file, source
- else
- module = file\gsub '%.lua$', ''
- continue if module\match '%.server'
- module = module\gsub '%.client$', ''
- module = module\gsub '%.init$', ''
- addmod module, file, readfile file
-
- \write "}"
-
- \close!
diff --git a/build/bundle_modules.moon b/build/bundle_modules.moon
new file mode 100644
index 0000000..9360eeb
--- /dev/null
+++ b/build/bundle_modules.moon
@@ -0,0 +1,35 @@
+moon = require 'moonscript.base'
+
+output_name = assert arg[1], "please specify the output directory"
+
+escape = (str) ->
+ string.format '%q', str
+
+readfile = (name) ->
+ file = io.open name, 'r'
+ with file\read '*all'
+ file\close
+
+out = io.open output_name, 'w'
+out\write "
+local p = {}
+table.insert(package.searchers, 1, function (mod)
+ print('?',mod, not not p[mod])
+ local mod = p[mod]
+ return mod and function ()
+ return load(table.unpack(mod))()
+ end
+end)
+"
+
+for file in io.lines!
+ module = file\gsub '%.moon$', ''
+ continue if not module or module\match '%.server'
+ module = module\gsub '%.client$', ''
+ module = module\gsub '/init$', ''
+ module = module\gsub '/', '.'
+ module = escape module
+ source = moon.to_lua readfile file
+ out\write "p[#{module}] = {#{escape source}, #{escape file}}\n"
+
+out\close!
diff --git a/build/import.moon b/build/import.moon
index 92d4397..6d9f791 100644
--- a/build/import.moon
+++ b/build/import.moon
@@ -34,7 +34,6 @@ with SQLStore :file, verbose: true
import_fileder = (fileder, dirpath) ->
for file in lfs.dir dirpath
continue if '.' == file\sub 1, 1
- continue if file == 'Tupdefault.lua'
continue if file == 'index.html'
continue if file == '$order'
diff --git a/build/server.moon b/build/server.moon
index 46ea737..7c03efd 100644
--- a/build/server.moon
+++ b/build/server.moon
@@ -20,7 +20,6 @@ import Browser from require 'mmm.mmmfs.browser'
import init_cache from require 'mmm.mmmfs.cache'
import decodeURI from require 'http.util'
-lfs = require 'lfs'
server = require 'http.server'
headers = require 'http.headers'
diff --git a/mmm/Tupdefault b/mmm/Tupdefault
deleted file mode 100644
index 8035ed5..0000000
--- a/mmm/Tupdefault
+++ /dev/null
@@ -1,4 +0,0 @@
-include_rules
-
-: foreach *.moon |> ^ MOON %f^ moonc -p > %o %f |> %B.lua <modules>
-: <modules> |> ^ BNDL %d^ moon &(build)/bundle_module.moon %o %d %<modules> |> .bundle.lua ../<modules>
diff --git a/tup.config b/tup.config
deleted file mode 100644
index f39ec4d..0000000
--- a/tup.config
+++ /dev/null
@@ -1 +0,0 @@
-CONFIG_FENGARI_VERSION=v0.1.4