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

57 строки
1.6KB

  1. require 'rake'
  2. task :default => :spec
  3. desc "Run all specs"
  4. task :spec do
  5. require 'rspec/core/rake_task'
  6. RSpec::Core::RakeTask.new(:spec) do |t|
  7. #t.spec_opts = ['--options', "\"#{File.dirname(__FILE__)}/spec/spec.opts\""]
  8. t.pattern = 'test/*_spec.rb'
  9. end
  10. end
  11. def version
  12. File.read("mustache.js").match('version: "([^\"]+)",$')[1]
  13. end
  14. def templated_build(name, opts={})
  15. # Create a rule that uses the .tmpl.{pre,post} stuff to make a final,
  16. # wrapped, output file.
  17. # There is some extra complexity because Dojo and YUI3 use different
  18. # template files and final locations.
  19. short = name.downcase
  20. source = "mustache-#{short}"
  21. dependencies = ["mustache.js"] + Dir.glob("#{source}/*.tpl.*")
  22. desc "Package for #{name}"
  23. task short.to_sym => dependencies do
  24. target_js = opts[:location] ? "mustache.js" : "#{short}.mustache.js"
  25. puts "Packaging for #{name}"
  26. mkdir_p opts[:location] if opts[:location]
  27. sh "cat #{source}/#{target_js}.tpl.pre mustache.js \
  28. #{source}/#{target_js}.tpl.post > #{opts[:location] || '.'}/#{target_js}"
  29. # extra
  30. if opts[:extra]
  31. sh "sed -e 's/{{version}}/#{version}/' #{source}/#{opts[:extra]} \
  32. > #{opts[:location]}/#{opts[:extra]}"
  33. end
  34. puts "Done, see #{opts[:location] || '.'}/#{target_js}"
  35. end
  36. end
  37. templated_build "CommonJS", :location => "lib", :extra => "package.json"
  38. templated_build "jQuery"
  39. templated_build "qooxdoo"
  40. templated_build "Dojo", :location => "dojox/string"
  41. templated_build "YUI3", :location => "yui3/mustache"
  42. templated_build "requirejs"
  43. desc "Remove temporary files."
  44. task :clean do
  45. sh "git clean -fdx"
  46. end