Skip to content

Commit

Permalink
Merge branch 'stable'
Browse files Browse the repository at this point in the history
* stable:
  (GH-741) Ensure CultureInfo with PowerShell Host
  (GH-641) Add more installer types
  (maint) only log debug verbose for event messages
  (GH-354) Fix MSI template SilentArgs
  (maint) Fail on new --file when not supported
  (GH-641) add temp location
  • Loading branch information
ferventcoder committed May 25, 2016
2 parents bcf21da + 152d83e commit 1213a58
Show file tree
Hide file tree
Showing 12 changed files with 204 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,4 @@ if ($env:ChocolateyExitCode -ne $null -and $env:ChocolateyExitCode -ne '') {
$exitCode = $env:ChocolateyExitCode
}


Exit $exitCode
3 changes: 3 additions & 0 deletions src/chocolatey/chocolatey.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,11 @@
<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\installers\PackageForTheWebInstaller.cs" />
<Compile Include="infrastructure.app\domain\installers\QtInstaller.cs" />
<Compile Include="infrastructure.app\domain\installers\SetupFactoryInstaller.cs" />
<Compile Include="infrastructure.app\domain\installers\SquirrelInstaller.cs" />
<Compile Include="infrastructure.app\domain\installers\WiseInstaller.cs" />
<Compile Include="infrastructure.app\domain\RegistryValueKindType.cs" />
<Compile Include="infrastructure.app\events\HandlePackageResultCompletedMessage.cs" />
<Compile Include="infrastructure.app\services\FileTypeDetectorService.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,12 @@ public virtual void handle_validation(ChocolateyConfiguration configuration)
{
throw new ApplicationException("Name is required. Please pass in a name for the new package.");
}

if (configuration.NewCommand.Name.StartsWith("-file", StringComparison.OrdinalIgnoreCase) || configuration.NewCommand.Name.StartsWith("--file", StringComparison.OrdinalIgnoreCase))
{
throw new ApplicationException(@"Automatic package creation from installer files only available in Business
edition. See https://chocolatey.org/pricing for details.");
}
}

