Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

Rakefile 1.7KB

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