jashkenas--coffeescript/Rakefile

21 lines
560 B
Ruby
Raw Normal View History

2009-12-18 14:55:31 +00:00
require 'erb'
2009-12-18 11:59:06 +00:00
require 'fileutils'
require 'rake/testtask'
2009-12-18 14:55:31 +00:00
desc "Build the documentation page"
task :doc do
source = 'documentation/index.html.erb'
child = fork { exec "bin/coffee documentation/coffee/*.coffee -o documentation/js -w" }
at_exit { Process.kill("INT", child) }
Signal.trap("INT") { exit }
loop do
mtime = File.stat(source).mtime
if !@mtime || mtime > @mtime
rendered = ERB.new(File.read(source)).result(binding)
File.open('index.html', 'w+') {|f| f.write(rendered) }
end
@mtime = mtime
sleep 1
end
2009-12-18 14:55:31 +00:00
end