git.s-ol.nu mmm / dcf14cc
drop Tup dependency s-ol a month ago
10 changed file(s) with 40 addition(s) and 79 deletion(s). Raw diff Collapse all Expand all
0 db.sqlite3
1 root/static/style/text$css.css
20 root/static/mmm/text$lua.lua
3 ##### TUP GITIGNORE #####
4 ##### Lines below automatically generated by Tup.
5 ##### Do not edit.
6 .tup
7 /.gitignore
00 FROM nickblah/lua:5.3-luarocks-stretch
11
2 RUN echo "deb http://ppa.launchpad.net/jonathonf/tup/ubuntu xenial main" \
3 >/etc/apt/sources.list.d/tup.list
42 RUN apt-get update && \
5 apt-get install -y --allow-unauthenticated \
6 build-essential m4 tup sassc \
7 libmarkdown2-dev libsqlite3-dev libssl-dev
3 apt-get install -y \
4 build-essential m4 sassc libmarkdown2-dev libsqlite3-dev libssl-dev
85 RUN luarocks install discount DISCOUNT_INCDIR=/usr/include/x86_64-linux-gnu
96 RUN luarocks install sqlite3 && \
107 luarocks install moonscript && \
1411
1512 COPY . /code
1613 WORKDIR /code
17 RUN tup init && tup generate build-static.sh && ./build-static.sh
14 RUN mkdir -p root/static/mmm && \
15 find mmm -name '*.moon' | \
16 moon build/bundle_modules.moon 'root/static/mmm/text$lua.lua'
1817
1918 EXPOSE 8000
2019 ENTRYPOINT ["moon", "build/server.moon"]
+0
-4
Tupfile less more
0 include_rules
1
2 # bundle for client loading
3 : mmm/.bundle.lua | <modules> |> ^ WRAP %d^ moon &(build)/bundle_module.moon '%o' --wrap %f |> root/static/mmm/text$lua.lua
+0
-4
Tuprules.tup less more
0 .gitignore
1
2 &root = .
3 &build = build
+0
-51
build/bundle_module.moon less more
0 output_name = assert arg[1], "please specify the output directory"
1
2 escape = (str) -> string.format '%q', str
3
4 readfile = (name) ->
5 file = io.open name, 'r'
6 with file\read '*all'
7 file\close
8
9 with io.open output_name, 'w'
10 -- final wrap mode
11 if arg[2] == '--wrap'
12 assert #arg == 3, "too many arguments for 'wrap' mode"
13 bundle = arg[3]
14
15 bundle = dofile bundle
16 \write "local p = package.preload\n"
17 for { :module, :file, :source } in *bundle
18 module = escape module
19 \write "if not p[#{module}] then p[#{module}] = load(#{escape source}, #{escape file}) end\n"
20
21 -- iterative bundling mode
22 else
23 \write "return {\n"
24
25 this = assert arg[2]
26 addmod = (module, file, source) ->
27 modname = "#{this}.#{module}"
28 modname = this if module == 'init'
29 \write "
30 {
31 module = #{escape modname},
32 file = #{escape "#{this}/#{file}"},
33 source = #{escape source},
34 },"
35
36 for file in *arg[3,]
37 if dirname = file\match '^([%w-_]+)/%.bundle%.lua$'
38 bundle = dofile file
39 for { :module, :file, :source } in *bundle
40 addmod module, file, source
41 else
42 module = file\gsub '%.lua$', ''
43 continue if module\match '%.server'
44 module = module\gsub '%.client$', ''
45 module = module\gsub '%.init$', ''
46 addmod module, file, readfile file
47
48 \write "}"
49
50 \close!
0 moon = require 'moonscript.base'
1
2 output_name = assert arg[1], "please specify the output directory"
3
4 escape = (str) ->
5 string.format '%q', str
6
7 readfile = (name) ->
8 file = io.open name, 'r'
9 with file\read '*all'
10 file\close
11
12 out = io.open output_name, 'w'
13 out\write "
14 local p = {}
15 table.insert(package.searchers, 1, function (mod)
16 print('?',mod, not not p[mod])
17 local mod = p[mod]
18 return mod and function ()
19 return load(table.unpack(mod))()
20 end
21 end)
22 "
23
24 for file in io.lines!
25 module = file\gsub '%.moon$', ''
26 continue if not module or module\match '%.server'
27 module = module\gsub '%.client$', ''
28 module = module\gsub '/init$', ''
29 module = module\gsub '/', '.'
30 module = escape module
31 source = moon.to_lua readfile file
32 out\write "p[#{module}] = {#{escape source}, #{escape file}}\n"
33
34 out\close!
3333 import_fileder = (fileder, dirpath) ->
3434 for file in lfs.dir dirpath
3535 continue if '.' == file\sub 1, 1
36 continue if file == 'Tupdefault.lua'
3736 continue if file == 'index.html'
3837 continue if file == '$order'
3938
1919 import init_cache from require 'mmm.mmmfs.cache'
2020 import decodeURI from require 'http.util'
2121
22 lfs = require 'lfs'
2322 server = require 'http.server'
2423 headers = require 'http.headers'
2524
+0
-4
mmm/Tupdefault less more
0 include_rules
1
2 : foreach *.moon |> ^ MOON %f^ moonc -p > %o %f |> %B.lua <modules>
3 : <modules> |> ^ BNDL %d^ moon &(build)/bundle_module.moon %o %d %<modules> |> .bundle.lua ../<modules>
+0
-1
tup.config less more
0 CONFIG_FENGARI_VERSION=v0.1.4