From f14faf29401cda74dfc8c21f8c2975ce26f03700 Mon Sep 17 00:00:00 2001 From: s-ol Date: Thu, 8 Nov 2018 18:16:35 +1100 Subject: move tree into dist, recurive tup rendering etc. --- render.moon | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'render.moon') diff --git a/render.moon b/render.moon index 66272ec..681b1db 100644 --- a/render.moon +++ b/render.moon @@ -4,19 +4,27 @@ import render from require 'mmm.mmmfs' import load_fileder from require 'mmm.mmmfs.fs' -- usage: --- moon render.moon -{ output_name, path } = arg +-- moon render.moon +{ root } = arg -assert output_name, "please specify the output filename as an argument" -assert path, "please specify the path name to build as an argument" +assert root, "please specify the relative root path as an argument" -root = load_fileder 'root' .. path -root\mount path +require 'lfs' +cwd = lfs.currentdir! +path = '' + +while root\find '^%.%./' + root = root\match '^%.%./(.*)' + cwd, trimmed = cwd\match '(.*)(/[^/]+)$' + path = trimmed .. path + +root = dofile '$bundle.lua' +root\mount path, true content, rehydrate = render root, path assert content, "no content" -with io.open output_name, 'w' +with io.open 'index.html', 'w' \write " @@ -39,8 +47,7 @@ with io.open output_name, 'w' - - + #{rehydrate} -- cgit v1.2.3 From 95624c5cfae37bcd378263735daa16b2b0fb60c4 Mon Sep 17 00:00:00 2001 From: s-ol Date: Thu, 8 Nov 2018 19:53:27 +1100 Subject: cleanup --- render.moon | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'render.moon') diff --git a/render.moon b/render.moon index 681b1db..5284e66 100644 --- a/render.moon +++ b/render.moon @@ -1,7 +1,5 @@ -package.moonpath = './?.server.moon;./?/init.server.moon;' .. package.moonpath -require 'mmm.init' +require 'mmm' import render from require 'mmm.mmmfs' -import load_fileder from require 'mmm.mmmfs.fs' -- usage: -- moon render.moon -- cgit v1.2.3