Sha256: bf55453b4103a24f510d1ab009373fe437b4f69e404589d61ce6658f65f5722d
Contents?: true
Size: 1.74 KB
Versions: 1
Compression:
Stored size: 1.74 KB
Contents
require "pre_push/version" require "msbuild" 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 @solution.to_a.each do |s| system "#{msbuild} #{s}" end $?.success? end def run_tests assemblies assemblies = assemblies.to_a.empty? ? @solution.to_a : assemblies success = true gem_lib = File.dirname(__FILE__) tests_to_run = @tests_to_run || {@test_runner => assemblies} tests_to_run.each_pair do |test_to_run| test_to_run[1].each do |assembly| system "#{test_runner_path(gem_lib, test_to_run[0])} \"#{assembly}\"" success &= $?.success? end end success end private def msbuild MSBuild end def test_runner_path gem_lib, test_runner test_runner = test_runner.to_s "\"#{gem_lib}/runners/#{test_runner}/#{runners_exes[test_runner]}\"" end def override_msbuild custom_msbuild define_singleton_method :msbuild do custom_msbuild end end def force_test_runner runner_path define_singleton_method :test_runner_path do |gem_lib, nothing| runner_path end end def runners_exes { 'mspec' => 'mspec-clr4.exe', 'mspec0515' => 'mspec-clr4.exe', 'mspec0512' => 'mspec-clr4.exe', 'nunit262' => 'nunit-console.exe', 'nunit263' => 'nunit-console.exe', 'xunit191' => 'xunit.console.exe' } end end def self.included(receiver) receiver.extend ClassMethods #receiver.send :include, InstanceMethods end end class String def to_a [self] end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pre_push-1.1.2 | lib/pre_push.rb |