Sha256: e3b20437d4992e9a790a019272bed8ac7deffaceaa2579b0e89bda34106b642d

Contents?: true

Size: 1.54 KB

Versions: 2

Compression:

Stored size: 1.54 KB

Contents

require "albacore/albacoretask"
require "albacore/config/ncoverconsoleconfig"

class NCoverConsole
  TaskName = :ncoverconsole

  include Albacore::Task
  include Albacore::RunCommand
  include Configuration::NCoverConsole

  attr_reader   :register
  
  attr_accessor :test_runner

  attr_array    :include_assemblies, 
                :exclude_assemblies, 
                :include_attributes,
                :exclude_attributes,
                :coverage

  attr_hash     :output
  
  def initialize
    @register = true
    
    super()
    update_attributes(ncoverconsole.to_hash)
  end
  
  def execute
    unless @test_runner
      fail_with_message("ncoverconsole requires #test_runner")
      return
    end
    
    result = run_command("ncoverconsole", build_parameters)
    fail_with_message("NCover Console failed, see the build log for more details.") unless result
  end
  
  def build_parameters
    p = []
    p << "//reg" if @register
    p << @output.map { |key, value| "//#{key} \"#{value}\"" } if @output
    p << "//include-assemblies \"#{@include_assemblies.join(";")}\"" if @include_assemblies
    p << "//exclude-assemblies \"#{@exclude_assemblies.join(";")}\"" if @exclude_assemblies
    p << "//include-attributes \"#{@include_attributes.join(";")}\"" if @include_attributes
    p << "//exclude-attributes \"#{@exclude_attributes.join(";")}\"" if @exclude_attributes
    p << "//coverage-type \"#{@coverage.join(", ")}\"" if @coverage
    p << @test_runner.build_command_line
    p
  end
  
  def no_registration
    @register = false
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
albacore-1.0.0 lib/albacore/ncoverconsole.rb
albacore-1.0.0.rc.3 lib/albacore/ncoverconsole.rb