Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 117 lines (100 sloc) 3.262 kb
3edf44a Bret Pettichord fixing more line endings...
bret authored
1 require 'rubygems'
2 require 'rake/clean'
3 require 'fileutils'
4 require 'rake/testtask'
5 gem 'ci_reporter'
6 require 'ci/reporter/rake/test_unit'
7 projects = ['watir', 'firewatir', 'commonwatir']
6f47cd3 Jarmo Pertman clean commonwatir and root properly
jarmo authored
8
3edf44a Bret Pettichord fixing more line endings...
bret authored
9 desc "Generate all the Watir gems"
10 task :gems do
02afce3 Jarmo Pertman using one CHANGES file for all projects
jarmo authored
11 projects.each do |project|
6f47cd3 Jarmo Pertman clean commonwatir and root properly
jarmo authored
12 tmp_files = %w{CHANGES VERSION}
13 FileUtils.cp tmp_files, project
14 Dir.chdir(project) do
15 puts `rake.bat gem`
16 FileUtils.rm tmp_files
17 end
3edf44a Bret Pettichord fixing more line endings...
bret authored
18 end
19 FileUtils.makedirs 'gems'
20 gems = Dir['*/pkg/*.gem']
21 gems.each {|gem| FileUtils.install gem, 'gems'}
22 end
23
24 desc "Clean all the projects"
25 task :clean_subprojects do
26 projects.each do |x|
27 Dir.chdir(x) {puts `rake.bat clean`}
28 end
29 end
30
6f47cd3 Jarmo Pertman clean commonwatir and root properly
jarmo authored
31 task :clean => [:clean_subprojects] do
32 FileUtils.rm_r Dir.glob("gems/*") << "test/reports", :force => true
33 end
3edf44a Bret Pettichord fixing more line endings...
bret authored
34
35 desc 'Run core_tests tests for IE'
36 Rake::TestTask.new :core_tests do |t|
37 t.test_files = FileList['watir/unittests/core_tests.rb']
38 t.verbose = true
39 end
40
41 desc 'Run mozilla_all_tests for FireFox'
42 Rake::TestTask.new :mozilla_all_tests do |t|
43 t.test_files = FileList['firewatir/unittests/mozilla_all_tests.rb']
44 t.verbose = true
45 end
46
053bb00 Jari Bakken Add WatirSpec submodule + load it in Rakefile if available.
jarib authored
47 #
48 # ------------------------------ watirspec -----------------------------------
49 #
50
51 if File.exist?(path = "spec/watirspec/watirspec.rake")
52 load path
53 end
54
55 namespace :watirspec do
56 desc 'Initialize and fetch the watirspec submodule'
57 task :init do
58 sh "git submodule init"
59 sh "git submodule update"
60 end
61 end
62
63 #
64 # ----------------------------------------------------------------------------
65 #
66
3edf44a Bret Pettichord fixing more line endings...
bret authored
67 namespace :cruise do
68 def add_style_sheet_to_reports(report_dir)
d4a23cb Bret Pettichord don't change chdir (permanently) in tests. this keeps test reports at to...
bret authored
69 Dir[report_dir].each do |f|
3edf44a Bret Pettichord fixing more line endings...
bret authored
70 sContent = File.readlines(f, '\n')
71 sContent.each do |line|
6f47cd3 Jarmo Pertman clean commonwatir and root properly
jarmo authored
72 line.sub!(/<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>/,
73 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<?xml-stylesheet type=\"text\/xsl\" href=\"transform-results.xsl\"?>")
3edf44a Bret Pettichord fixing more line endings...
bret authored
74 end
75 File.open(f, "w+") { |file| file.puts sContent }
76 end
77 end
6f47cd3 Jarmo Pertman clean commonwatir and root properly
jarmo authored
78
d4a23cb Bret Pettichord don't change chdir (permanently) in tests. this keeps test reports at to...
bret authored
79 task :move_reports do
80 reports = "test/reports/*.xml"
81 add_style_sheet_to_reports(reports)
f96866b Jari Bakken Various adjustments to make Watir run on Ruby 1.9.
jarib authored
82 FileUtils.cp("transform-results.xsl", "test/reports")
d4a23cb Bret Pettichord don't change chdir (permanently) in tests. this keeps test reports at to...
bret authored
83 if ENV['CC_BUILD_ARTIFACTS']
f96866b Jari Bakken Various adjustments to make Watir run on Ruby 1.9.
jarib authored
84 Dir[reports].each { |e| FileUtils.cp(e, ENV['CC_BUILD_ARTIFACTS']) }
85 FileUtils.cp("transform-results.xsl", ENV['CC_BUILD_ARTIFACTS'])
d4a23cb Bret Pettichord don't change chdir (permanently) in tests. this keeps test reports at to...
bret authored
86 else
87 puts "Build results not copied. CC_BUILD_ARTIFACTS not defined"
88 end
3edf44a Bret Pettichord fixing more line endings...
bret authored
89 end
6f47cd3 Jarmo Pertman clean commonwatir and root properly
jarmo authored
90
9229bfc Bret Pettichord provide test-by-test listing in the build log. 2nd try.
bret authored
91 task :verbose do
92 # ci:setup_testunit also mucks with this
93 ENV["TESTOPTS"] = "#{ENV["TESTOPTS"]} -v"
94 end
6f47cd3 Jarmo Pertman clean commonwatir and root properly
jarmo authored
95
0f24e3a Bret Pettichord should not get an error when running cruise targets outside cruise. adde...
bret authored
96 desc 'Run tests for Internet Explorer'
9229bfc Bret Pettichord provide test-by-test listing in the build log. 2nd try.
bret authored
97 task :ie_core_tests => ['ci:setup:testunit', :verbose, :core_tests, :move_reports]
0f24e3a Bret Pettichord should not get an error when running cruise targets outside cruise. adde...
bret authored
98 desc 'Run tests for Firefox'
9229bfc Bret Pettichord provide test-by-test listing in the build log. 2nd try.
bret authored
99 task :ff_mozilla_all_tests => ['ci:setup:testunit', :verbose, :mozilla_all_tests, :move_reports]
6f47cd3 Jarmo Pertman clean commonwatir and root properly
jarmo authored
100
54e12c2 Jari Bakken Add `rake cruise:all` to run tests for both FF and IE.
jarib authored
101 desc 'Run all tests'
102 task :all => [:ie_core_tests, :ff_mozilla_all_tests]
3edf44a Bret Pettichord fixing more line endings...
bret authored
103 end
104
105 desc 'Build the html for the website (wtr.rubyforge.org)'
106 task :website do
107 Dir.chdir 'doc' do
108 puts system('call webgen -V 1')
109 end
110 end
111
112 desc 'Build and publish the html for the website at wtr.rubyforge.org'
113 task :publish_website => [:website] do
114 user = 'bret' # userid on rubyforge
115 puts system("call pscp -v -r doc\\output\\*.* #{user}@rubyforge.org:/var/www/gforge-projects/wtr")
116 end
Something went wrong with that request. Please try again.