Skip to content

Commit

Permalink
(chocolateyGH-274) Clean up how debugMode is expressed
Browse files Browse the repository at this point in the history
Previously we had an if condition on debugMode, but it is more
concise to just express it as a string appended to the list
of options passed to choco.
  • Loading branch information
smspillaz committed May 7, 2015
1 parent 92a1621 commit d7894b2
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions nuget/chocolatey/tools/chocolateysetup.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ $sysDrive = $env:SystemDrive
$tempDir = $env:TEMP
$defaultChocolateyPathOld = "$sysDrive\Chocolatey"
#$ErrorActionPreference = 'Stop'
$debugMode = $false
$debugModeParams = ""

function Initialize-Chocolatey {
<#
Expand Down Expand Up @@ -34,17 +34,13 @@ param(
Write-Debug "Initialize-Chocolatey"

if ($env:ChocolateyEnvironmentDebug -eq 'true') {
$debugMode = $true
$debugModeParams = "dv"
}

Install-DotNet4IfMissing

$chocoNew = Join-Path $thisScriptFolder 'chocolateyInstall\choco.exe'
if ($debugMode) {
& $chocoNew unpackself -fdvy
} else {
& $chocoNew unpackself -fy
}
& $chocoNew unpackself -fy$debugModeParams

$installModule = Join-Path $thisScriptFolder 'chocolateyInstall\helpers\chocolateyInstaller.psm1'
Import-Module $installModule -Force
Expand Down Expand Up @@ -313,11 +309,7 @@ param(
$chocoExeDest = Join-Path $chocolateyPath 'choco.exe'
Copy-Item $chocoExe $chocoExeDest -force

if ($debugMode) {
& $chocoExeDest unpackself -fdvy
} else {
& $chocoExeDest unpackself -fy
}
& $chocoExeDest unpackself -fy$debugModeParams
}

function Ensure-ChocolateyLibFiles {
Expand Down

0 comments on commit d7894b2

Please sign in to comment.