Skip to content
Newer
Older
100644 75 lines (61 sloc) 2.28 KB
bb4d189 @sstephenson prototype: Reorganize the source tree.
authored
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')
2827428 @sstephenson prototype: Prepare for 1.6.0.2 release
authored
8 PROTOTYPE_VERSION = '1.6.0.2'
bb4d189 @sstephenson prototype: Reorganize the source tree.
authored
9
87ce153 @tobie prototype: Complete rewrite of the deprecation helper.
tobie authored
10 task :default => [:dist, :dist_helper, :package, :clean_package_source]
bb4d189 @sstephenson prototype: Reorganize the source tree.
authored
11
cc69b9c @tobie prototype: Add a description to :test and :dist rake tasks.
tobie authored
12 desc "Builds the distribution"
bb4d189 @sstephenson prototype: Reorganize the source tree.
authored
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
87ce153 @tobie prototype: Complete rewrite of the deprecation helper.
tobie authored
24 desc "Builds the updating helper"
25 task :dist_helper do
26 $:.unshift File.join(PROTOTYPE_ROOT, 'lib')
27 require 'protodoc'
28
29 Dir.chdir(File.join(PROTOTYPE_ROOT, 'ext', 'update_helper')) do
30 File.open(File.join(PROTOTYPE_DIST_DIR, 'prototype_update_helper.js'), 'w+') do |dist|
31 dist << Protodoc::Preprocessor.new('prototype_update_helper.js')
32 end
33 end
34 end
35
bb4d189 @sstephenson prototype: Reorganize the source tree.
authored
36 Rake::PackageTask.new('prototype', PROTOTYPE_VERSION) do |package|
37 package.need_tar_gz = true
38 package.package_dir = PROTOTYPE_PKG_DIR
39 package.package_files.include(
40 '[A-Z]*',
41 'dist/prototype.js',
42 'lib/**',
43 'src/**',
44 'test/**'
45 )
46 end
47
cc69b9c @tobie prototype: Add a description to :test and :dist rake tasks.
tobie authored
48 desc "Builds the distribution, runs the JavaScript unit tests and collects their results."
bb4d189 @sstephenson prototype: Reorganize the source tree.
authored
49 task :test => [:dist, :test_units]
50
51 require 'test/lib/jstest'
52 desc "Runs all the JavaScript unit tests and collects the results"
53 JavaScriptTestTask.new(:test_units) do |t|
0008fe4 @tobie prototype: Test.Unit refactoring. Allow running multiple instances of…
tobie authored
54 testcases = ENV['TESTCASES']
bb4d189 @sstephenson prototype: Reorganize the source tree.
authored
55 tests_to_run = ENV['TESTS'] && ENV['TESTS'].split(',')
56 browsers_to_test = ENV['BROWSERS'] && ENV['BROWSERS'].split(',')
0008fe4 @tobie prototype: Test.Unit refactoring. Allow running multiple instances of…
tobie authored
57
bb4d189 @sstephenson prototype: Reorganize the source tree.
authored
58 t.mount("/dist")
59 t.mount("/test")
60
ab4bb65 @madrobby Prototype: run tests in defined order by sorting by filename, #7141
madrobby authored
61 Dir["test/unit/*.html"].sort.each do |test_file|
0008fe4 @tobie prototype: Test.Unit refactoring. Allow running multiple instances of…
tobie authored
62 tests = testcases ? { :url => "/#{test_file}", :testcases => testcases } : "/#{test_file}"
63 test_filename = test_file[/.*\/(.+?)\.html/, 1]
64 t.run(tests) unless tests_to_run && !tests_to_run.include?(test_filename)
bb4d189 @sstephenson prototype: Reorganize the source tree.
authored
65 end
66
52cf3f2 @sstephenson prototype: Merge -r7016:HEAD from ../branches/ajax. Add Ajax.Response…
authored
67 %w( safari firefox ie konqueror opera ).each do |browser|
bb4d189 @sstephenson prototype: Reorganize the source tree.
authored
68 t.browser(browser.to_sym) unless browsers_to_test && !browsers_to_test.include?(browser)
69 end
70 end
71
72 task :clean_package_source do
73 rm_rf File.join(PROTOTYPE_PKG_DIR, "prototype-#{PROTOTYPE_VERSION}")
74 end
Something went wrong with that request. Please try again.