No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

hace 16 años
hace 14 años
hace 16 años
hace 14 años
hace 14 años
hace 14 años
hace 16 años
hace 14 años
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. require 'rake'
  2. require 'rake/clean'
  3. task :default => :test
  4. def minified_file
  5. ENV['FILE'] || 'mustache.min.js'
  6. end
  7. desc "Run all tests"
  8. task :test => :install_mocha do
  9. sh "./node_modules/.bin/mocha test"
  10. end
  11. desc "Make a compressed build in #{minified_file}"
  12. task :minify => :install_uglify do
  13. sh "./node_modules/.bin/uglifyjs mustache.js > #{minified_file}"
  14. end
  15. desc "Run JSHint"
  16. task :hint => :install_jshint do
  17. sh "./node_modules/.bin/jshint mustache.js"
  18. end
  19. # Creates a task that uses the various template wrappers to make a wrapped
  20. # output file. There is some extra complexity because Dojo and YUI use
  21. # different final locations.
  22. def templated_build(name, final_location=nil)
  23. short = name.downcase
  24. source = File.join("wrappers", short)
  25. dependencies = ["mustache.js"] + Dir.glob("#{source}/*.tpl.*")
  26. target_js = final_location.nil? ? "#{short}.mustache.js" : "mustache.js"
  27. desc "Package for #{name}"
  28. task short.to_sym => dependencies do
  29. puts "Packaging for #{name}"
  30. mkdir_p final_location unless final_location.nil?
  31. sources = [ "#{source}/mustache.js.pre", 'mustache.js', "#{source}/mustache.js.post" ]
  32. relative_name = "#{final_location || '.'}/#{target_js}"
  33. open(relative_name, 'w') do |f|
  34. sources.each {|source| f << File.read(source) }
  35. end
  36. puts "Done, see #{relative_name}"
  37. end
  38. CLEAN.include(final_location.nil? ? target_js : final_location)
  39. end
  40. templated_build "jQuery"
  41. templated_build "MooTools"
  42. templated_build "Dojo", "dojox/string"
  43. templated_build "YUI3", "yui3/mustache"
  44. templated_build "qooxdoo"