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.6KB

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
16 lat temu
14 lat temu
14 lat temu
16 lat temu
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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 = 'test/*_spec.rb'
  10. end
  11. end
  12. def version
  13. File.read("mustache.js").match('version: "([^\"]+)",$')[1]
  14. end
  15. def templated_build(name, opts={})
  16. # Create a rule that uses the .tmpl.{pre,post} stuff to make a final,
  17. # wrapped, output file.
  18. # There is some extra complexity because Dojo and YUI3 use different
  19. # template files and final locations.
  20. short = name.downcase
  21. source = "mustache-#{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. sh "cat #{source}/#{target_js}.tpl.pre mustache.js \
  30. #{source}/#{target_js}.tpl.post > #{opts[:location] || '.'}/#{target_js}"
  31. # extra
  32. if opts[:extra]
  33. sh "sed -e 's/{{version}}/#{version}/' #{source}/#{opts[:extra]} \
  34. > #{opts[:location]}/#{opts[:extra]}"
  35. end
  36. puts "Done, see #{opts[:location] || '.'}/#{target_js}"
  37. end
  38. end
  39. templated_build "CommonJS", :location => "lib", :extra => "package.json"
  40. templated_build "jQuery"
  41. templated_build "qooxdoo"
  42. templated_build "Dojo", :location => "dojox/string"
  43. templated_build "YUI3", :location => "yui3/mustache"
  44. templated_build "requirejs"