Skip to content

Instantly share code, notes, and snippets.

@tricknotes
Created October 16, 2011 13:15
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tricknotes/1290866 to your computer and use it in GitHub Desktop.
Save tricknotes/1290866 to your computer and use it in GitHub Desktop.
CoffeeScriptをコンパイルするwatchr
require "open3"
watch('(.*)\.coffee') do |md|
stdin, stdout, stderr = Open3.popen3("coffee -o dist/js/ -c #{md[0]}")
error_message = ''
unless stderr.eof?
error_message << stderr.to_a.join
end
system "growlnotify", "-t", md[0], "-m", error_message.empty? ? 'Compiled successfully': error_message
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment