25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

Rakefile 1.6KB

16 yıl önce
14 yıl önce
16 yıl önce
14 yıl önce
14 yıl önce
14 yıl önce
14 yıl önce
14 yıl önce
14 yıl önce
16 yıl önce
14 yıl önce
14 yıl önce
16 yıl önce
14 yıl önce
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. def version
  13. File.read("mustache.js").match('version: "([^\"]+)",$')[1]
  14. end
  15. # Creates a rule that uses the .tmpl.{pre,post} stuff to make a final,
  16. # wrapped, output file. There is some extra complexity because Dojo and YUI3
  17. # use different template files and final locations.
  18. def templated_build(name, opts={})
  19. short = name.downcase
  20. source = File.join("wrappers", short)
  21. dependencies = ["mustache.js"] + Dir.glob("#{source}/*.tpl.*")
  22. target_js = opts[:location] ? "mustache.js" : "#{short}.mustache.js"
  23. CLEAN.include(opts[:location] ? opts[:location] : target_js)
  24. desc "Package for #{name}"
  25. task short.to_sym => dependencies do
  26. puts "Packaging for #{name}"
  27. mkdir_p opts[:location] if opts[:location]
  28. sh "cat #{source}/#{target_js}.tpl.pre mustache.js \
  29. #{source}/#{target_js}.tpl.post > #{opts[:location] || '.'}/#{target_js}"
  30. # extra
  31. if opts[:extra]
  32. sh "sed -e 's/{{version}}/#{version}/' #{source}/#{opts[:extra]} \
  33. > #{opts[:location]}/#{opts[:extra]}"
  34. end
  35. puts "Done, see #{opts[:location] || '.'}/#{target_js}"
  36. end
  37. end
  38. templated_build "CommonJS", :location => "lib", :extra => "package.json"
  39. templated_build "jQuery"
  40. templated_build "Dojo", :location => "dojox/string"
  41. templated_build "YUI3", :location => "yui3/mustache"
  42. templated_build "RequireJS"
  43. templated_build "qooxdoo"