Skip to content

Commit

Permalink
Add missing WithVersion method to scriptcs host
Browse files Browse the repository at this point in the history
  • Loading branch information
agc93 committed Aug 25, 2016
1 parent faeedcd commit ee3e0f2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/ScriptCs.ClickTwice/ClickTwicePack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ namespace ScriptCs.ClickTwice
{
public class ClickTwicePack : IScriptPackContext
{
public Publisher PublishApp(string projectFilePath, Action<ClickTwicePackSettings> configure = null) {
public Publisher PublishApp(string projectFilePath, Action<ClickTwicePackSettings> configure = null)
{
configure?.Invoke(Settings);
var host = new ConsoleScriptHost();
BasePublishManager mgr;
Expand All @@ -32,6 +32,10 @@ public Publisher PublishApp(string projectFilePath, Action<ClickTwicePackSetting
mgr.Loggers = Settings.Loggers;
mgr.Loggers.RemoveAll(l => l.GetType() == typeof(ConsoleLogger));
mgr.Loggers.Add(new ConsoleLogger(Settings.LogBuildMessages));
if (!string.IsNullOrWhiteSpace(Settings.PublishVersion))
{
mgr.AdditionalProperties.Add("ApplicationVersion", Settings.PublishVersion);
}
return new Publisher(mgr) {Host = host};
}

Expand Down Expand Up @@ -63,4 +67,4 @@ private System.Reflection.Assembly CurrentDomain_AssemblyResolve(object sender,
return assemblyName == null ? Assembly.Load(args.Name) : Assembly.Load(assemblyName);
}
}
}
}
8 changes: 8 additions & 0 deletions src/ScriptCs.ClickTwice/ClickTwicePackSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ public ClickTwicePackSettings UseAppManifestMetadata(bool useMetadata = true)
return this;
}

public ClickTwicePackSettings WithVersion(string version)
{
PublishVersion = version;
return this;
}

internal bool LogBuildMessages { get; set; }

internal bool OutputClean { get; set; } = true;
Expand All @@ -89,6 +95,8 @@ public ClickTwicePackSettings UseAppManifestMetadata(bool useMetadata = true)

internal bool UseAppManifest { get; set; } = true;

internal string PublishVersion { get; set; } = string.Empty;

internal List<IPublishLogger> Loggers { get; set; } = new List<IPublishLogger>();

internal List<IOutputHandler> OutputHandlers { get; set; } = new List<IOutputHandler>();
Expand Down

0 comments on commit ee3e0f2

Please sign in to comment.