Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

16 роки тому
14 роки тому
14 роки тому
16 роки тому
16 роки тому
14 роки тому
14 роки тому
14 роки тому
14 роки тому
14 роки тому
14 роки тому
16 роки тому
14 роки тому
14 роки тому
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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 do
  9. sh "./node_modules/.bin/mocha test"
  10. end
  11. desc "Run JSHint"
  12. task :hint do
  13. sh "./node_modules/.bin/jshint mustache.js"
  14. end
  15. # Creates a task that uses the various template wrappers to make a wrapped
  16. # output file. There is some extra complexity because Dojo and YUI use
  17. # different final locations.
  18. def templated_build(name, final_location=nil)
  19. short = name.downcase
  20. source = File.join("wrappers", short)
  21. dependencies = ["mustache.js"] + Dir.glob("#{source}/*.tpl.*")
  22. target_js = final_location.nil? ? "#{short}.mustache.js" : "mustache.js"
  23. desc "Package for #{name}"
  24. task short.to_sym => dependencies do
  25. puts "Packaging for #{name}"
  26. mkdir_p final_location unless final_location.nil?
  27. sources = [ "#{source}/mustache.js.pre", 'mustache.js', "#{source}/mustache.js.post" ]
  28. relative_name = "#{final_location || '.'}/#{target_js}"
  29. open(relative_name, 'w') do |f|
  30. sources.each {|source| f << File.read(source) }
  31. end
  32. puts "Done, see #{relative_name}"
  33. end
  34. CLEAN.include(final_location.nil? ? target_js : final_location)
  35. end
  36. templated_build "jQuery"
  37. templated_build "MooTools"
  38. templated_build "Dojo", "dojox/string"
  39. templated_build "YUI3", "yui3/mustache"
  40. templated_build "qooxdoo"