Class: RakeDotNet::FxCopCmd

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dlls, params = {}) {|_self| ... } ⇒ FxCopCmd

Returns a new instance of FxCopCmd.

Yields:

  • (_self)

Yield Parameters:



470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
# File 'lib/rake_dotnet.rb', line 470

def initialize(dlls, params={})
	@dlls = dlls

	@exe_dir = params[:fxcop_exe_dir] || File.join(TOOLS_DIR, 'fxcop')
	@exe = params[:fxcop_exe] || File.join(@exe_dir, 'fxcopcmd.exe')

	@apply_out_xsl = params[:apply_out_xsl]
	@culture = params[:culture]
	@dependencies_path = params[:dependencies_path]
	@echo_to_console = params[:echo_to_console]
	@ignore_autogen = params[:ignore_autogen] || true
	@out_file = params[:out_file]
	@out_xsl = File.join(@exe_dir, 'Xml', params[:out_xsl]) unless params[:out_xsl].nil?
	@summary = params[:summary]
	@verbose = params[:verbose]
	@xsl_echo_to_console = params[:xsl_echo_to_console]

	yield self if block_given?
end

Instance Attribute Details

#apply_out_xslObject

Returns the value of attribute apply_out_xsl.



468
469
470
# File 'lib/rake_dotnet.rb', line 468

def apply_out_xsl
  @apply_out_xsl
end

#cultureObject

Returns the value of attribute culture.



468
469
470
# File 'lib/rake_dotnet.rb', line 468

def culture
  @culture
end

#dependencies_pathObject

Returns the value of attribute dependencies_path.



468
469
470
# File 'lib/rake_dotnet.rb', line 468

def dependencies_path
  @dependencies_path
end

#dllsObject

Returns the value of attribute dlls.



468
469
470
# File 'lib/rake_dotnet.rb', line 468

def dlls
  @dlls
end

#echo_to_consoleObject

Returns the value of attribute echo_to_console.



468
469
470
# File 'lib/rake_dotnet.rb', line 468

def echo_to_console
  @echo_to_console
end

#ignore_autogenObject

Returns the value of attribute ignore_autogen.



468
469
470
# File 'lib/rake_dotnet.rb', line 468

def ignore_autogen
  @ignore_autogen
end

#out_fileObject

Returns the value of attribute out_file.



468
469
470
# File 'lib/rake_dotnet.rb', line 468

def out_file
  @out_file
end

#out_xslObject

Returns the value of attribute out_xsl.



468
469
470
# File 'lib/rake_dotnet.rb', line 468

def out_xsl
  @out_xsl
end

#summaryObject

Returns the value of attribute summary.



468
469
470
# File 'lib/rake_dotnet.rb', line 468

def summary
  @summary
end

#verboseObject

Returns the value of attribute verbose.



468
469
470
# File 'lib/rake_dotnet.rb', line 468

def verbose
  @verbose
end

#xsl_echo_to_consoleObject

Returns the value of attribute xsl_echo_to_console.



468
469
470
# File 'lib/rake_dotnet.rb', line 468

def xsl_echo_to_console
  @xsl_echo_to_console
end

Instance Method Details

#cmdObject



514
515
516
# File 'lib/rake_dotnet.rb', line 514

def cmd
	"\"#{@exe}\" #{files_to_analyse} #{console} #{out_file} #{out_xsl} #{apply_out_xsl}"
end

#consoleObject



490
491
492
# File 'lib/rake_dotnet.rb', line 490

def console
	'/console' if @echo_to_console || @out_file.nil?
end

#files_to_analyseObject



494
495
496
497
498
499
500
# File 'lib/rake_dotnet.rb', line 494

def files_to_analyse
	list = ''
	@dlls.each do |dll|
		list += "/file:\"#{dll}\" "
	end
	list = list.chop
end

#runObject



518
519
520
521
522
# File 'lib/rake_dotnet.rb', line 518

def run
	puts cmd if VERBOSE
	sh cmd
	puts "##teamcity[importData type='FxCop' path='#{File.expand_path(@out_file)}']" if ENV['BUILD_NUMBER']
end