Skip to content

Commit

Permalink
Merge branch 'stable'
Browse files Browse the repository at this point in the history
* stable:
  (GH-453) Adds exact filter option to choco list
  (GH-642) Show bitness downloading msg when both 32/64
  (GH-641) Support for more installer types
  (maint) move installers to a section by themselves
  • Loading branch information
ferventcoder committed Feb 26, 2016
2 parents aed7282 + d070827 commit 66abe26
Show file tree
Hide file tree
Showing 25 changed files with 306 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,12 @@ param(
}
Write-Debug "CPU is $bitWidth bit"

$bitPackage = 32
$bitPackage = ''
if ($url32bit -ne $url64bit -and $url64bit -ne $null -and $url64bit -ne '') { $bitPackage = '32 bit' }

if ($bitWidth -eq 64 -and $url64bit -ne $null -and $url64bit -ne '') {
Write-Debug "Setting url to '$url64bit' and bitPackage to $bitWidth"
$bitPackage = $bitWidth
$bitPackage = '64 bit'
$url = $url64bit;
# only set if urls are different
if ($url32bit -ne $url64bit) {
Expand All @@ -117,7 +119,7 @@ param(
$forceX86 = $env:chocolateyForceX86;
if ($forceX86) {
Write-Debug "User specified -x86 so forcing 32 bit"
$bitPackage = 32
if ($url32bit -ne $url64bit) { $bitPackage = '32 bit' }
$url = $url32bit
$checksum = $checksum32
$checksumType = $checksumType32
Expand Down Expand Up @@ -171,7 +173,7 @@ param(
}

if ($needsDownload) {
Write-Host "Downloading $packageName $bitPackage bit
Write-Host "Downloading $packageName $bitPackage
from `'$url`'"
Get-WebFile $url $fileFullPath -options $options
}
Expand Down
1 change: 1 addition & 0 deletions src/chocolatey.tests.integration/Scenario.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ private static ChocolateyConfiguration baseline_configuration()
config.Verbose = false;
config.Input = config.PackageNames = string.Empty;
config.ListCommand.LocalOnly = false;
config.ListCommand.Exact = false;
//config.Features.UsePowerShellHost = true;
//config.Features.AutoUninstaller = true;
//config.Features.CheckSumFiles = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,12 @@
<None Include="context\dependencies\hasdependency\2.1.0\tools\chocolateyuninstall.ps1">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="context\exactpackage\exactpackage.dontfind\1.0.0\exactpackage.dontfind.nuspec">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="context\exactpackage\exactpackage\1.0.0\exactpackage.nuspec">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="context\installpackage\1.0.0\installpackage.nuspec">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
Expand Down Expand Up @@ -400,6 +406,12 @@
<None Include="context\upgradepackage\1.1.0\tools\graphical.exe">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<Content Include="context\exactpackage\exactpackage.dontfind\1.0.0\tools\purpose.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="context\exactpackage\exactpackage\1.0.0\tools\purpose.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="infrastructure\filesystem\CopyMe.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>exactpackage.dontfind</id>
<version>1.0.0</version>
<title>exactpackage.dontfind</title>
<authors>__REPLACE_AUTHORS_OF_SOFTWARE__</authors>
<owners>__REPLACE_YOUR_NAME__</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>__REPLACE__</description>
<summary>__REPLACE__</summary>
<releaseNotes />
<tags>exactpackage.dontfind admin</tags>
</metadata>
<files>
<file src="tools\**" target="tools" />
</files>
</package>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
when running choco list exactpackage -e, this package should not be returned.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>exactpackage</id>
<version>1.0.0</version>
<title>exactpackage</title>
<authors>__REPLACE_AUTHORS_OF_SOFTWARE__</authors>
<owners>__REPLACE_YOUR_NAME__</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>__REPLACE__</description>
<summary>__REPLACE__</summary>
<releaseNotes />
<tags>exactpackage admin</tags>
</metadata>
<files>
<file src="tools\**" target="tools" />
</files>
</package>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
when running choco list exactpackage -e, this is the only package that should be returned.
48 changes: 48 additions & 0 deletions src/chocolatey.tests.integration/scenarios/ListScenarios.cs
Original file line number Diff line number Diff line change
Expand Up @@ -370,5 +370,53 @@ public void should_not_list_any_packages()
}

}

[Concern(typeof(ChocolateyListCommand))]
public class when_searching_for_an_exact_package : ScenariosBase
{
public override void Context()
{
Configuration = Scenario.list();
Scenario.reset(Configuration);
Scenario.add_packages_to_source_location(Configuration, "exactpackage*" + Constants.PackageExtension);
Service = NUnitSetup.Container.GetInstance<IChocolateyPackageService>();

Configuration.ListCommand.Exact = true;
Configuration.Input = Configuration.PackageNames = "exactpackage";
}

public override void Because()
{
MockLogger.reset();
Results = Service.list_run(Configuration).ToList();
}

[Fact]
public void should_contain_packages_and_versions_with_a_space_between_them()
{
MockLogger.contains_message("exactpackage 1.0.0").ShouldBeTrue();
}

[Fact]
public void should_not_contain_packages_that_do_not_match()
{
MockLogger.contains_message("exactpackage.dontfind").ShouldBeFalse();
}

[Fact]
public void should_contain_a_summary()
{
MockLogger.contains_message("packages found").ShouldBeTrue();
}

[Fact]
public void should_contain_debugging_messages()
{
MockLogger.contains_message("Searching for package information", LogLevel.Debug).ShouldBeTrue();
MockLogger.contains_message("Running list with the following filter", LogLevel.Debug).ShouldBeTrue();
MockLogger.contains_message("Start of List", LogLevel.Debug).ShouldBeTrue();
MockLogger.contains_message("End of List", LogLevel.Debug).ShouldBeTrue();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ namespace chocolatey.tests.infrastructure.app.services
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using chocolatey.infrastructure.app.domain.installers;
using Moq;
using NuGet;
using chocolatey.infrastructure.adapters;
Expand Down
17 changes: 10 additions & 7 deletions src/chocolatey/chocolatey.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@
<Compile Include="AssemblyExtensions.cs" />
<Compile Include="infrastructure.app\domain\GenericRegistryKey.cs" />
<Compile Include="infrastructure.app\domain\GenericRegistryValue.cs" />
<Compile Include="infrastructure.app\domain\installers\GhostInstaller.cs" />
<Compile Include="infrastructure.app\domain\installers\InstallForJInstaller.cs" />
<Compile Include="infrastructure.app\domain\installers\IzPackInstaller.cs" />
<Compile Include="infrastructure.app\domain\RegistryValueKindType.cs" />
<Compile Include="infrastructure\commandline\ReadKeyTimeout.cs" />
<Compile Include="infrastructure\commands\Execute.cs" />
Expand All @@ -108,7 +111,7 @@
<Compile Include="infrastructure.app\configuration\PackagesConfigFileSettings.cs" />
<Compile Include="infrastructure.app\domain\ConfigCommandType.cs" />
<Compile Include="infrastructure.app\domain\FeatureCommandType.cs" />
<Compile Include="infrastructure.app\domain\InstallerBase.cs" />
<Compile Include="infrastructure.app\domain\installers\InstallerBase.cs" />
<Compile Include="infrastructure.app\domain\PackageFile.cs" />
<Compile Include="infrastructure.app\domain\PackageFiles.cs" />
<Compile Include="infrastructure.app\domain\PinCommandType.cs" />
Expand Down Expand Up @@ -140,14 +143,14 @@
<Compile Include="infrastructure.app\nuget\NugetEncryptionUtility.cs" />
<Compile Include="infrastructure.app\services\ITemplateService.cs" />
<Compile Include="infrastructure.app\domain\ChocolateyPackageInformation.cs" />
<Compile Include="infrastructure.app\domain\CustomInstaller.cs" />
<Compile Include="infrastructure.app\domain\IInstaller.cs" />
<Compile Include="infrastructure.app\domain\InnoSetupInstaller.cs" />
<Compile Include="infrastructure.app\domain\InstallShieldInstaller.cs" />
<Compile Include="infrastructure.app\domain\installers\CustomInstaller.cs" />
<Compile Include="infrastructure.app\domain\installers\IInstaller.cs" />
<Compile Include="infrastructure.app\domain\installers\InnoSetupInstaller.cs" />
<Compile Include="infrastructure.app\domain\installers\InstallShieldInstaller.cs" />
<Compile Include="infrastructure.app\domain\InstallerType.cs" />
<Compile Include="infrastructure.app\domain\InstallTokens.cs" />
<Compile Include="infrastructure.app\domain\MsiInstaller.cs" />
<Compile Include="infrastructure.app\domain\NsisInstaller.cs" />
<Compile Include="infrastructure.app\domain\installers\MsiInstaller.cs" />
<Compile Include="infrastructure.app\domain\installers\NsisInstaller.cs" />
<Compile Include="infrastructure.app\domain\RegistryApplicationKey.cs" />
<Compile Include="infrastructure.app\nuget\ChocolateyLocalPackageRepository.cs" />
<Compile Include="infrastructure.app\nuget\ChocolateyNugetLogger.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,10 @@ public virtual void configure_argument_parser(OptionSet optionSet, ChocolateyCon
.Add("page-size=",
"Page Size - the amount of package results to return per page. Defaults to 25.",
option => configuration.ListCommand.PageSize = int.Parse(option))
.Add("e|exact",
"Exact - Only return packages with this exact name.",
option => configuration.ListCommand.Exact = option != null)
;
//todo exact name
}

public virtual void handle_additional_argument_parsing(IList<string> unparsedArguments, ChocolateyConfiguration configuration)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ public ListCommandConfiguration()
public bool IncludeRegistryPrograms { get; set; }
public int? Page { get; set; }
public int PageSize { get; set; }
public bool Exact { get; set; }
}

[Serializable]
Expand Down
4 changes: 4 additions & 0 deletions src/chocolatey/infrastructure.app/domain/InstallerType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ public enum InstallerType
Nsis,
InnoSetup,
InstallShield,
Ghost,
InstallForJ,
IzPack,
Squirrel,
Zip,
SevenZip,
HotfixOrSecurityUpdate,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright © 2011 - Present RealDimensions Software, LLC
// Copyright © 2011 - Present RealDimensions Software, LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -13,7 +13,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

namespace chocolatey.infrastructure.app.domain
namespace chocolatey.infrastructure.app.domain.installers
{
using System.Collections.Generic;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// Copyright © 2011 - Present RealDimensions Software, LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
//
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

namespace chocolatey.infrastructure.app.domain.installers
{
using System.Collections.Generic;

/// <summary>
/// Ghost Installer Options
/// </summary>
/// <remarks>
/// http://www.ethalone.com/products.html /
/// https://web.archive.org/web/20070812133050/http://www.ethalone.com/cgi-bin/ib/ikonboard.cgi?act=ST;f=2;t=195
/// Ghost has no logging or language options. The command line usage is very little.
/// </remarks>
public class GhostInstaller : InstallerBase
{
public GhostInstaller()
{
InstallExecutable = "\"{0}\"".format_with(InstallTokens.INSTALLER_LOCATION);
SilentInstall = "-s";
NoReboot = "";
LogFile = "";
CustomInstallLocation = "";
Language = "";
OtherInstallOptions = "";
UninstallExecutable = "\"{0}\"".format_with(InstallTokens.UNINSTALLER_LOCATION);
SilentUninstall = "-u -s";
OtherUninstallOptions = "";
ValidInstallExitCodes = new List<int>
{
0
};
ValidUninstallExitCodes = new List<int>
{
0
};
}

public override InstallerType InstallerType { get { return InstallerType.Ghost; } }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

namespace chocolatey.infrastructure.app.domain
namespace chocolatey.infrastructure.app.domain.installers
{
using System.Collections.Generic;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

namespace chocolatey.infrastructure.app.domain
namespace chocolatey.infrastructure.app.domain.installers
{
using System;
using System.Collections.Generic;

/// <summary>
Expand All @@ -30,16 +29,16 @@ public InnoSetupInstaller()
{
InstallExecutable = "\"{0}\" ".format_with(InstallTokens.INSTALLER_LOCATION);
SilentInstall = "/VERYSILENT";
NoReboot = "/NORESTART";
NoReboot = "/NORESTART /RESTARTEXITCODE=3010";
LogFile = "/LOG=\"{0}\\InnoSetup.Install.log\"".format_with(InstallTokens.PACKAGE_LOCATION);
CustomInstallLocation = "/DIR=\"{0}\"".format_with(InstallTokens.CUSTOM_INSTALL_LOCATION);
Language = "/LANG={0}".format_with(InstallTokens.LANGUAGE);
OtherInstallOptions = "/SP- /SUPPRESSMSGBOXES /CLOSEAPPLICATIONS /RESTARTAPPLICATIONS /NOICONS";
OtherInstallOptions = "/SP- /SUPPRESSMSGBOXES /CLOSEAPPLICATIONS /FORCECLOSEAPPLICATIONS /NOICONS";
UninstallExecutable = "\"{0}\"".format_with(InstallTokens.UNINSTALLER_LOCATION);
SilentUninstall = "/VERYSILENT";
OtherUninstallOptions = "/SUPPRESSMSGBOXES";
// http://www.jrsoftware.org/ishelp/index.php?topic=setupexitcodes
ValidInstallExitCodes = new List<int> { 0 };
ValidInstallExitCodes = new List<int> { 0, 3010 };
ValidUninstallExitCodes = new List<int> { 0 };
}

Expand Down
Loading

0 comments on commit 66abe26

Please sign in to comment.