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

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