Sha256: 37ca64a1c5b99a72bdc171785988f85fb4a405b3d9ced2e8af444210b0657567

Contents?: true

Size: 1.07 KB

Versions: 1

Compression:

Stored size: 1.07 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]
msbuild = parsed_args[:msbuild]

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.sub("# @assemblies = {test_dlls}", "@assemblies = #{test_dlls}")
	end
	if msbuild != nil
		content = content.sub("# override_msbuild 'path/to/custom/msbuild.exe'","override_msbuild '#{msbuild}'")
	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

1 entries across 1 versions & 1 rubygems

Version Path
pre_push-0.0.7 bin/prepush