Permalink
Browse files

wrapping the chocolateyInstall in a try catch and changing the path t…

…o chocolatey install to use the environment variable ($env:ChocolateyInstall)
  • Loading branch information...
1 parent 68fe0e6 commit 976466f859f2fb8587db1d299679806db4c15a33 @ferventcoder ferventcoder committed with Jun 6, 2012
Showing with 16 additions and 11 deletions.
  1. +16 −11 nuget/tools/chocolateyInstall.ps1
@@ -1,14 +1,19 @@
-$nugetPath = 'C:\NuGet'
-$nugetExePath = Join-Path $nuGetPath 'bin'
-$packageBatchFileName = Join-Path $nugetExePath "psake.bat"
+try {
+ $nugetPath = $env:ChocolateyInstall
+ $nugetExePath = Join-Path $nuGetPath 'bin'
+ $packageBatchFileName = Join-Path $nugetExePath "psake.bat"
-$psakeDir = (Split-Path -parent $MyInvocation.MyCommand.Definition)
-#$path = ($psakeDir | Split-Path | Join-Path -ChildPath 'psake.cmd')
-$path = Join-Path $psakeDir 'psake.cmd'
-Write-Host "Adding $packageBatchFileName and pointing to $path"
-"@echo off
-""$path"" %*" | Out-File $packageBatchFileName -encoding ASCII
+ $psakeDir = (Split-Path -parent $MyInvocation.MyCommand.Definition)
+ #$path = ($psakeDir | Split-Path | Join-Path -ChildPath 'psake.cmd')
+ $path = Join-Path $psakeDir 'psake.cmd'
+ Write-Host "Adding $packageBatchFileName and pointing to $path"
+ "@echo off
+ ""$path"" %*" | Out-File $packageBatchFileName -encoding ASCII
+ write-host "PSake is now ready. You can type 'psake' from any command line at any path. Get started by typing 'psake /?'"
-write-host "PSake is now ready. You can type 'psake' from any command line at any path. Get started by typing 'psake /?'"
-Start-Sleep 6
+ Write-ChocolateySuccess 'psake'
+} catch {
+ Write-ChocolateyFailure 'psake' "$($_.Exception.Message)"
+ throw
+}

0 comments on commit 976466f

Please sign in to comment.