Sha256: c62cd251f215ceca42dc9160c5fb7cce5c2b07a90ce08e4a4d4872beb4cc36fc

Contents?: true

Size: 1.19 KB

Versions: 2

Compression:

Stored size: 1.19 KB

Contents

#!/usr/bin/env ruby

require "pre_push"
require "prepush_validator"
require "sln_finder"
require "args_parser"
require "fileutils"


parsed_args = PrePush::ArgsParser.execute(ARGV)
runner = parsed_args[:runner]
test_dlls = parsed_args[:test_dlls]
assemblies_line = "@assemblies = {dtt} # insert dlls to test if different to the solution."
commented_assemblies_line = "# @assemblies = ['path/to/first/test.dll','path/to/second/test.dll'] # insert dlls to test if different to the solution."

if PrePush::Validator.validate(runner)
	bin = File.dirname(__FILE__)
	FileUtils.cp("#{bin}/../lib/template/pre-push", ".git/hooks")

	pre_push_hook = ".git/hooks/pre-push"
	file_text = File.read(pre_push_hook)
	sln_path = PrePush::SlnFinder.find || "path/to/your.sln"
	content = file_text.gsub(/\{runner\}/, "\"#{runner}\"").gsub(/\{sln_path\}/, "\"#{sln_path}\"")
	if test_dlls != nil
		content = content.gsub(/\{dtt\}/, "#{test_dlls}")
	else 
		content = content.sub(assemblies_line, commented_assemblies_line)
	end
	File.open(pre_push_hook, "w") {|file| file.puts content}
	puts "the pre-push hook has been dropped into your hooks dir; please modify it to build your assembly & run your tests."
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pre_push-0.0.6 bin/prepush
pre_push-0.0.5 bin/prepush