Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

65 строки
1.7KB

  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. # Creates a task that uses the various template wrappers to make a wrapped
  22. # output file. There is some extra complexity because Dojo and YUI use
  23. # different final locations.
  24. def templated_build(name, opts={})
  25. short = name.downcase
  26. source = File.join("wrappers", short)
  27. dependencies = ["mustache.js"] + Dir.glob("#{source}/*.tpl.*")
  28. target_js = opts[:location] ? "mustache.js" : "#{short}.mustache.js"
  29. CLEAN.include(opts[:location] ? opts[:location] : target_js)
  30. desc "Package for #{name}"
  31. task short.to_sym => dependencies do
  32. puts "Packaging for #{name}"
  33. mkdir_p opts[:location] if opts[:location]
  34. files = [
  35. "#{source}/mustache.js.pre",
  36. 'mustache.js',
  37. "#{source}/mustache.js.post"
  38. ]
  39. open("#{opts[:location] || '.'}/#{target_js}", 'w') do |f|
  40. files.each {|file| f << File.read(file) }
  41. end
  42. puts "Done, see #{opts[:location] || '.'}/#{target_js}"
  43. end
  44. end
  45. templated_build "jQuery"
  46. templated_build "MooTools"
  47. templated_build "Dojo", :location => "dojox/string"
  48. templated_build "YUI3", :location => "yui3/mustache"
  49. templated_build "RequireJS"
  50. templated_build "qooxdoo"