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

56 строки
1.5KB

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