mirror of
https://github.com/jashkenas/coffeescript.git
synced 2022-11-09 12:23:24 -05:00
21 lines
563 B
Ruby
21 lines
563 B
Ruby
require 'erb'
|
|
require 'fileutils'
|
|
require 'rake/testtask'
|
|
|
|
desc "Build the documentation page"
|
|
task :doc do
|
|
source = 'documentation/index.html.erb'
|
|
child = fork { exec "bin/coffee -bcw -o documentation/js documentation/coffee/*.coffee" }
|
|
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
|
|
end
|
|
|