Skip to content

Instantly share code, notes, and snippets.

@emekoi
Last active July 6, 2016 23:19
Show Gist options
  • Save emekoi/78e59793f626bcc7b0ece4652c99f9de to your computer and use it in GitHub Desktop.
Save emekoi/78e59793f626bcc7b0ece4652c99f9de to your computer and use it in GitHub Desktop.
build_box
box = {}
box.init = ->
f = io.open(".rules.moon", "wb")
f\write([[
file["main.moon"] = "main.moon"
action["main.moon"] = "echo #{file} changed"
{:file, :action}
]])
f:close!
box.watch = ->
while true
io.write("> ")
i = io.read!
os.execute(i)
box.upd = ->
dostring()
switch arg[1]
when nil
print [[
usage: build_box [commands]
Available commands are:
init create a new build_box environment
watch continually watch for changes and run `box upd` accordingly
upd check for changes run the predefined commands]]
when "init"
box.init!
when "upd"
nil
when "watch"
box.watch!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment