mirror of
https://github.com/puma/puma.git
synced 2022-11-09 13:48:40 -05:00
Using the newest rcov to get better reports out.
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@207 19e92222-5c0b-0410-8929-a290d50e31e9
This commit is contained in:
parent
25f477099b
commit
2499218abf
1 changed files with 41 additions and 65 deletions
|
@ -1,66 +1,67 @@
|
|||
require 'rcov/rcovtask'
|
||||
|
||||
def make(makedir)
|
||||
Dir.chdir(makedir) do
|
||||
sh(PLATFORM =~ /win32/ ? 'nmake' : 'make')
|
||||
end
|
||||
Dir.chdir(makedir) do
|
||||
sh(PLATFORM =~ /win32/ ? 'nmake' : 'make')
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def extconf(dir)
|
||||
Dir.chdir(dir) do ruby "extconf.rb" end
|
||||
Dir.chdir(dir) do ruby "extconf.rb" end
|
||||
end
|
||||
|
||||
|
||||
def setup_tests
|
||||
Rake::TestTask.new do |t|
|
||||
t.libs << "test"
|
||||
t.test_files = FileList['test/test*.rb']
|
||||
t.verbose = true
|
||||
end
|
||||
Rake::TestTask.new do |t|
|
||||
t.libs << "test"
|
||||
t.test_files = FileList['test/test*.rb']
|
||||
t.verbose = true
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def setup_clean otherfiles
|
||||
files = ['build/*', '**/*.o', '**/*.so', '**/*.a', 'lib/*-*', '**/*.log'] + otherfiles
|
||||
CLEAN.include(files)
|
||||
files = ['build/*', '**/*.o', '**/*.so', '**/*.a', 'lib/*-*', '**/*.log'] + otherfiles
|
||||
CLEAN.include(files)
|
||||
end
|
||||
|
||||
|
||||
def setup_rdoc files
|
||||
Rake::RDocTask.new do |rdoc|
|
||||
rdoc.rdoc_dir = 'doc/rdoc'
|
||||
rdoc.options << '--line-numbers'
|
||||
rdoc.rdoc_files.add(files)
|
||||
end
|
||||
Rake::RDocTask.new do |rdoc|
|
||||
rdoc.rdoc_dir = 'doc/rdoc'
|
||||
rdoc.options << '--line-numbers'
|
||||
rdoc.rdoc_files.add(files)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def setup_extension(dir, extension)
|
||||
ext = "ext/#{dir}"
|
||||
ext_so = "#{ext}/#{extension}.#{Config::CONFIG['DLEXT']}"
|
||||
ext_files = FileList[
|
||||
ext = "ext/#{dir}"
|
||||
ext_so = "#{ext}/#{extension}.#{Config::CONFIG['DLEXT']}"
|
||||
ext_files = FileList[
|
||||
"#{ext}/*.c",
|
||||
"#{ext}/*.h",
|
||||
"#{ext}/extconf.rb",
|
||||
"#{ext}/Makefile",
|
||||
"lib"
|
||||
]
|
||||
|
||||
task "lib" do
|
||||
directory "lib"
|
||||
end
|
||||
]
|
||||
|
||||
desc "Builds just the #{extension} extension"
|
||||
task extension.to_sym => ["#{ext}/Makefile", ext_so ]
|
||||
task "lib" do
|
||||
directory "lib"
|
||||
end
|
||||
|
||||
file "#{ext}/Makefile" => ["#{ext}/extconf.rb"] do
|
||||
extconf "#{ext}"
|
||||
end
|
||||
desc "Builds just the #{extension} extension"
|
||||
task extension.to_sym => ["#{ext}/Makefile", ext_so ]
|
||||
|
||||
file ext_so => ext_files do
|
||||
make "#{ext}"
|
||||
cp ext_so, "lib"
|
||||
end
|
||||
file "#{ext}/Makefile" => ["#{ext}/extconf.rb"] do
|
||||
extconf "#{ext}"
|
||||
end
|
||||
|
||||
file ext_so => ext_files do
|
||||
make "#{ext}"
|
||||
cp ext_so, "lib"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
@ -74,13 +75,13 @@ def base_gem_spec(pkg_name, pkg_version)
|
|||
s.platform = Gem::Platform::RUBY
|
||||
s.has_rdoc = true
|
||||
s.extra_rdoc_files = [ "README" ]
|
||||
|
||||
|
||||
s.files = %w(COPYING LICENSE README Rakefile) +
|
||||
Dir.glob("{bin,doc/rdoc,test,lib}/**/*") +
|
||||
Dir.glob("ext/**/*.{h,c,rb}") +
|
||||
Dir.glob("examples/**/*.rb") +
|
||||
Dir.glob("tools/*.rb")
|
||||
|
||||
|
||||
s.require_path = "lib"
|
||||
s.extensions = FileList["ext/**/extconf.rb"].to_a
|
||||
s.bindir = "bin"
|
||||
|
@ -90,7 +91,7 @@ end
|
|||
def setup_gem(pkg_name, pkg_version)
|
||||
spec = base_gem_spec(pkg_name, pkg_version)
|
||||
yield spec if block_given?
|
||||
|
||||
|
||||
Rake::GemPackageTask.new(spec) do |p|
|
||||
p.gem_spec = spec
|
||||
p.need_tar = true
|
||||
|
@ -110,33 +111,8 @@ def sub_project(project, *targets)
|
|||
end
|
||||
end
|
||||
|
||||
#==============================================================
|
||||
# A set of rake tasks for using the Rcov code coverage utility
|
||||
# http://www.soapboxsoftware.org/articles/2006/05/06/another-rake-task-for-rcov
|
||||
#==============================================================
|
||||
|
||||
require 'rake/clean'
|
||||
|
||||
rcov_path = ENV['RCOV_PATH'] ? ENV['RCOV_PATH'] : "#{Config::CONFIG['bindir']}/rcov"
|
||||
rcov_test_output = "./test/coverage"
|
||||
rcov_unit_test_output = "#{rcov_test_output}/unit"
|
||||
rcov_exclude="rubygems,test/test_"
|
||||
# Add our created paths to the 'rake clobber' list
|
||||
CLOBBER.include(rcov_unit_test_output)
|
||||
|
||||
desc 'Removes all previous unit test coverage information'
|
||||
task (:reset_unit_test_coverage) do |t|
|
||||
mkdir_p rcov_unit_test_output
|
||||
rm_rf rcov_unit_test_output
|
||||
mkdir rcov_unit_test_output
|
||||
Rcov::RcovTask.new do |t|
|
||||
t.test_files = FileList['test/test*.rb']
|
||||
t.rcov_opts << "-x /usr"
|
||||
t.output_dir = "test/coverage"
|
||||
end
|
||||
|
||||
desc 'Run all unit tests with Rcov to measure coverage'
|
||||
Rake::TestTask.new(:test_units_with_coverage => [ :reset_unit_test_coverage ]) do |t|
|
||||
t.libs << "test"
|
||||
t.pattern = 'test/**/*test*.rb'
|
||||
t.ruby_opts << rcov_path
|
||||
t.ruby_opts << "-o #{rcov_unit_test_output} -x #{rcov_exclude}"
|
||||
t.verbose = true
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue