Skip to content

Commit

Permalink
Merge branch 'stable'
Browse files Browse the repository at this point in the history
* stable:
  (GH-124) Allow posh extensions from assemblies
  (GH-264) Do not fail if shortcut creation fails
  (GH-267) Make some variables available again.
  • Loading branch information
ferventcoder committed May 2, 2015
2 parents eeadfb6 + 50cb89f commit a7de809
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 25 deletions.
1 change: 1 addition & 0 deletions src/chocolatey.resources/helpers/chocolateyInstaller.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ if(Test-Path($extensionsPath)) {
Write-Debug 'Loading community extensions'
#Resolve-Path $extensionsPath\**\*\*.psm1 | % { Write-Debug "Importing `'$_`'"; Import-Module $_.ProviderPath }
Get-ChildItem $extensionsPath -recurse -filter "*.psm1" | Select -ExpandProperty FullName | % { Write-Debug "Importing `'$_`'"; Import-Module $_; }
Get-ChildItem $extensionsPath -recurse -filter "*.dll" | Select -ExpandProperty FullName | % { Write-Debug "Importing `'$_`'"; Import-Module $_; }
}

Export-ModuleMember -Function * -Alias *
14 changes: 14 additions & 0 deletions src/chocolatey.resources/helpers/chocolateyScriptRunner.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,19 @@ $version = $env:packageVersion
$packageName = $env:packageName
$packageFolder = $env:packageFolder

$helpersPath = (Split-Path -parent $MyInvocation.MyCommand.Definition);
$nugetChocolateyPath = (Split-Path -parent $helpersPath)
$nugetPath = $nugetChocolateyPath
$nugetExePath = Join-Path $nuGetPath 'bin'
$nugetLibPath = Join-Path $nuGetPath 'lib'
$badLibPath = Join-Path $nuGetPath 'lib-bad'
$extensionsPath = Join-Path $nugetPath 'extensions'
$chocInstallVariableName = "ChocolateyInstall"
$chocoTools = Join-Path $nuGetPath 'tools'
$nugetExe = Join-Path $chocoTools 'nuget.exe'
$7zip = Join-Path $chocoTools '7za.exe'
$ShimGen = Join-Path $chocoTools 'shimgen.exe'
$checksumExe = Join-Path $chocoTools 'checksum.exe'

Write-Debug "Running `'$packageScript`'";
& "$packageScript"
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ param(
$lnk.WorkingDirectory = $workingDirectory
$lnk.Save()

Write-Debug "Desktop Shortcut created pointing at `'$targetFilePath`'."
Write-Host "Desktop Shortcut created pointing at `'$targetFilePath`'."

}
catch {
throw $_.Exception
Write-Warning "Unable to create desktop link. Error captured was $($_.Exception.Message)."
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ try {
Write-Host "'$menuKey' explorer menu item has been created"
}
catch {
$errorMessage = "'$menuKey' explorer menu item was not created $($_.Exception.Message)"
Write-Error $errorMessage
throw $errorMessage
$errorMessage = "'$menuKey' explorer menu item was not created - $($_.Exception.Message)"
Write-Warning $errorMessage
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,28 @@ param(

Write-Debug "Running 'Install-ChocolateyPinnedTaskBarItem' with targetFilePath:`'$targetFilePath`'";

if (test-path($targetFilePath)) {
$verb = "Pin To Taskbar"
$path= split-path $targetFilePath
$shell=new-object -com "Shell.Application"
$folder=$shell.Namespace($path)
$item = $folder.Parsename((split-path $targetFilePath -leaf))
$itemVerb = $item.Verbs() | ? {$_.Name.Replace("&","") -eq $verb}
if($itemVerb -eq $null){
Write-Host "TaskBar verb not found for $item. It may have already been pinned"
} else {
$itemVerb.DoIt()
}
Write-Host "`'$targetFilePath`' has been pinned to the task bar on your desktop"
} else {
$errorMessage = "`'$targetFilePath`' does not exist, not able to pin to task bar"
}
if($errorMessage){
Write-Error $errorMessage
throw $errorMessage
try{
if (test-path($targetFilePath)) {
$verb = "Pin To Taskbar"
$path= split-path $targetFilePath
$shell=new-object -com "Shell.Application"
$folder=$shell.Namespace($path)
$item = $folder.Parsename((split-path $targetFilePath -leaf))
$itemVerb = $item.Verbs() | ? {$_.Name.Replace("&","") -eq $verb}
if($itemVerb -eq $null){
Write-Host "TaskBar verb not found for $item. It may have already been pinned"
} else {
$itemVerb.DoIt()
}
Write-Host "`'$targetFilePath`' has been pinned to the task bar on your desktop"
} else {
$errorMessage = "`'$targetFilePath`' does not exist, not able to pin to task bar"
}

if ($errorMessage) {
Write-Warning $errorMessage
}
} catch {
Write-Warning "Unable to create pin. Error captured was $($_.Exception.Message)."
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,6 @@ directoy, an icon to be used for the shortcut, along with a description and argu
Write-Debug "Shortcut created."
}
catch {
throw $_.Exception
Write-Warning "Unable to create shortcut. Error captured was $($_.Exception.Message)."
}
}

0 comments on commit a7de809

Please sign in to comment.