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 14 años
hace 14 años
hace 14 años
hace 16 años
hace 14 años
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. require 'rake'
  2. require 'rake/clean'
  3. task :default => :test
  4. ROOT = File.expand_path('..', __FILE__)
  5. MUSTACHE_JS = File.read(File.join(ROOT, 'mustache.js'))
  6. def mustache_version
  7. match = MUSTACHE_JS.match(/exports\.version = "([^"]+)";/)
  8. match[1]
  9. end
  10. def minified_file
  11. ENV['FILE'] || 'mustache.min.js'
  12. end
  13. desc "Run all tests, requires vows (see http://vowsjs.org)"
  14. task :test do
  15. sh "vows --spec"
  16. end
  17. desc "Minify to #{minified_file}, requires UglifyJS (see http://marijnhaverbeke.nl/uglifyjs)"
  18. task :minify do
  19. sh "uglifyjs mustache.js > #{minified_file}"
  20. end
  21. desc "Run JSHint, requires jshint (see http://www.jshint.com)"
  22. task :lint do
  23. sh "jshint mustache.js"
  24. end
  25. # Creates a task that uses the various template wrappers to make a wrapped
  26. # output file. There is some extra complexity because Dojo and YUI use
  27. # different final locations.
  28. def templated_build(name, opts={})
  29. short = name.downcase
  30. source = File.join("wrappers", short)
  31. dependencies = ["mustache.js"] + Dir.glob("#{source}/*.tpl.*")
  32. target_js = opts[:location] ? "mustache.js" : "#{short}.mustache.js"
  33. CLEAN.include(opts[:location] ? opts[:location] : target_js)
  34. desc "Package for #{name}"
  35. task short.to_sym => dependencies do
  36. puts "Packaging for #{name}"
  37. mkdir_p opts[:location] if opts[:location]
  38. files = [
  39. "#{source}/mustache.js.pre",
  40. 'mustache.js',
  41. "#{source}/mustache.js.post"
  42. ]
  43. open("#{opts[:location] || '.'}/#{target_js}", 'w') do |f|
  44. files.each {|file| f << File.read(file) }
  45. end
  46. puts "Done, see #{opts[:location] || '.'}/#{target_js}"
  47. end
  48. end
  49. templated_build "jQuery"
  50. templated_build "MooTools"
  51. templated_build "Dojo", :location => "dojox/string"
  52. templated_build "YUI3", :location => "yui3/mustache"
  53. templated_build "qooxdoo"