Skip to content

Commit

Permalink
Made change in configure-integration-tests
Browse files Browse the repository at this point in the history
made white spaces consistent and changed the message
  • Loading branch information
nubby109 committed Mar 7, 2016
1 parent 652ef6a commit 8609575
Showing 1 changed file with 60 additions and 63 deletions.
123 changes: 60 additions & 63 deletions script/configure-integration-tests.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# TODO: this should indicate whether a variable is required or optional

function SetVariable([string]$key, [string]$value)
{
Expand All @@ -8,72 +7,70 @@ function SetVariable([string]$key, [string]$value)

function AskYesNoQuestion([string]$question, [string]$key)
{
$answer = Read-Host -Prompt ($question + " Press Y to set this, otherwise we'll skip it")
if ($answer -eq "Y")
{
SetVariable $key "YES"
}
else
{
SetVariable $key $null
}

Write-Host

return ($answer -eq "Y")
$answer = Read-Host -Prompt ($question + " Press Y to set this, otherwise we'll skip it")
if ($answer -eq "Y")
{
SetVariable $key "YES"
}
else
{
SetVariable $key $null
}
Write-Host
return ($answer -eq "Y")
}

function VerifyEnvironmentVariable([string]$friendlyName, [string]$key, [bool]$optional = $false)
{
if ($optional -eq $true)
{
$label = "(optional)"
}
else
{
$label = "(required)"
}

$existing_value = [environment]::GetEnvironmentVariable($key,"User")
if ($existing_value -eq $null)
{
$value = Read-Host -Prompt "Set the $friendlyName to use for the integration tests $label"
SetVariable $key $value
}
else
{
Write-Host "$existing_value found as the configured $friendlyName"
if ($optional -eq $true)
{
$clear = Read-Host -Prompt 'Want to remove or change this optional value, press Y'
if ($clear -eq "Y")
{
$reset = Read-Host -Prompt "Press R to remove and Press C to change the value, otherwise we'll move on"
if ($reset -eq "C")
{
$value = Read-Host -Prompt "Change the $friendlyName to use for the integration tests"
SetVariable $key $value
}
elseif ($reset -eq "R")
{
SetVariable $key $null
}
}

}
else
{
$reset = Read-Host -Prompt "Want to change this value , press Y, otherwise we'll move on"
if ($reset -eq "Y")
{
$value = Read-Host -Prompt "Change the $friendlyName to use for the integration tests"
SetVariable $key $value
}
}

}

Write-Host
if ($optional -eq $true)
{
$label = "(optional)"
}
else
{
$label = "(required)"
}

$existing_value = [environment]::GetEnvironmentVariable($key,"User")
if ($existing_value -eq $null)
{
$value = Read-Host -Prompt "Set the $friendlyName to use for the integration tests $label"
SetVariable $key $value
}
else
{
Write-Host "$existing_value found as the configured $friendlyName"
if ($optional -eq $true)
{
$clear = Read-Host -Prompt 'Want to remove or change this optional value, press Y'
if ($clear -eq "Y")
{
$reset = Read-Host -Prompt "Press R to remove and Press C to change the value, otherwise we'll move on"
if ($reset -eq "C")
{
$value = Read-Host -Prompt "Change the $friendlyName to use for the integration tests"
SetVariable $key $value
}
elseif ($reset -eq "R")
{
SetVariable $key $null
}
}
}
else
{
$reset = Read-Host -Prompt "Press Y to change this value, otherwise we'll move on "
if ($reset -eq "Y")
{
$value = Read-Host -Prompt "Change the $friendlyName to use for the integration tests"
SetVariable $key $value
}
}
}

Write-Host
}

Write-Host
Expand Down

0 comments on commit 8609575

Please sign in to comment.