Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

52 linhas
1.4KB

  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 = 'spec/*_spec.rb'
  10. end
  11. end
  12. # Creates a task that uses the various template wrappers to make a wrapped
  13. # output file. There is some extra complexity because Dojo and YUI use
  14. # different final locations.
  15. def templated_build(name, opts={})
  16. short = name.downcase
  17. source = File.join("wrappers", short)
  18. dependencies = ["mustache.js"] + Dir.glob("#{source}/*.tpl.*")
  19. target_js = opts[:location] ? "mustache.js" : "#{short}.mustache.js"
  20. CLEAN.include(opts[:location] ? opts[:location] : target_js)
  21. desc "Package for #{name}"
  22. task short.to_sym => dependencies do
  23. puts "Packaging for #{name}"
  24. mkdir_p opts[:location] if opts[:location]
  25. files = [
  26. "#{source}/mustache.js.pre",
  27. 'mustache.js',
  28. "#{source}/mustache.js.post"
  29. ]
  30. open("#{opts[:location] || '.'}/#{target_js}", 'w') do |f|
  31. files.each {|file| f << File.read(file) }
  32. end
  33. puts "Done, see #{opts[:location] || '.'}/#{target_js}"
  34. end
  35. end
  36. templated_build "jQuery"
  37. templated_build "MooTools"
  38. templated_build "Dojo", :location => "dojox/string"
  39. templated_build "YUI3", :location => "yui3/mustache"
  40. templated_build "RequireJS"
  41. templated_build "qooxdoo"