Skip to content

Commit b9240e1

Browse files
AdmiringWormgep13
authored andcommitted
(chocolatey#2469) Remove deprecated Write-ChocolateySuccess
This function was deprecated is meant to be removed in v1.0.0. This commit removes this function, and all usages of the functions. There may need to be updates in other locations outside of this repository that do similar changes.
1 parent ffa3666 commit b9240e1

File tree

8 files changed

+29
-126
lines changed

8 files changed

+29
-126
lines changed

GenerateDocs.ps1

-8
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,6 @@ These functions call other functions and many times may be the only thing you ne
5757
* [Install-ChocolateyPowershellCommand](xref:install-chocolateypowershellcommand)
5858
* [Install-ChocolateyVsixPackage](xref:install-chocolateyvsixpackage)
5959
60-
## Error / Success Functions
61-
62-
* [Write-ChocolateySuccess](xref:write-chocolateysuccess) - **DEPRECATED**
63-
* [Write-ChocolateyFailure](xref:write-chocolateyfailure) - **DEPRECATED**
64-
65-
You really don't need a try catch with Chocolatey PowerShell files anymore.
66-
6760
## More Functions
6861
6962
### Administrative Access Functions
@@ -86,7 +79,6 @@ These are the functions from above as one list.
8679
8780
* [Install-ChocolateyZipPackage](xref:install-chocolateyzippackage)
8881
* [Install-ChocolateyPowershellCommand](xref:install-chocolateypowershellcommand)
89-
* [Write-ChocolateySuccess](xref:write-chocolateysuccess)
9082
* [Write-ChocolateyFailure](xref:write-chocolateyfailure)
9183
* [Get-ChocolateyWebFile](xref:get-chocolateywebfile)
9284
* [Get-ChocolateyUnzip](xref:get-chocolateyunzip)

src/chocolatey.resources/chocolatey.resources.csproj

-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@
8686
<EmbeddedResource Include="helpers\functions\UnInstall-ChocolateyZipPackage.ps1" />
8787
<EmbeddedResource Include="helpers\functions\Update-SessionEnvironment.ps1" />
8888
<EmbeddedResource Include="helpers\functions\Write-ChocolateyFailure.ps1" />
89-
<EmbeddedResource Include="helpers\functions\Write-ChocolateySuccess.ps1" />
9089
<EmbeddedResource Include="redirects\choco.exe.ignore" />
9190
<EmbeddedResource Include="redirects\chocolatey.exe.ignore" />
9291
<EmbeddedResource Include="redirects\cinst.exe.ignore" />

src/chocolatey.resources/helpers/functions/Write-ChocolateyFailure.ps1

-3
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,6 @@ The message to throw an error with.
4343
4444
.PARAMETER IgnoredArguments
4545
Allows splatting with arguments that do not apply. Do not use directly.
46-
47-
.LINK
48-
Write-ChocolateySuccess
4946
#>
5047
param(
5148
[string] $packageName,

src/chocolatey.resources/helpers/functions/Write-ChocolateySuccess.ps1

-54
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,13 @@
11
$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
22

3-
try {
4-
"simple file" | Out-File "$toolsDir\simplefile.txt" -force
3+
"simple file" | Out-File "$toolsDir\simplefile.txt" -force
54

6-
Write-Output "This is $packageName v$packageVersion being installed to `n '$packageFolder'."
7-
Write-Host "PowerShell Version is '$($PSVersionTable.PSVersion)' and CLR Version is '$($PSVersionTable.CLRVersion)'."
8-
Write-Host "Execution Policy is '$(Get-ExecutionPolicy)'."
9-
Write-Host "PSScriptRoot is '$PSScriptRoot'."
10-
Write-Debug "A debug message."
11-
Write-Verbose "Yo!"
12-
Write-Warning "A warning!"
13-
Write-Error "Oh no! An error"
14-
throw "We had an error captain!"
15-
16-
Write-ChocolateySuccess "$packageName"
17-
} catch {
18-
Write-ChocolateyFailure "$packageName" "$($_.Exception.Message)"
19-
throw
20-
}
5+
Write-Output "This is $packageName v$packageVersion being installed to `n '$packageFolder'."
6+
Write-Host "PowerShell Version is '$($PSVersionTable.PSVersion)' and CLR Version is '$($PSVersionTable.CLRVersion)'."
7+
Write-Host "Execution Policy is '$(Get-ExecutionPolicy)'."
8+
Write-Host "PSScriptRoot is '$PSScriptRoot'."
9+
Write-Debug "A debug message."
10+
Write-Verbose "Yo!"
11+
Write-Warning "A warning!"
12+
Write-Error "Oh no! An error"
13+
throw "We had an error captain!"
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,7 @@
11
$packageName = 'badpackage'
22

3-
try {
4-
5-
Write-Host "Ya!"
6-
Write-Debug "A debug message"
7-
Write-Warning "A warning!"
8-
Write-Error "Oh no! An error"
9-
throw "We had an error captain!"
10-
11-
Write-ChocolateySuccess "$packageName"
12-
} catch {
13-
Write-ChocolateyFailure "$packageName" "$($_.Exception.Message)"
14-
throw
15-
}
3+
Write-Host "Ya!"
4+
Write-Debug "A debug message"
5+
Write-Warning "A warning!"
6+
Write-Error "Oh no! An error"
7+
throw "We had an error captain!"
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,9 @@
1-
try {
2-
3-
Write-Output "This is $packageName v$packageVersion being installed to `n '$packageFolder'."
4-
Write-Host "PowerShell Version is '$($PSVersionTable.PSVersion)' and CLR Version is '$($PSVersionTable.CLRVersion)'."
5-
Write-Host "Execution Policy is '$(Get-ExecutionPolicy)'."
6-
Write-Host "PSScriptRoot is '$PSScriptRoot'."
7-
Write-Debug "A debug message."
8-
Write-Verbose "Yo!"
9-
Write-Warning "A warning!"
10-
Write-Error "Oh no! An error"
11-
throw "We had an error captain!"
12-
13-
Write-ChocolateySuccess "$packageName"
14-
} catch {
15-
Write-ChocolateyFailure "$packageName" "$($_.Exception.Message)"
16-
throw
17-
}
1+
Write-Output "This is $packageName v$packageVersion being installed to `n '$packageFolder'."
2+
Write-Host "PowerShell Version is '$($PSVersionTable.PSVersion)' and CLR Version is '$($PSVersionTable.CLRVersion)'."
3+
Write-Host "Execution Policy is '$(Get-ExecutionPolicy)'."
4+
Write-Host "PSScriptRoot is '$PSScriptRoot'."
5+
Write-Debug "A debug message."
6+
Write-Verbose "Yo!"
7+
Write-Warning "A warning!"
8+
Write-Error "Oh no! An error"
9+
throw "We had an error captain!"
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,7 @@
11
$packageName = 'badpackage'
22

3-
try {
4-
5-
Write-Host "Ya!"
6-
Write-Debug "A debug message"
7-
Write-Warning "A warning!"
8-
Write-Error "Oh no! An error"
9-
throw "We had an error captain!"
10-
11-
Write-ChocolateySuccess "$packageName"
12-
} catch {
13-
Write-ChocolateyFailure "$packageName" "$($_.Exception.Message)"
14-
throw
15-
}
3+
Write-Host "Ya!"
4+
Write-Debug "A debug message"
5+
Write-Warning "A warning!"
6+
Write-Error "Oh no! An error"
7+
throw "We had an error captain!"

0 commit comments

Comments
 (0)