public virtual void help_message(ChocolateyConfiguration configuration)
Expand Down
1 change: 1 addition & 0 deletions src/chocolatey/infrastructure.app/domain/InstallTokens.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@ public static class InstallTokens
public const string PACKAGE_LOCATION = "{{PACKAGE_LOCATION}}";
public const string LANGUAGE = "{{LANGUAGE}}";
public const string UNINSTALLER_LOCATION = "{{UNINSTALLER_LOCATION}}";
public const string TEMP_LOCATION = "{{TEMP_LOCATION}}";
}
}
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 @@ -28,9 +28,13 @@ public enum InstallerType
IzPack,
BitRock,
Squirrel,
PackageForTheWeb,
SetupFactory,
Wise,
QtInstaller,
Zip,
SevenZip,
SevenZipInstaller,
HotfixOrSecurityUpdate,
ServicePack
}
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>
/// PackageForTheWeb Options
/// </summary>
/// <remarks>
/// </remarks>
public class PackageForTheWebInstaller : InstallerBase
{
public PackageForTheWebInstaller()
{
InstallExecutable = "\"{0}\"".format_with(InstallTokens.INSTALLER_LOCATION);
SilentInstall = "/s";
NoReboot = "";
LogFile = "";
CustomInstallLocation = "";
Language = "";
OtherInstallOptions = "";
UninstallExecutable = "\"{0}\"".format_with(InstallTokens.UNINSTALLER_LOCATION);
SilentUninstall = "/s";
OtherUninstallOptions = "";
ValidInstallExitCodes = new List<int>
{
0
};
ValidUninstallExitCodes = new List<int>
{
0
};
}

public override InstallerType InstallerType
{
get { return InstallerType.PackageForTheWeb; }
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// 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>
/// SetupFactory Options
/// </summary>
/// <remarks>
/// http://www.indigorose.com/webhelp/suf9/Program_Reference/Command_Line_Options.htm
///
/// While we can override the extraction path, it should already be overridden
/// because we are overriding the TEMP variable
/// </remarks>
public class SetupFactoryInstaller : InstallerBase
{
public SetupFactoryInstaller()
{
InstallExecutable = "\"{0}\"".format_with(InstallTokens.INSTALLER_LOCATION);
SilentInstall = "/S";
NoReboot = "";
LogFile = "";
// http://www.indigorose.com/forums/threads/23686-How-to-Set-the-Default-Application-Directory
// http://www.indigorose.com/webhelp/suf70/Program_Reference/Screen_Types/Select_Install_Folder/Properties.htm
// http://www.indigorose.com/webhelp/suf70/Program_Reference/Variables/Session_Variables.htm#AppFolder
// todo: basically we need an environment variable for AppFolder
CustomInstallLocation = "";
Language = "";
//OtherInstallOptions = "\"/T:{0}\"".format_with(InstallTokens.TEMP_LOCATION);
OtherInstallOptions = "";
UninstallExecutable = "\"{0}\"".format_with(InstallTokens.UNINSTALLER_LOCATION);
SilentUninstall = "/S";
OtherUninstallOptions = "";
ValidInstallExitCodes = new List<int>
{
0
};
ValidUninstallExitCodes = new List<int>
{
0
};
}

public override InstallerType InstallerType
{
get { return InstallerType.SetupFactory; }
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// 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>
/// WISE Options
/// </summary>
/// <remarks>
/// https://support.symantec.com/en_US/article.HOWTO5865.html
/// http://www.itninja.com/blog/view/wise-setup-exe-switches
///
/// While we can override the extraction path, it should already be overridden
/// because we are overriding the TEMP variable
/// </remarks>
public class WiseInstaller : InstallerBase
{
public WiseInstaller()
{
InstallExecutable = "\"{0}\"".format_with(InstallTokens.INSTALLER_LOCATION);
SilentInstall = "/s";
NoReboot = "";
LogFile = "";
// http://www.itninja.com/question/wise-package-install-switches-for-install-path
CustomInstallLocation = "";
Language = "";
OtherInstallOptions = "";
UninstallExecutable = "\"{0}\"".format_with(InstallTokens.UNINSTALLER_LOCATION);
SilentUninstall = "/s";
// http://www.symantec.com/connect/blogs/wisescript-command-line-options
OtherUninstallOptions = "\"{0}\\Uninstall.Log\"".format_with(InstallTokens.TEMP_LOCATION);
ValidInstallExitCodes = new List<int>
{
0
};
ValidUninstallExitCodes = new List<int>
{
0
};
}

public override InstallerType InstallerType
{
get { return InstallerType.Wise; }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,11 @@ public void run(PackageResult packageResult, ChocolateyConfiguration config)
uninstallArgs += " " + installer.build_uninstall_command_arguments();
}

var logLocation = _fileSystem.combine_paths(_fileSystem.get_full_path(config.CacheLocation), "chocolatey", pkgInfo.Package.Id, pkgInfo.Package.Version.to_string());
this.Log().Debug(() => " Setting up uninstall logging directory at {0}".format_with(logLocation.escape_curly_braces()));
_fileSystem.create_directory_if_not_exists(_fileSystem.get_directory_name(logLocation));
uninstallArgs = uninstallArgs.Replace(InstallTokens.PACKAGE_LOCATION, logLocation);
var packageCacheLocation = _fileSystem.combine_paths(_fileSystem.get_full_path(config.CacheLocation), pkgInfo.Package.Id, pkgInfo.Package.Version.to_string());
this.Log().Debug(() => " Setting up uninstall logging directory at {0}".format_with(packageCacheLocation.escape_curly_braces()));
_fileSystem.create_directory_if_not_exists(_fileSystem.get_directory_name(packageCacheLocation));
uninstallArgs = uninstallArgs.Replace(InstallTokens.PACKAGE_LOCATION, packageCacheLocation);
uninstallArgs = uninstallArgs.Replace(InstallTokens.TEMP_LOCATION, packageCacheLocation);

this.Log().Debug(() => " Args are '{0}'".format_with(uninstallArgs.escape_curly_braces()));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public void set_normal()
InstallerType = "EXE_MSI_OR_MSU";
Url = "";
Url64 = "";
SilentArgs = @"/qn /norestart /l*v `""$env:TEMP\chocolatey\$($packageName)\$($packageName).MsiInstall.log`""";
SilentArgs = @"/qn /norestart /l*v `""$($env:TEMP)\chocolatey\$($packageName)\$($packageName).MsiInstall.log`""";
AutomaticPackageNotesNuspec = "";
Checksum = "";
ChecksumType = "md5";
Expand Down
6 changes: 4 additions & 2 deletions src/chocolatey/infrastructure/powershell/PoshHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ public class PoshHost : PSHost
private readonly ChocolateyConfiguration _configuration;
private readonly Guid _hostId = Guid.NewGuid();
private readonly PoshHostUserInterface _psUI;
private readonly CultureInfo _cultureInfo = System.Threading.Thread.CurrentThread.CurrentCulture;
private readonly CultureInfo _cultureUiInfo = System.Threading.Thread.CurrentThread.CurrentUICulture;

private bool _isClosing;

Expand Down Expand Up @@ -60,12 +62,12 @@ public override void SetShouldExit(int exitCode)

public override CultureInfo CurrentCulture
{
get { return CultureInfo.InvariantCulture; }
get { return _cultureInfo; }
}

public override CultureInfo CurrentUICulture
{
get { return CultureInfo.InvariantCulture; }
get { return _cultureUiInfo; }
}

public override Guid InstanceId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ namespace chocolatey.infrastructure.services
using System.Reactive.Subjects;
using events;
using guards;
using logging;

/// <summary>
/// Implementation of IEventSubscriptionManagerService
Expand All @@ -35,7 +36,7 @@ public void publish<Event>(Event eventMessage) where Event : class, IMessage
{
Ensure.that(() => eventMessage).is_not_null();

this.Log().Debug(() => "Sending message '{0}' out if there are subscribers...".format_with(typeof (Event).Name));
this.Log().Debug(ChocolateyLoggers.Verbose, () => "Sending message '{0}' out if there are subscribers...".format_with(typeof (Event).Name));

_subject.OnNext(eventMessage);
}
Expand Down

0 comments on commit 1213a58

Please sign in to comment.