Skip to content

Instantly share code, notes, and snippets.

@clooth
Created December 6, 2011 04:19
Show Gist options
  • Save clooth/1436712 to your computer and use it in GitHub Desktop.
Save clooth/1436712 to your computer and use it in GitHub Desktop.
moonscript compilation helper
trap('INT') { exit } # graceful exit
ROOT = Dir.pwd
SRC = File.join(ROOT, 'src')
Dir.mkdir(SRC) unless File.directory?(SRC)
Dir.chdir(SRC)
loop do
Dir['**/*.moon'].each do |file|
moon_file = File.join(SRC, file)
lua_file = File.join(ROOT, file.gsub(/\.moon$/, '.lua'))
if not File.file?(lua_file) or File.mtime(moon_file) > File.mtime(lua_file)
puts `C:/Lua514/lua.exe C:/Lua514/moonc.lua -t .. #{file}`
end
end
sleep 2
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment