You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 anni fa
14 anni fa
16 anni fa
14 anni fa
14 anni fa
14 anni fa
16 anni fa
14 anni fa
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. require 'rake'
  2. require 'rake/clean'
  3. task :default => 'test:integration'
  4. namespace :test do
  5. desc "Run all integration tests"
  6. task :integration do
  7. require File.expand_path('../test/integration', __FILE__)
  8. end
  9. desc "Run all unit tests"
  10. task :unit do
  11. require File.expand_path('../test/unit', __FILE__)
  12. end
  13. end
  14. # Creates a task that uses the various template wrappers to make a wrapped
  15. # output file. There is some extra complexity because Dojo and YUI use
  16. # different final locations.
  17. def templated_build(name, opts={})
  18. short = name.downcase
  19. source = File.join("wrappers", short)
  20. dependencies = ["mustache.js"] + Dir.glob("#{source}/*.tpl.*")
  21. target_js = opts[:location] ? "mustache.js" : "#{short}.mustache.js"
  22. CLEAN.include(opts[:location] ? opts[:location] : target_js)
  23. desc "Package for #{name}"
  24. task short.to_sym => dependencies do
  25. puts "Packaging for #{name}"
  26. mkdir_p opts[:location] if opts[:location]
  27. files = [
  28. "#{source}/mustache.js.pre",
  29. 'mustache.js',
  30. "#{source}/mustache.js.post"
  31. ]
  32. open("#{opts[:location] || '.'}/#{target_js}", 'w') do |f|
  33. files.each {|file| f << File.read(file) }
  34. end
  35. puts "Done, see #{opts[:location] || '.'}/#{target_js}"
  36. end
  37. end
  38. templated_build "jQuery"
  39. templated_build "MooTools"
  40. templated_build "Dojo", :location => "dojox/string"
  41. templated_build "YUI3", :location => "yui3/mustache"
  42. templated_build "RequireJS"
  43. templated_build "qooxdoo"
  44. task :minify do
  45. # npm install uglify-js
  46. mmjs = "mustache.min.js"
  47. `echo "/*! Version: 0.5.1-dev */" > #{mmjs}`
  48. `uglifyjs mustache.js >> #{mmjs}`
  49. puts "Created #{mmjs}"
  50. end