I find the following works fairly well for the rcov output:
1.  create a build_settings.rb file in your [rails_project]/lib directory
that contains the following:

  module BuildSettings
    attr_reader :coverage_dir
    def coverage_dir
      @coverage_dir ||= ( ENV['CC_BUILD_ARTIFACTS'] || 'coverage' )
    end
  end

2.  include the file at the top of your rake file
([rails_project]/lib/tasks/my_project.rake) and use that method in the tasks
:

  require "#{RAILS_ROOT}/lib/build_settings"
  ...
  desc "Task for cruise Control"
  task :cruise do
    Rake::Task['test:coverage:run'].invoke
  end

  namespace :test do
    namespace :coverage do
      include BuildSettings
      desc "Run specs and rcov"
      Spec::Rake::SpecTask.new(:run => ['test:prepare',
'test:coverage:prepare']) do |t|
        t.verbose = true
        t.spec_opts = [ ... ]
        t.spec_files = [ ... ]
        t.rcov = true
        t.libs = ['lib']
        t.rcov_dir = coverage_dir
        t.rcov_opts = [ ... ]
      end
    end
  end


That way, if you call rake cruise manually, it defaults to
[rails_project]/coverage.  If CruiseControl runs it, it sets the property
for the task.

My problem with this setup is that, while all the rcov files end up in the
"Custom Build Artifacts" section, I can't get the build.log to work
properly.  I always just get "build failed" if it fails, and the message,
"/home/builder/cruisecontrolrb-1.2.1/projects/foo/build-10/build.log doesn't
exist"

Anybody else seeing this problem?  I've tried calling the regular "test"
task before the "spec" task to no avail.

-Gaius


Ingo Weiss-3 wrote:
> 
> ...
> we are using rspec and would like to make both an rspec html report  
> and an rcov html report available as cc build artifacts. I cobbled  
> something together for the rspec report, but it feels clunky and I am  
> wondering whether anybody has written a plugin or something for this  
> already.
> ...
> 
-- 
View this message in context: 
http://www.nabble.com/rspec-html-report-and-rcov-report-as-build-artifacts-tp13390178p14462351.html
Sent from the CruiseControl.rb - Users mailing list archive at Nabble.com.
_______________________________________________
Cruisecontrolrb-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/cruisecontrolrb-users

Reply via email to