Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

Rakefile 1.6KB

16 år sedan
14 år sedan
16 år sedan
14 år sedan
14 år sedan
14 år sedan
14 år sedan
14 år sedan
14 år sedan
16 år sedan
14 år sedan
14 år sedan
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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"
  42. task :minify do
  43. # npm install uglify-js
  44. mmjs = "mustache.min.js"
  45. `echo "/*! Version: 0.5.1-dev */" > #{mmjs}`
  46. `uglifyjs mustache.js >> #{mmjs}`
  47. puts "Created #{mmjs}"
  48. end