Skip to content

Commit

Permalink
Merge pull request #36 from erikvanbrakel/develop
Browse files Browse the repository at this point in the history
v0.6.0
  • Loading branch information
Erik van Brakel authored Oct 12, 2017
2 parents 59ec28b + 6c3add8 commit 461f730
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 16 deletions.
5 changes: 3 additions & 2 deletions src/Cake.Terraform/HtmlFormatter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Net;

namespace Cake.Terraform
{
Expand Down Expand Up @@ -73,12 +74,12 @@ public override string FormatLines(IEnumerable<string> lines)
{
var match = regex.Match(line);
if(match.Success) {
var styledLine = $"{match.Groups[1].Value}<span class=\"{_styles[match.Groups[2].Value]}\">{match.Groups[3].Value}</span>";
var styledLine = $"{WebUtility.HtmlEncode(match.Groups[1].Value)}<span class=\"{_styles[match.Groups[2].Value]}\">{WebUtility.HtmlEncode(match.Groups[3].Value)}</span>";
outputBuilder.AppendLine(styledLine);
}
else
{
outputBuilder.AppendLine(line);
outputBuilder.AppendLine(WebUtility.HtmlEncode(line));
}
}

Expand Down
7 changes: 4 additions & 3 deletions src/Cake.Terraform/TerraformAliases.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Cake.Core;
using System.Collections.Generic;
using Cake.Core;
using Cake.Core.Annotations;

namespace Cake.Terraform
Expand Down Expand Up @@ -50,10 +51,10 @@ public static void TerraformEnvDelete(this ICakeContext context, TerraformEnvDel
}

[CakeMethodAlias]
public static void TerraformEnvList(this ICakeContext context, TerraformEnvListSettings settings)
public static List<string> TerraformEnvList(this ICakeContext context, TerraformEnvListSettings settings)
{
var runner = new TerraformEnvListRunner(context.FileSystem, context.Environment, context.ProcessRunner, context.Tools);
runner.Run(settings);
return runner.Run(settings);
}

[CakeMethodAlias]
Expand Down
5 changes: 1 addition & 4 deletions src/Cake.Terraform/TerraformEnvDeleteRunner.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
using System;
using System.Collections.Generic;
using Cake.Core;
using Cake.Core.IO;
using Cake.Core.Tooling;
using Cake.Terraform;

namespace Cake.Terraform
{
Expand All @@ -17,7 +14,7 @@ public void Run(TerraformEnvDeleteSettings settings)
{
var builder =
new ProcessArgumentBuilder()
.Append("env");
.Append("workspace");

builder = builder.Append("delete");

Expand Down
6 changes: 2 additions & 4 deletions src/Cake.Terraform/TerraformEnvListRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using Cake.Core;
using Cake.Core.IO;
using Cake.Core.Tooling;
using Cake.Terraform;

namespace Cake.Terraform
{
Expand All @@ -18,11 +17,9 @@ public List<string> Run(TerraformEnvListSettings settings)
{
var builder =
new ProcessArgumentBuilder()
.Append("env")
.Append("workspace")
.Append("list");

Run(settings, builder);

var processSettings = new ProcessSettings
{
RedirectStandardOutput = true
Expand All @@ -33,6 +30,7 @@ public List<string> Run(TerraformEnvListSettings settings)
{
result = x.GetStandardOutput()
.Select(env => env.Replace("*", "").Trim())
.Where(env => !string.IsNullOrWhiteSpace(env))
.ToList();
});

Expand Down
5 changes: 2 additions & 3 deletions src/Cake.Terraform/TerraformEnvNewRunner.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
using System;
using System.Collections.Generic;
using Cake.Core;
using Cake.Core.IO;
using Cake.Core.Tooling;
using Cake.Terraform;

namespace Cake.Terraform
{
Expand All @@ -13,6 +11,7 @@ public TerraformEnvNewRunner(IFileSystem fileSystem, ICakeEnvironment environmen
: base(fileSystem, environment, processRunner, tools)
{
}

public void Run(TerraformEnvNewSettings newSettings)
{
if (string.IsNullOrEmpty(newSettings.Environment))
Expand All @@ -22,7 +21,7 @@ public void Run(TerraformEnvNewSettings newSettings)

var builder =
new ProcessArgumentBuilder()
.Append("env")
.Append("workspace")
.Append("new")
.Append(newSettings.Environment);

Expand Down

0 comments on commit 461f730

Please sign in to comment.