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

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