Sha256: d045f9aeaea76cd86ec29bd8eeacb6d81fcb1a21212a00e7e0dc3f76736494a3

Contents?: true

Size: 1.23 KB

Versions: 1

Compression:

Stored size: 1.23 KB

Contents

require "pre_push/version"

module PrePush
	module ClassMethods
		def run
			success = build
			if (!success)
				puts 'build has failed'
				exit(1)
			end
			success = run_tests(@assemblies)
			if (!success)
				puts 'Tests have failed'
				exit(1)
			end
		end
		def build
			system "#{msbuild} #{@solution}"
			$?.success?
		end
	  def run_tests assemblies
	  	gem_lib = File.dirname(__FILE__)
			assemblies = assemblies || [@solution]
			assemblies = assemblies.empty? ? [@solution] : assemblies
			success = true
			assemblies.each do |assembly|
				exe = runners_exes[@test_runner]
	  		system "\"#{gem_lib}/runners/#{@test_runner}/#{exe}\" \"#{assembly}\""
	  		success &= $?.success?
	  	end
	  	success
	  end

	  private
	  def msbuild
	  	'C:/Windows/Microsoft.NET/Framework/v4.0.30319/MSBuild.exe'
	  end
	  def override_msbuild custom_msbuild
	  	define_singleton_method :msbuild do
	  		custom_msbuild
	  	end
	  end
	  def runners_exes
	  	{
				'mspec' => 'mspec-clr4.exe',
				'nunit262' => 'nunit-console.exe',
				'xunit191' => 'xunit.console.exe'
			}
	  end
	end

	def self.included(receiver)
		receiver.extend         ClassMethods
		#receiver.send :include, InstanceMethods
	end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pre_push-0.0.7 lib/pre_push.rb