25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

41 satır
1.3KB

  1. require 'rake'
  2. require 'spec/rake/spectask'
  3. task :default => :spec
  4. Spec::Rake::SpecTask.new(:spec) do |t|
  5. #t.spec_opts = ['--options', "\"#{File.dirname(__FILE__)}/spec/spec.opts\""]
  6. t.spec_files = FileList['test/*_spec.rb']
  7. end
  8. desc "Run all specs"
  9. task :spec
  10. def templated_build(name, opts={})
  11. # Create a rule that uses the .tmpl.{pre,post} stuff to make a final, wrapped, output file.
  12. # There is some extra complexity because Dojo and YUI3 use different template files and final locations.
  13. short = name.downcase
  14. source = "mustache-#{short}"
  15. dependencies = ["mustache.js"] + Dir.glob("#{source}/*.tpl.*")
  16. desc "Package for #{name}"
  17. task short.to_sym => dependencies do
  18. target_js = opts[:location] ? "mustache.js" : "#{short}.mustache.js"
  19. puts "Packaging for #{name}"
  20. sh "mkdir -p #{opts[:location]}" if opts[:location]
  21. sh "cat #{source}/#{target_js}.tpl.pre mustache.js #{source}/#{target_js}.tpl.post > #{opts[:location] || '.'}/#{target_js}"
  22. puts "Done, see #{opts[:location] || '.'}/#{target_js}"
  23. end
  24. end
  25. templated_build "CommonJS"
  26. templated_build "jQuery"
  27. templated_build "Dojo", :location => "dojox/string"
  28. templated_build "YUI3", :location => "yui3/mustache"
  29. desc "Remove temporary files."
  30. task :clean do
  31. sh "git clean -fdx"
  32. end