forked from watir/watir-classic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
91 lines (79 loc) · 2.65 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
require 'rubygems'
require 'rake/clean'
require 'ftools'
require 'fileutils'
require 'rake/testtask'
gem 'ci_reporter'
require 'ci/reporter/rake/test_unit'
projects = ['watir', 'firewatir', 'commonwatir']
desc "Generate all the Watir gems"
task :gems do
projects.each do |x|
Dir.chdir(x) {puts `rake.bat gem`}
end
FileUtils.makedirs 'gems'
gems = Dir['*/pkg/*.gem']
gems.each {|gem| FileUtils.install gem, 'gems'}
end
desc "Clean all the projects"
task :clean_subprojects do
projects.each do |x|
Dir.chdir(x) {puts `rake.bat clean`}
end
end
task :clean => [:clean_subprojects]
CLEAN << 'gems/*' << 'test/reports'
desc 'Run core_tests tests for IE'
Rake::TestTask.new :core_tests do |t|
t.test_files = FileList['watir/unittests/core_tests.rb']
t.verbose = true
end
desc 'Run mozilla_all_tests for FireFox'
Rake::TestTask.new :mozilla_all_tests do |t|
t.test_files = FileList['firewatir/unittests/mozilla_all_tests.rb']
t.verbose = true
end
namespace :cruise do
def add_style_sheet_to_reports(report_dir)
Dir[report_dir].each do |f|
sContent = File.readlines(f, '\n')
sContent.each do |line|
line.sub!(/<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>/,
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<?xml-stylesheet type=\"text\/xsl\" href=\"transform-results.xsl\"?>")
end
File.open(f, "w+") { |file| file.puts sContent }
end
end
task :move_reports do
reports = "test/reports/*.xml"
add_style_sheet_to_reports(reports)
File::copy("transform-results.xsl", "test/reports")
if ENV['CC_BUILD_ARTIFACTS']
Dir[reports].each { |e| File::copy(e, ENV['CC_BUILD_ARTIFACTS']) }
File::copy("transform-results.xsl", ENV['CC_BUILD_ARTIFACTS'])
else
puts "Build results not copied. CC_BUILD_ARTIFACTS not defined"
end
end
task :verbose do
# ci:setup_testunit also mucks with this
ENV["TESTOPTS"] = "#{ENV["TESTOPTS"]} -v"
end
desc 'Run tests for Internet Explorer'
task :ie_core_tests => ['ci:setup:testunit', :verbose, :core_tests, :move_reports]
desc 'Run tests for Firefox'
task :ff_mozilla_all_tests => ['ci:setup:testunit', :verbose, :mozilla_all_tests, :move_reports]
desc 'Run all tests'
task :all => [:ie_core_tests, :ff_mozilla_all_tests]
end
desc 'Build the html for the website (wtr.rubyforge.org)'
task :website do
Dir.chdir 'doc' do
puts system('call webgen -V 1')
end
end
desc 'Build and publish the html for the website at wtr.rubyforge.org'
task :publish_website => [:website] do
user = 'bret' # userid on rubyforge
puts system("call pscp -v -r doc\\output\\*.* #{user}@rubyforge.org:/var/www/gforge-projects/wtr")
end