Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

60 řádky
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 templated_build(name, opts={})
  12. # Create a rule that uses the .tmpl.{pre,post} stuff to make a final,
  13. # wrapped, output file.
  14. # There is some extra complexity because Dojo and YUI3 use different
  15. # template files and final locations.
  16. short = name.downcase
  17. source = "mustache-#{short}"
  18. dependencies = ["mustache.js"] + Dir.glob("#{source}/*.tpl.*")
  19. desc "Package for #{name}"
  20. task short.to_sym => dependencies do
  21. target_js = opts[:location] ? "mustache.js" : "#{short}.mustache.js"
  22. puts "Packaging for #{name}"
  23. sh "mkdir -p #{opts[:location]}" if opts[:location]
  24. sh "cat #{source}/#{target_js}.tpl.pre mustache.js \
  25. #{source}/#{target_js}.tpl.post > #{opts[:location] || '.'}/#{target_js}"
  26. # extra
  27. if opts[:extra]
  28. sh "sed -e 's/{{version}}/#{version}/' #{source}/#{opts[:extra]} \
  29. > #{opts[:location]}/#{opts[:extra]}"
  30. end
  31. puts "Done, see #{opts[:location] || '.'}/#{target_js}"
  32. end
  33. end
  34. templated_build "CommonJS", :location => "lib", :extra => "package.json"
  35. templated_build "jQuery"
  36. templated_build "qooxdoo"
  37. templated_build "Dojo", :location => "dojox/string"
  38. templated_build "YUI3", :location => "yui3/mustache"
  39. templated_build "requirejs"
  40. def version
  41. File.read("mustache.js").match('version: "([^\"]+)",$')[1]
  42. end
  43. desc "Remove temporary files."
  44. task :clean do
  45. sh "git clean -fdx"
  46. end