Skip to content

Commit

Permalink
(GH-592) Add Package Parameters to install
Browse files Browse the repository at this point in the history
So that during installation, end user can make a decision about what
features are enabled/disabled in Chocolatey GUI, as well as set any
configuration of Chocolatey GUI.

Chocolatey dependency was changed to ensure Chocolatey version of
Get-PackageParameters is used.
  • Loading branch information
gep13 committed May 6, 2019
1 parent 42dd8e0 commit 1245590
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 5 deletions.
21 changes: 16 additions & 5 deletions nuspec/chocolatey/ChocolateyGUI.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,36 @@
<bugTrackerUrl>https://github.com/chocolatey/ChocolateyGUI/issues</bugTrackerUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>
Chocolatey GUI is a nice GUI on top of the Chocolatey command line tool.
Chocolatey GUI is a delicious GUI on top of the Chocolatey command line tool.

## Features

* View all **installed** and **available** packages
* **Update** installed but outdated packages
* **Upgrade** installed, but outdated packages
* **Install** and **uninstall** packages
* See detailed **package information**

## Notes
This package will only work correctly on Windows 7 SP1 through Windows 10 (1708) or Windows Server 2008 R2 SP1 through Windows Server 2016, and requires .NET Framework 4.5.2 at minimum.
## Package Parameters

- `/ShowConsoleOutput` - Enables/disables whether or not Chocolatey GUI shows output from the commands being executed when a job is running
- `/DefaultToTileViewForLocalSource` - Enables/disables whether or not Chocolatey GUI defauls to tile instead of list view for the local source view
- `/DefaultToTileViewForRemoteSource` - Enables/disables whether or not Chocolatey GUI defauls to tile instead of list view for all remote source views
- `/UseDelayedSearch` - Enables/disables whether or not Chocolatey GUI uses a live search, which returns results after a short delay without clicking the search button
- `/ExcludeInstalledPackages` - Enables/disables whether or not Chocolatey GUI shows packages that are already installed when viewing sources
- `/ShowAggregatedSourceView` - Enables/disables whether or not Chocolatey GUI shows an additional source combining all sources into one location
- `/OutputPackagesCacheDurationInMinutes` - The length of time, in minutes, which Chocolatey GUI will wait before invalidating the cached result of outdated packages for the machine

As an example, the following installation command could be used to enable `ShowConsoleOutput` to ensure `UseDelayedSearch` is disabled, and set the output cache to 120 minutes:

`choco install chocolateygui --params="'/ShowConsoleOutput=$true /UseDelayedSearch=$false /OutputPackagesCacheDurationInMinutes=120'"
</description>
<summary>A GUI for Chocolatey</summary>
<releaseNotes>
All release notes for Chocolatey GUI can be found on the GitHub site - https://github.com/chocolatey/ChocolateyGUI/releases
</releaseNotes>
<tags>chocolateygui chocolatey admin foss</tags>
<dependencies>
<dependency id="Chocolatey" version="0.10.3" />
<dependency id="Chocolatey" version="0.10.8" />
<dependency id="chocolatey-core.extension" version="1.3.3" />
<dependency id="dotnet4.5.2" version="4.5.2.20140902" />
</dependencies>
Expand Down
68 changes: 68 additions & 0 deletions nuspec/chocolatey/chocolateyInstall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,72 @@ $installDirectory = Get-AppInstallLocation $packageArgs.softwareName

if ($installDirectory) {
Install-BinFile -Name "chocolateygui" -Path "$installDirectory\ChocolateyGui.exe" -UseStart
}

$pp = Get-PackageParameters

# Features
if($pp.ContainsKey("ShowConsoleOutput")) {
if($pp.ShowConsoleOutput -eq $true) {
Write-Output "Enabling ShowConsoleOutput..."
Start-ChocolateyProcessAsAdmin -Statements "feature enable --name=ShowConsoleOutput" -ExeToRun "chocolateygui"
} else {
Write-Output "Disabling ShowConsoleOutput..."
Start-ChocolateyProcessAsAdmin -Statements "feature disable --name=ShowConsoleOutput" -ExeToRun "chocolateygui"

}
}

if($pp.ContainsKey("DefaultToTileViewForLocalSource")) {
if($pp.DefaultToTileViewForLocalSource -eq $true) {
Write-Output "Enabling DefaultToTileViewForLocalSource..."
Start-ChocolateyProcessAsAdmin -Statements "feature enable --name=DefaultToTileViewForLocalSource" -ExeToRun "chocolateygui"
} else {
Write-Output "Disabling DefaultToTileViewForLocalSource..."
Start-ChocolateyProcessAsAdmin -Statements "feature disable --name=DefaultToTileViewForLocalSource" -ExeToRun "chocolateygui"
}
}

if($pp.ContainsKey("DefaultToTileViewForRemoteSource")) {
if($pp.DefaultToTileViewForRemoteSource -eq $true) {
Write-Output "Enabling DefaultToTileViewForRemoteSource..."
Start-ChocolateyProcessAsAdmin -Statements "feature enable --name=DefaultToTileViewForRemoteSource" -ExeToRun "chocolateygui"
} else {
Write-Output "Disabling DefaultToTileViewForRemoteSource..."
Start-ChocolateyProcessAsAdmin -Statements "feature disable --name=DefaultToTileViewForRemoteSource" -ExeToRun "chocolateygui"
}
}

if($pp.ContainsKey("UseDelayedSearch")) {
if($pp.UseDelayedSearch -eq $true) {
Write-Output "Enabling UseDelayedSearch..."
Start-ChocolateyProcessAsAdmin -Statements "feature enable --name=UseDelayedSearch" -ExeToRun "chocolateygui"
} else {
Write-Output "Disabling UseDelayedSearch..."
Start-ChocolateyProcessAsAdmin -Statements "feature disable --name=UseDelayedSearch" -ExeToRun "chocolateygui"
}
}

if($pp.ContainsKey("ExcludeInstalledPackages")) {
if($pp.ExcludeInstalledPackages -eq $true) {
Write-Output "Enabling ExcludeInstalledPackages..."
Start-ChocolateyProcessAsAdmin -Statements "feature enable --name=ExcludeInstalledPackages" -ExeToRun "chocolateygui"
} else {
Write-Output "Disabling ExcludeInstalledPackages..."
Start-ChocolateyProcessAsAdmin -Statements "feature disable --name=ExcludeInstalledPackages" -ExeToRun "chocolateygui"
}
}

if($pp.ContainsKey("ShowAggregatedSourceView")) {
if($pp.ShowAggregatedSourceView -eq $true) {
Write-Output "Enabling ShowAggregatedSourceView..."
Start-ChocolateyProcessAsAdmin -Statements "feature enable --name=ShowAggregatedSourceView" -ExeToRun "chocolateygui"
} else {
Write-Output "Disabling ShowAggregatedSourceView..."
Start-ChocolateyProcessAsAdmin -Statements "feature disable --name=ShowAggregatedSourceView" -ExeToRun "chocolateygui"
}
}

if($pp.ContainsKey("OutputPackagesCacheDurationInMinutes")) {
Start-ChocolateyProcessAsAdmin -Statements "config set --name=OutputPackagesCacheDurationInMinutes --value=$($pp.OutputPackagesCacheDurationInMinutes)" -ExeToRun "chocolateygui"
}

0 comments on commit 1245590

Please sign in to comment.