diff options
| author | s-ol <s-ol@users.noreply.github.com> | 2018-11-08 07:16:35 +0000 |
|---|---|---|
| committer | s-ol <s-ol@users.noreply.github.com> | 2018-11-08 07:16:35 +0000 |
| commit | f14faf29401cda74dfc8c21f8c2975ce26f03700 (patch) | |
| tree | 2b8dc84e8de7a5b1550c8dbcbe0984b331e0d644 /bundle.moon | |
| parent | recursive tup stuff (diff) | |
| download | mmm-f14faf29401cda74dfc8c21f8c2975ce26f03700.tar.gz mmm-f14faf29401cda74dfc8c21f8c2975ce26f03700.zip | |
move tree into dist, recurive tup rendering etc.
Diffstat (limited to 'bundle.moon')
| -rw-r--r-- | bundle.moon | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/bundle.moon b/bundle.moon index 8e277c7..1c6b5f6 100644 --- a/bundle.moon +++ b/bundle.moon @@ -23,29 +23,28 @@ with io.open output_name, 'w' else \write "return {\n" - for i=2, #arg - file = arg[i] + 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 - \write " -{ - module = #{escape dirname .. '.' .. module}, - file = #{escape dirname .. '/' .. file}, - source = #{escape source}, -}, - " + addmod module, file, source else module = file\gsub '%.lua$', '' + continue if module\match '%.server' + module = module\gsub '%.client$', '' module = module\gsub '%.init$', '' - \write " -{ - module = #{escape module}, - file = #{escape file}, - source = #{escape readfile file}, -}, - " + addmod module, file, readfile file \write "}" |
