Rakefile in shuriken-0.1.2.2 vs Rakefile in shuriken-0.1.3

- old
+ new

@@ -16,5 +16,33 @@ end Jeweler::GemcutterTasks.new rescue LoadError puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler" end + +desc "Compiles the javascript from Coffeescript to Javascript" +task :compile_scripts do + Dir["coffeescripts/**/*.coffee"].each do |cs| + output = File.dirname(cs).gsub("coffeescripts", "javascripts") + system "coffee", "-c", "--no-wrap", cs, "-o", output + end +end + +task :test => :compile_scripts do + require 'erb' + template = ERB.new(File.read("tests/template.erb")) + FileUtils.mkdir_p 'test-output' + FileUtils.rm_rf 'test-output/*' + Dir["tests/*.coffee"].each do |test| + test_name = File.basename(test, ".coffee") + $js_file = "#{test_name}.js" + File.open("test-output/#{test_name}.html", "w+") do |f| + f.write template.result + end + $js_file = nil + system "coffee", "-c", "--no-wrap", test, "-o", "test-output" + end +end + +task :watchr do + system "watchr tests.watchr" +end