Class: RakeDotNet::NCoverConsoleCmd

Inherits:
Object
  • Object
show all
Defined in:
lib/rake_dotnet.rb

Instance Method Summary collapse

Constructor Details

#initialize(report_dir, dll_to_execute, params) ⇒ NCoverConsoleCmd

Returns a new instance of NCoverConsoleCmd.



848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
# File 'lib/rake_dotnet.rb', line 848

def initialize(report_dir, dll_to_execute, params)
	params ||= {}
	arch = params[:arch] || ENV['PROCESSOR_ARCHITECTURE']
	@exe = params[:ncover_exe] || File.join(TOOLS_DIR, 'ncover', arch, 'ncover.console.exe')
	@dll_to_execute = dll_to_execute
	ofname = File.split(dll_to_execute)[1].sub(/(\.dll)/, '') + '.coverage.xml'
	@output_file = File.join(report_dir, ofname)

	@exclude_assemblies_regex = params[:exclude_assemblies_regex] || ['.*Tests.*']
	@exclude_assemblies_regex.push('ISymWrapper')
	
	@profile_iis = params[:profile_iis] || false
	@working_dir = params[:working_dir] || Pathname.new(@dll_to_execute).dirname

	@is_complete_version = `#{@exe}`.include?('NCover Complete v')
end

Instance Method Details

#biObject



870
871
872
# File 'lib/rake_dotnet.rb', line 870

def bi
	return "//bi #{Versioner.new.get.to_s}"
end

#cmdObject



892
893
894
# File 'lib/rake_dotnet.rb', line 892

def cmd
	"\"#{@exe}\" #{cmdToRun} //x #{@output_file} #{exclude_assemblies} #{bi} #{working_dir} #{iis}"
end

#cmdToRunObject



865
866
867
868
# File 'lib/rake_dotnet.rb', line 865

def cmdToRun
	x = XUnitConsoleCmd.new(@dll_to_execute, '', nil, {})
	x.cmd
end

#exclude_assembliesObject



883
884
885
886
887
888
889
890
# File 'lib/rake_dotnet.rb', line 883

def exclude_assemblies
	return '' unless @is_complete_version
	if @exclude_assemblies_regex.instance_of?(Array) && @exclude_assemblies_regex.length > 0
		return '//eas ' + @exclude_assemblies_regex.join(';')
	end
	return '//eas ' + @exclude_assemblies_regex if @exclude_assemblies_regex.instance_of?(String)
	return ''
end

#iisObject



878
879
880
881
# File 'lib/rake_dotnet.rb', line 878

def iis
	return '' unless @is_complete_version
	return "//iis" if @profile_iis
end

#runObject



896
897
898
899
# File 'lib/rake_dotnet.rb', line 896

def run
	puts cmd if VERBOSE
	sh cmd
end

#working_dirObject



874
875
876
# File 'lib/rake_dotnet.rb', line 874

def working_dir
	return "//w #{@working_dir}"
end