Skip to content

Commit

Permalink
(GH-584) Handle Package Result Additional Checks
Browse files Browse the repository at this point in the history
  • Loading branch information
ferventcoder committed Mar 6, 2016
1 parent 729986f commit 55d8e4e
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/chocolatey/chocolatey.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
<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.app\events\HandlePackageResultCompletedMessage.cs" />
<Compile Include="infrastructure\commandline\ReadKeyTimeout.cs" />
<Compile Include="infrastructure\commands\Execute.cs" />
<Compile Include="GetChocolatey.cs" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// 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.events
{
using configuration;
using domain;
using infrastructure.events;
using results;

public class HandlePackageResultCompletedMessage : IMessage
{
public PackageResult PackageResult { get; private set; }
public ChocolateyConfiguration Config { get; private set; }
public CommandNameType CommandName { get; private set; }

public HandlePackageResultCompletedMessage(PackageResult packageResult, ChocolateyConfiguration config, CommandNameType commandName)
{
PackageResult = packageResult;
Config = config;
CommandName = commandName;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ namespace chocolatey.infrastructure.app.services
using commandline;
using configuration;
using domain;
using events;
using infrastructure.commands;
using infrastructure.events;
using infrastructure.services;
using logging;
using NuGet;
Expand Down Expand Up @@ -302,6 +304,7 @@ public void handle_package_result(PackageResult packageResult, ChocolateyConfigu

_packageInfoService.save_package_information(pkgInfo);
ensure_bad_package_path_is_clean(config, packageResult);
EventManager.publish(new HandlePackageResultCompletedMessage(packageResult, config, commandName));

if (!packageResult.Success)
{
Expand All @@ -310,7 +313,7 @@ public void handle_package_result(PackageResult packageResult, ChocolateyConfigu

return;
}

remove_rollback_if_exists(packageResult);

this.Log().Info(ChocolateyLoggers.Important, " The {0} of {1} was successful.".format_with(commandName.to_string(), packageResult.Name));
Expand Down

0 comments on commit 55d8e4e

Please sign in to comment.