Sha256: 714215658c6dd9fe10aa5df5c06d6814f5313edba2553b5b7c9b0506117acc85
Contents?: true
Size: 1.81 KB
Versions: 19
Compression:
Stored size: 1.81 KB
Contents
require_relative('./commandarray.rb') class Test < CommandArray def update # rspec tests, 'rspec --pattern="**/*.spec"' self.add 'rspec' if(Dir.glob("**/*spec.rb").length > 0) test_files=collect_nunit_files if(defined?(DEV_TASKS) && DEV_TASKS.has_key?(:files) && DEV_TASKS[:files].has_key?(:test)) test_files=DEV_TASKS[:files][:test] end if(!test_files.nil?) test_files.each {|tf| if(tf.include?('.dll')) nunit_dll=tf if(nunit_dll.include?('x86')) self.add "\"#{Test.nunit_console_x86}\" \"#{Rake.application.original_dir}\\#{nunit_dll}\" /xml:\"#{nunit_dll}.TestResults.xml\"" else self.add "\"#{Test.nunit_console}\" \"#{Rake.application.original_dir}\\#{nunit_dll}\" /xml:\"#{nunit_dll}.TestResults.xml\"" end end } end end def collect_nunit_files results=Array.new Dir.glob("*.csproj").each{|p| text = File.read(p) if(text.include?("nunit.framework.dll")) # extract AssemblyName of form: <AssemblyName>MyLibrary.Test</AssemblyName> assemblyName=text[/<AssemblyName>([\w\.]+)</,1] outputPath=text[/Release[.\w\W]+<OutputPath>([\w\.\\]+)</,1] if(!assemblyName.nil? && !outputPath.nil?) results << "#{outputPath}\\#{assemblyName}.dll".gsub("\\\\","\\").gsub('/','\\') end end } results end def self.nunit_console nunit="C:\\Program Files (x86)\\NUnit 2.6.4\\bin\\nunit-console.exe" nunit="C:\\Program Files (x86)\\NUnit 2.6.3\\bin\\nunit-console.exe" if(!File.exists?(nunit)) nunit end def self.nunit_console_x86 nunit="C:\\Program Files (x86)\\NUnit 2.6.4\\bin\\nunit-console-x86.exe" nunit="C:\\Program Files (x86)\\NUnit 2.6.3\\bin\\nunit-console-x86.exe" if(!File.exists?(nunit)) nunit end end
Version data entries
19 entries across 19 versions & 1 rubygems