Class: RakeDotNet::NCoverReportingCmd

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

Instance Method Summary collapse

Constructor Details

#initialize(report_dir, coverage_files, params) ⇒ NCoverReportingCmd

Returns a new instance of NCoverReportingCmd.



903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
# File 'lib/rake_dotnet.rb', line 903

def initialize(report_dir, coverage_files, params)
	@report_dir = report_dir
	@coverage_files = coverage_files || []

	params ||= {}
	arch = params[:arch] || ENV['PROCESSOR_ARCHITECTURE']
	@exe = params[:ncover_reporting_exe] || File.join(TOOLS_DIR, 'ncover', arch, 'ncover.reporting.exe')

	@is_complete_version = `#{@exe}`.include?('NCover Reporting Complete v')
	# required
	@reports = params[:reports] || ['Summary', 'UncoveredCodeSections', 'FullCoverageReport']
	@output_path = File.join(@report_dir)

	# optional
	@sort_order = params[:sort] || 'CoveragePercentageAscending'
	@project_name = params[:project_name] || PRODUCT_NAME
end

Instance Method Details

#build_idObject



929
930
931
# File 'lib/rake_dotnet.rb', line 929

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

#cmdObject



960
961
962
# File 'lib/rake_dotnet.rb', line 960

def cmd
	return "\"#{@exe}\" #{coverage_files} #{build_id} #{output_reports} #{output_path} #{sort_order} #{project_name}"
end

#coverage_filesObject



921
922
923
924
925
926
927
# File 'lib/rake_dotnet.rb', line 921

def coverage_files
	list = ''
	@coverage_files.each do |cf|
		list += "\"#{cf}\" "
	end
	return list
end

#output_pathObject



948
949
950
# File 'lib/rake_dotnet.rb', line 948

def output_path
	return "//op \"#{@output_path}\""
end

#output_reportsObject



933
934
935
936
937
938
939
940
941
942
943
944
945
946
# File 'lib/rake_dotnet.rb', line 933

def output_reports
	cmd = ''
	if @is_complete_version
		@reports.each do |r|
			cmd += "//or #{r} "
		end
	else
		classic_version_reports_allowed = ['Summary', 'SymbolModule', 'SymbolModuleNamespace', 'SymbolModuleNamespaceClass', 'SymbolModuleNamespaceClassMethod']
		@reports.each do |r|
			cmd += "//or #{r} " if classic_version_reports_allowed.include?(r)
		end
	end
	return cmd
end

#project_nameObject



956
957
958
# File 'lib/rake_dotnet.rb', line 956

def project_name
	return "//p #{@project_name}" unless @project_name.nil?
end

#runObject



964
965
966
967
# File 'lib/rake_dotnet.rb', line 964

def run
	puts cmd if VERBOSE
	sh cmd
end

#sort_orderObject



952
953
954
# File 'lib/rake_dotnet.rb', line 952

def sort_order
	return "//so #{@sort_order}"
end