Originally created by Benjamin Fleischer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Git functions | |
# Mark Embling (http://www.markembling.info/) | |
# Is the current directory a git repository/working copy? | |
function isCurrentDirectoryGitRepository { | |
if ((Test-Path ".git") -eq $TRUE) { | |
return $TRUE | |
} | |
# Test within parent dirs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function downloadFile($url, $targetFile) | |
{ | |
"Downloading $url" | |
$uri = New-Object "System.Uri" "$url" | |
$request = [System.Net.HttpWebRequest]::Create($uri) | |
$request.set_Timeout(15000) #15 second timeout | |
$response = $request.GetResponse() | |
$totalLength = [System.Math]::Floor($response.get_ContentLength()/1024) | |
$responseStream = $response.GetResponseStream() | |
$targetStream = New-Object -TypeName System.IO.FileStream -ArgumentList $targetFile, Create |