Skip to content

Instantly share code, notes, and snippets.

@mastilver
Last active October 9, 2017 09:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mastilver/b61f60b80d6fb8fa6eaf3d346bf3734c to your computer and use it in GitHub Desktop.
Save mastilver/b61f60b80d6fb8fa6eaf3d346bf3734c to your computer and use it in GitHub Desktop.
Hubflow windows installer
Add-Type -AssemblyName System.IO.Compression.FileSystem
$TEMP = $([environment]::GetEnvironmentVariable("TEMP", "User"))
$CWD = $(Split-Path $MyInvocation.MyCommand.Path)
$PATH = $([environment]::GetEnvironmentVariable("PATH", "User"))
$git_folder = "C:\Program Files\Git"
$git_bin_folder = "$($git_folder)\bin"
$tmp_folder = "$($TEMP)\$([guid]::NewGuid())";
$bin_zip_output = "$($tmp_folder)\bin.zip"
$dep_zip_output = "$($tmp_folder)\dep.zip"
$bin_folder_output = "$($tmp_folder)\bin"
$dep_folder_output = "$($tmp_folder)\dep"
$bin_url = "https://downloads.sourceforge.net/gnuwin32/util-linux-ng-2.14.1-bin.zip"
$dep_url = "http://downloads.sourceforge.net/gnuwin32/util-linux-ng-2.14.1-dep.zip"
$hubflow_folder = "$($tmp_folder)\hubflow"
mkdir $tmp_folder
Write-Host $tmp_folder
# Install dependencies
Invoke-WebRequest -Uri $bin_url -OutFile $bin_zip_output -UserAgent [Microsoft.PowerShell.Commands.PSUserAgent]::FireFox
Invoke-WebRequest -Uri $dep_url -OutFile $dep_zip_output -UserAgent [Microsoft.PowerShell.Commands.PSUserAgent]::FireFox
[System.IO.Compression.ZipFile]::ExtractToDirectory($bin_zip_output, $bin_folder_output)
[System.IO.Compression.ZipFile]::ExtractToDirectory($dep_zip_output, $dep_folder_output)
cp "$($bin_folder_output)/bin/getopt.exe" $git_bin_folder
cp "$($bin_folder_output)/bin/getopt.exe" $git_bin_folder
# Install hubflow
git clone --depth 1 https://github.com/mvalipour/hubflow $hubflow_folder
cd $hubflow_folder
git submodule update --depth 1 --remote --init --checkout
./install-win.cmd $git_folder install
# Update PATH
if ($PATH -notcontains $git_bin_folder) {
[Environment]::SetEnvironmentVariable("PATH", "$($PATH);$($git_bin_folder)", "User")
}
# Ugrade hubflow
git hf upgrade
cd $CWD
Remove-Item -Recurse -Force $tmp_folder
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment