/
NodeSiteBuilder.cs
47 lines (44 loc) · 1.45 KB
/
NodeSiteBuilder.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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
{
public class NodeSiteBuilder : BaseBasicBuilder
{
public NodeSiteBuilder(IEnvironment environment, IDeploymentSettingsManager settings, IBuildPropertyProvider propertyProvider, string repositoryPath, string projectPath)
: 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);
}
}
}
}