diff --git a/rakefile b/rakefile index ad494d5ece..3836eb140e 100644 --- a/rakefile +++ b/rakefile @@ -38,6 +38,10 @@ def django_admin(system, env, command, *args) return "#{django_admin} #{command} --settings=#{system}.envs.#{env} --pythonpath=. #{args.join(' ')}" end +def report_dir_path(dir) + return File.join(REPORT_DIR, dir.to_s) +end + task :default => [:test, :pep8, :pylint] directory REPORT_DIR @@ -58,7 +62,7 @@ task :clean_test_files do end [:lms, :cms, :common].each do |system| - report_dir = File.join(REPORT_DIR, system.to_s) + report_dir = report_dir_path(system) directory report_dir desc "Run pep8 on all #{system} code" @@ -107,8 +111,7 @@ end TEST_TASK_DIRS = [] [:lms, :cms].each do |system| - report_dir = File.join(REPORT_DIR, system.to_s) - directory report_dir + report_dir = report_dir_path(system) # Per System tasks desc "Run all django tests on our djangoapps for the #{system}" @@ -154,8 +157,7 @@ end Dir["common/lib/*"].select{|lib| File.directory?(lib)}.each do |lib| task_name = "test_#{lib}" - report_dir = File.join(REPORT_DIR, task_name.gsub('/', '_')) - directory report_dir + report_dir = report_dir_path(lib) desc "Run tests for common lib #{lib}" task task_name => report_dir do @@ -174,6 +176,14 @@ Dir["common/lib/*"].select{|lib| File.directory?(lib)}.each do |lib| end +task :report_dirs + +TEST_TASK_DIRS.each do |dir| + report_dir = report_dir_path(dir) + directory report_dir + task :report_dirs => [REPORT_DIR, report_dir] +end + task :test do TEST_TASK_DIRS.each do |dir| Rake::Task["test_#{dir}"].invoke(false) @@ -186,14 +196,14 @@ end namespace :coverage do desc "Build the html coverage reports" - task :html do + task :html => :report_dirs do TEST_TASK_DIRS.each do |dir| sh("coverage html --rcfile=#{dir}/.coveragerc") end end desc "Build the xml coverage reports" - task :xml do + task :xml => :report_dirs do TEST_TASK_DIRS.each do |dir| # Why doesn't the rcfile control the xml output file properly?? sh("coverage xml -o reports/#{dir}/coverage.xml --rcfile=#{dir}/.coveragerc")