Permalink
Browse files

Clean the web.config file from the repository after the node deployme…

…nt is complete (removes the file if not part of the repository).

This change fixes issue #308.
  • Loading branch information...
1 parent e061670 commit c7195d754ba3a89e96da44c5809e885c309c4137 Amit Apple committed Jan 24, 2013
Showing with 32 additions and 0 deletions.
  1. +32 −0 Kudu.Core/Deployment/Generator/NodeSiteBuilder.cs
@@ -1,7 +1,9 @@
using Kudu.Contracts.Settings;
+using Kudu.Core.SourceControl.Git;
using System;
using System.Globalization;
using System.IO.Abstractions;
+using System.Threading.Tasks;
namespace Kudu.Core.Deployment.Generator
{
@@ -11,5 +13,35 @@ public NodeSiteBuilder(IEnvironment environment, IDeploymentSettingsManager sett
: base(environment, settings, propertyProvider, repositoryPath, projectPath, "--node")
{
}
+
+ public override Task Build(DeploymentContext context)
+ {
+ try
+ {
+ return base.Build(context);
+ }
+ finally
+ {
+ SafeCleanWebConfig(context);
+ }
+ }
+
+ private void SafeCleanWebConfig(DeploymentContext context)
+ {
+ try
+ {
+ var git = new GitExecutable(Environment.RepositoryPath, DeploymentSettings.GetCommandIdleTimeout());
+ if (!String.IsNullOrEmpty(HomePath))
+ {
+ git.SetHomePath(HomePath);
+ }
+ var args = String.Format(CultureInfo.InvariantCulture, "clean -f {0}\\web.config", this.ProjectPath);
+ git.Execute(args);
+ }
+ catch (Exception ex)
+ {
+ context.Logger.Log(ex);
+ }
+ }
}
}

0 comments on commit c7195d7

Please sign in to comment.