Skip to content

Instantly share code, notes, and snippets.

@petarvucetin
Created June 6, 2017 01:48
Show Gist options
  • Save petarvucetin/c185eeb20ee98e16debeb0d6821caddf to your computer and use it in GitHub Desktop.
Save petarvucetin/c185eeb20ee98e16debeb0d6821caddf to your computer and use it in GitHub Desktop.
#Downloads latest paket.bootstrapper.exe from github
$urlbase = "https://github.com"
$latestPage="$urlbase/fsprojects/Paket/releases/latest"
$exe = "paket.bootstrapper.exe"
Write-Host "Parsing latest release page: $latestPage"
$urlRegex = '<a\s+(?:[^>]*?\s+)?href=(["''])(.*?)paket.bootstrapper.exe\1'
$wc=new-object net.webclient
$wc.UseDefaultCredentials=$true
$wc.Proxy.Credentials=$wc.Credentials
$content=$wc.DownloadString($latestPage)
$latestBootStrapper = $content | Select-String -Pattern $urlRegex -AllMatches | % { $_.Matches | % { $_.Groups[2].Value } }
$dlurl="$urlbase$latestBootStrapper$exe"
Write-Host "Downloading paket.bootstrapper.exe from $dlurl"
$wc.DownloadFile($dlurl, (join-path (resolve-path ".\.paket") "paket.bootstrapper.exe"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment