Skip to content
This repository
Fetching contributors…

Cannot retrieve contributors at this time

file 76 lines (63 sloc) 1.581 kb
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
require 'rubygems'
require 'rake/clean'
require 'fileutils'

projects = ['watir', 'firewatir', 'commonwatir']

def launch_subrake(cmd)
  system("#{Gem.ruby} -S rake #{cmd}")
end

task :default => :gems

task :gemdir do
  mkdir_p "gems" if !File.exist?("gems")
end

desc "Generate all the Watir gems"
task :gems => :gemdir do
  projects.each do |project|
    tmp_files = %w{CHANGES VERSION README.rdoc LICENSE}
    FileUtils.cp tmp_files, project
    Dir.chdir(project) do
      launch_subrake "gem"
      FileUtils.rm tmp_files
    end
  end
  gems = Dir['*/pkg/*.gem']
  gems.each {|gem| FileUtils.install gem, 'gems'}
end

desc "Clean all the projects"
task :clean_subprojects do
  projects.each do |project|
    Dir.chdir(project) do
      launch_subrake "clean"
    end
  end
end

desc "Clean the build environment and projects"
task :clean => [:clean_subprojects] do
  FileUtils.rm_r Dir.glob("gems/*") << "test/reports", :force => true
end

desc "Run tests for Watir and FireWatir"
task :test => [:test_watir, :test_firewatir]

desc 'Run tests for Watir'
task :test_watir do
  Dir.chdir("watir") do
    launch_subrake "test"
  end
end

desc 'Run tests for FireWatir'
task :test_firewatir do
  Dir.chdir("firewatir") do
    launch_subrake "test"
  end
end

#
# ------------------------------ watirspec -----------------------------------
#

if File.exist?(path = "spec/watirspec/watirspec.rake")
  load path
end

namespace :watirspec do
  desc 'Initialize and fetch the watirspec submodule'
  task :init do
    sh "git submodule init"
    sh "git submodule update"
  end
end
Something went wrong with that request. Please try again.