From 929824b2be27c967f826773181f3cc427d28a1cd Mon Sep 17 00:00:00 2001 From: Hiroshi Nakamura Date: Wed, 4 Jan 2012 14:54:06 +0900 Subject: [PATCH] Update build system for CI Add ci_reporter for Jenkins CI. Use simplecov but it might not work fine at this moment. --- Gemfile | 11 +++++++++-- Rakefile | 13 ++++--------- test/helper.rb | 5 +++++ 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/Gemfile b/Gemfile index 1bdc562c..e3be4f6e 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,14 @@ platform :jruby do gem 'jruby-openssl' end -gem 'rake' -gem 'rdoc' +group :development do + gem 'rake' + gem 'rdoc' + gem 'simplecov' + # For Jenkins + gem 'test-unit' + gem 'ci_reporter' + gem 'simplecov-rcov' +end gemspec diff --git a/Rakefile b/Rakefile index 336adcd5..caccf636 100644 --- a/Rakefile +++ b/Rakefile @@ -2,22 +2,17 @@ require 'rake' require 'rake/testtask' require 'rdoc/task' require 'rubygems/package_task' +require 'ci/reporter/rake/test_unit' task :default => :test require 'bundler' Bundler::GemHelper.install_tasks -begin - require 'rcov/rcovtask' - Rcov::RcovTask.new("coverage") do |rcov| - rcov.libs << 'lib' - rcov.pattern = 'test/test_*.rb' - end -rescue LoadError -end +ENV['CI_REPORTS'] = File.expand_path('./reports', File.dirname(__FILE__)) +task :test => ['ci:setup:testunit', 'test-run'] -Rake::TestTask.new("test") do |test| +Rake::TestTask.new('test-run') do |test| test.libs << 'lib' test.verbose = true test.test_files = Dir.glob('test/test_*.rb') diff --git a/test/helper.rb b/test/helper.rb index f01048ed..2f413e8e 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -1,5 +1,10 @@ # -*- encoding: utf-8 -*- require 'test/unit' +require 'simplecov' +require 'simplecov-rcov' +SimpleCov.formatter = SimpleCov::Formatter::RcovFormatter +SimpleCov.start + require 'httpclient' require 'webrick' require 'webrick/httpproxy.rb'