require 'rubygems'
require 'rake'
require 'rake/clean'
require 'rake/testtask'
require 'rcov/rcovtask'

desc "Print environment to run from checkout - eval $( rake local_env | tail -n +1 )"
task :local_env do
  pwd = Dir.pwd
  puts "RUBYLIB='#{pwd}/lib/'; export RUBYLIB"
  puts "PATH='#{pwd}/bin/:#{ENV['PATH']}'; export PATH"
  puts "SS_CONFIG_DIR='#{pwd}/conf'; export SS_CONFIG_DIR"
end

desc "Unit tests"
Rake::TestTask.new(:unit_test) do |t|
  t.libs << File.expand_path('../lib', __FILE__)
  t.libs << File.expand_path('../test', __FILE__)
  t.libs << File.expand_path('../test/unit', __FILE__)
  t.pattern = 'test/unit/**/*_test.rb'
end

desc "Coverage tests"
Rcov::RcovTask.new  do  |t|
  t.libs << File.expand_path('../lib', __FILE__)
  t.libs << File.expand_path('../test', __FILE__)
  t.libs << File.expand_path('../test/unit', __FILE__)
  t.pattern = 'test/unit/**/*_test.rb'
  t.rcov_opts << "-x '/usr/lib/ruby'"
  t.rcov_opts << "-i 'openshift,rhc'"
end

task :test => [:unit_test] do
end

desc "Generate RDoc"
task :doc do
  sh "rdoc ."
end
