You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by as...@apache.org on 2008/08/16 05:22:47 UTC
svn commit: r686444 - in /incubator/buildr/trunk: rakelib/rspec.rake
spec/sandbox.rb
Author: assaf
Date: Fri Aug 15 20:22:47 2008
New Revision: 686444
URL: http://svn.apache.org/viewvc?rev=686444&view=rev
Log:
Brought RCov reports back from the dead
Modified:
incubator/buildr/trunk/rakelib/rspec.rake
incubator/buildr/trunk/spec/sandbox.rb
Modified: incubator/buildr/trunk/rakelib/rspec.rake
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/rakelib/rspec.rake?rev=686444&r1=686443&r2=686444&view=diff
==============================================================================
--- incubator/buildr/trunk/rakelib/rspec.rake (original)
+++ incubator/buildr/trunk/rakelib/rspec.rake Fri Aug 15 20:22:47 2008
@@ -37,18 +37,20 @@
task.spec_opts << '--options' << 'spec/spec.opts' << '--format' << 'failing_examples:failed' << '--example' << 'failed'
end
+ # TODO: Horribly broken! Fix some other time.
+ desc 'Run RSpec and generate Spec and coverage reports (slow)'
+ Spec::Rake::SpecTask.new('rcov') do |task|
+ task.spec_files = FileList['spec/**/*spec.rb']
+ task.spec_opts '--format' << 'html:reports/specs.html' << '--backtrace'
+ task.rcov = true
+ task.rcov_dir = 'reports/coverage'
+ task.rcov_opts << '--exclude' << "spec,bin,#{Config::CONFIG['sitedir']},#{Gem.path.join(',')}"
+ task.rcov_opts << '--text-summary'
+ end
+ file 'reports/coverage'=>'rcov'
+
# Useful for testing with JRuby when using Ruby and vice versa.
namespace 'spec' do
-=begin
- # TODO: Horribly broken! Fix some other time.
- desc 'Run RSpec and generate Spec and coverage reports (slow)'
- Spec::Rake::SpecTask.new('rcov') do |task|
- task.spec_files = FileList['spec/**/*spec.rb']
- task.rcov = true
- task.rcov_opts = '--exclude', 'spec,bin'
- task.rcov_dir = 'coverage'
- end
-=end
desc 'Run all specs specifically with Ruby'
task 'ruby' do
Modified: incubator/buildr/trunk/spec/sandbox.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/spec/sandbox.rb?rev=686444&r1=686443&r2=686444&view=diff
==============================================================================
--- incubator/buildr/trunk/spec/sandbox.rb (original)
+++ incubator/buildr/trunk/spec/sandbox.rb Fri Aug 15 20:22:47 2008
@@ -55,14 +55,16 @@
@rules = Buildr.application.instance_variable_get(:@rules)
def sandbox
+ @_sandbox = {}
+
# Create a temporary directory where we can create files, e.g,
# for projects, compilation. We need a place that does not depend
# on the current directory.
+ @_sandbox[:original_dir] = Dir.pwd
temp = File.join(File.dirname(__FILE__), '../tmp')
FileUtils.mkpath temp
Dir.chdir temp
- @_sandbox = {}
Buildr.application = Buildr::Application.new
Sandbox.tasks.each { |block| block.call }
Buildr.application.instance_variable_set :@rules, Sandbox.rules.clone
@@ -115,6 +117,8 @@
# Restore options.
Buildr.options.test = nil
(ENV.keys - @_sandbox[:env_keys]).each { |key| ENV.delete key }
+
+ Dir.chdir @_sandbox[:original_dir]
end
end