From 89863d714b7e52833418e655fb6991987be8febe Mon Sep 17 00:00:00 2001 From: Michael Jackson Date: Mon, 5 Dec 2011 14:15:51 -0800 Subject: [PATCH] Use rake/clean --- Rakefile | 16 +++++++++------- test/mustache_spec.rb | 5 ++--- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/Rakefile b/Rakefile index f72af2a..81dbccc 100644 --- a/Rakefile +++ b/Rakefile @@ -1,4 +1,8 @@ require 'rake' +require 'rake/clean' + +# See mustache_spec.rb +CLOBBER.include('runner.js') task :default => :spec @@ -23,13 +27,16 @@ def templated_build(name, opts={}) short = name.downcase source = "mustache-#{short}" dependencies = ["mustache.js"] + Dir.glob("#{source}/*.tpl.*") + target_js = opts[:location] ? "mustache.js" : "#{short}.mustache.js" + + CLEAN.include(opts[:location] ? opts[:location] : target_js) desc "Package for #{name}" task short.to_sym => dependencies do - target_js = opts[:location] ? "mustache.js" : "#{short}.mustache.js" - puts "Packaging for #{name}" + mkdir_p opts[:location] if opts[:location] + sh "cat #{source}/#{target_js}.tpl.pre mustache.js \ #{source}/#{target_js}.tpl.post > #{opts[:location] || '.'}/#{target_js}" @@ -49,8 +56,3 @@ templated_build "qooxdoo" templated_build "Dojo", :location => "dojox/string" templated_build "YUI3", :location => "yui3/mustache" templated_build "requirejs" - -desc "Remove temporary files." -task :clean do - sh "git clean -fdx" -end diff --git a/test/mustache_spec.rb b/test/mustache_spec.rb index 5ce8bea..2205882 100644 --- a/test/mustache_spec.rb +++ b/test/mustache_spec.rb @@ -175,8 +175,7 @@ describe "mustache" do end context "running in SpiderMonkey (Mozilla, Firefox)" do - p JS_PATH - if !JS_PATH.empty? + if File.exist?(JS_PATH) before(:each) do @run_js = :run_js_js end @@ -196,7 +195,7 @@ describe "mustache" do end context "running in JavaScriptCore (WebKit, Safari)" do - if File.exists?(JSC_PATH) + if File.exist?(JSC_PATH) before(:each) do @run_js = :run_js_jsc end