Last active
August 19, 2019 23:07
-
-
Save nkolev92/6fe0d2922bc12c003a166f9a628ed6e2 to your computer and use it in GitHub Desktop.
darc-init.ps1
This file contains hidden or 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
param ( | |
$darcVersion = $null, | |
$versionEndpoint = "https://maestro-prod.westus2.cloudapp.azure.com/api/assets/darc-version?api-version=2019-01-16" | |
) | |
$verbosity = "d" | |
. $PSScriptRoot\tools.ps1 | |
function InstallDarcCli ($darcVersion) { | |
$darcCliPackageName = "microsoft.dotnet.darc" | |
$dotnetRoot = InitializeDotNetCli -install:$true | |
$dotnet = "$dotnetRoot\dotnet.exe" | |
$toolList = & "$dotnet" tool list -g | |
Write-Host "The dotnet root is $dotnetRoot" | |
if ($toolList -like "*$darcCliPackageName*") { | |
& "$dotnet" tool uninstall $darcCliPackageName -g | |
} | |
# If the user didn't explicitly specify the darc version, | |
# query the Maestro API for the correct version of darc to install. | |
if (-not $darcVersion) { | |
$darcVersion = $(Invoke-WebRequest -Uri $versionEndpoint -UseBasicParsing).Content | |
} | |
$arcadeServicesSource = 'https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json' | |
Write-Host "Installing Darc CLI version $darcVersion..." | |
Write-Host "You may need to restart your command window if this is the first dotnet tool you have installed." | |
& "$dotnet" tool install $darcCliPackageName --version $darcVersion --add-source "$arcadeServicesSource" -v $verbosity -g | |
} | |
InstallDarcCli $darcVersion |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment