Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

root/spinoffs/prototype/branches/documentation/Rakefile

Revision 8728, 1.9 kB (checked in by sam, 8 months ago)

prototype: Prepare for 1.6.0.2 release

Line 
1 require 'rake'
2 require 'rake/packagetask'
3
4 PROTOTYPE_ROOT     = File.expand_path(File.dirname(__FILE__))
5 PROTOTYPE_SRC_DIR  = File.join(PROTOTYPE_ROOT, 'src')
6 PROTOTYPE_DIST_DIR = File.join(PROTOTYPE_ROOT, 'dist')
7 PROTOTYPE_PKG_DIR  = File.join(PROTOTYPE_ROOT, 'pkg')
8 PROTOTYPE_VERSION  = '1.6.0.2'
9
10 task :default => [:dist, :package, :clean_package_source]
11
12 desc "Builds the distribution"
13 task :dist do
14   $:.unshift File.join(PROTOTYPE_ROOT, 'lib')
15   require 'protodoc'
16  
17   Dir.chdir(PROTOTYPE_SRC_DIR) do
18     File.open(File.join(PROTOTYPE_DIST_DIR, 'prototype.js'), 'w+') do |dist|
19       dist << Protodoc::Preprocessor.new('prototype.js')
20     end
21   end
22 end
23
24 Rake::PackageTask.new('prototype', PROTOTYPE_VERSION) do |package|
25   package.need_tar_gz = true
26   package.package_dir = PROTOTYPE_PKG_DIR
27   package.package_files.include(
28     '[A-Z]*',
29     'dist/prototype.js',
30     'lib/**',
31     'src/**',
32     'test/**'
33   )
34 end
35
36 desc "Builds the distribution, runs the JavaScript unit tests and collects their results."
37 task :test => [:dist, :test_units]
38
39 require 'test/lib/jstest'
40 desc "Runs all the JavaScript unit tests and collects the results"
41 JavaScriptTestTask.new(:test_units) do |t|
42   testcases        = ENV['TESTCASES']
43   tests_to_run     = ENV['TESTS']    && ENV['TESTS'].split(',')
44   browsers_to_test = ENV['BROWSERS'] && ENV['BROWSERS'].split(',')
45  
46   t.mount("/dist")
47   t.mount("/test")
48  
49   Dir["test/unit/*.html"].sort.each do |test_file|
50     tests = testcases ? { :url => "/#{test_file}", :testcases => testcases } : "/#{test_file}"
51     test_filename = test_file[/.*\/(.+?)\.html/, 1]
52     t.run(tests) unless tests_to_run && !tests_to_run.include?(test_filename)
53   end
54  
55   %w( safari firefox ie konqueror opera ).each do |browser|
56     t.browser(browser.to_sym) unless browsers_to_test && !browsers_to_test.include?(browser)
57   end
58 end
59
60 task :clean_package_source do
61   rm_rf File.join(PROTOTYPE_PKG_DIR, "prototype-#{PROTOTYPE_VERSION}")
62 end
Note: See TracBrowser for help on using the browser.