-
Notifications
You must be signed in to change notification settings - Fork 1
/
create_everything.sh
executable file
·25 lines (19 loc) · 997 Bytes
/
create_everything.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/sh
cat > LunoPunk/everything.moon <<EOL
-- Auto-generated with $0 on $(command date +"%F %T")
-- We tell Moonscript to export classes globally. Thus, we prevent collisions
-- based on namespace since we don't know what is going to be used.
--
-- This provides two options for getting the class, calling require again and
-- assigning it to a local variable. Alternatively, the namespaced version can
-- be used.
import mixin_table from require "moon"
export LunoPunk
$(find LunoPunk -type d | sed "s,/,.,g" | awk '{print $1" = "$1" or {}"}' | sort -z)
import extract_love_version, set_love_title from require "LunoPunk.Config"
extract_love_version love._version
set_love_title!
-- Now load each file to the correctly namespaced table
$(find LunoPunk -iname "*.moon" | sed -e "s,/,.,g" -e "s/\.\(\w*\)\.moon$/ \1/" | awk '{ print "mixin_table "$1", if t = assert(require \""$1"."$2"\") then t if type(t) == \"table\" else {} else {}"}' | grep -v "everything" | sort)
{ :LunoPunk }
EOL