Skip to content

Commit

Permalink
Merge branch 'hotfix/0.4.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
gep13 committed Sep 12, 2016
2 parents afc9305 + e660f49 commit 8d83a4e
Show file tree
Hide file tree
Showing 7 changed files with 75 additions and 97 deletions.
17 changes: 2 additions & 15 deletions Source/Cake.Tfx.Tests/Fixtures/TfxExtensionPublishRunnerFixture.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Collections.Generic;
using Cake.Core.IO;
using Cake.Core.IO;
using Cake.Tfx.Extension.Publish;

namespace Cake.Tfx.Tests.Fixtures
Expand All @@ -8,27 +7,15 @@ internal sealed class TfxExtensionPublishRunnerFixture : TfxFixture<TfxExtension
{
public FilePath VsixFilePath { get; set; }

public ICollection<string> ShareWith { get; set; }

public TfxExtensionPublishRunnerFixture()
{
VsixFilePath = "c:/temp/test.vsix";
}

public void GivenSingleAccount()
{
ShareWith = new List<string> { "account1" };
}

public void GivenMultipleAccounts()
{
ShareWith = new List<string> { "account1", "account2" };
}

protected override void RunTool()
{
var tool = new TfxExtensionPublishRunner(FileSystem, Environment, ProcessRunner, Tools);
tool.Publish(VsixFilePath, ShareWith, Settings);
tool.Publish(VsixFilePath, Settings);
}
}
}
108 changes: 53 additions & 55 deletions Source/Cake.Tfx.Tests/TfxExtensionPublishRunnerTests.cs

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Collections.Generic;
using Cake.Core;
using Cake.Core;
using Cake.Core.IO;

namespace Cake.Tfx.Extension.Publish
Expand All @@ -12,20 +11,17 @@ internal sealed class TfxExtensionPublishArgumentBuilder : ITfxArgumentBuilder
private readonly ICakeEnvironment _environment;
private readonly TfxExtensionPublishSettings _settings;
private readonly FilePath _vsixFilePath;
private readonly ICollection<string> _shareWith;

/// <summary>
/// Initializes a new instance of the <see cref="TfxExtensionPublishArgumentBuilder"/> class.
/// </summary>
/// <param name="environment">The environment.</param>
/// <param name="vsixFilePath">The path to the VSIX.</param>
/// <param name="shareWith">The accounts to publish the extension to.</param>
/// <param name="settings">The settings.</param>
public TfxExtensionPublishArgumentBuilder(ICakeEnvironment environment, FilePath vsixFilePath, ICollection<string> shareWith, TfxExtensionPublishSettings settings)
public TfxExtensionPublishArgumentBuilder(ICakeEnvironment environment, FilePath vsixFilePath, TfxExtensionPublishSettings settings)
{
_environment = environment;
_vsixFilePath = vsixFilePath;
_shareWith = shareWith;
_settings = settings;
}

Expand Down Expand Up @@ -56,11 +52,11 @@ public ProcessArgumentBuilder GetArguments()
builder.AppendQuoted(_vsixFilePath.MakeAbsolute(_environment).FullPath);
}

if (_shareWith != null && _shareWith.Count != 0)
if (_settings.ShareWith != null && _settings.ShareWith.Count != 0)
{
builder.Append("--share-with");

foreach (var account in _shareWith)
foreach (var account in _settings.ShareWith)
{
builder.AppendQuoted(account);
}
Expand Down
11 changes: 2 additions & 9 deletions Source/Cake.Tfx/Extension/Publish/TfxExtensionPublishRunner.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using Cake.Core;
using Cake.Core.IO;
using Cake.Core.Tooling;
Expand Down Expand Up @@ -34,26 +33,20 @@ public sealed class TfxExtensionPublishRunner : TfxTool<TfxExtensionPublishSetti
/// Installs an extension using the specified publishSettings.
/// </summary>
/// <param name="vsixFilePath">The path to the VSIX.</param>
/// <param name="publishShareWith">The accounts to publish the extension to.</param>
/// <param name="publishSettings">The publishSettings.</param>
public void Publish(FilePath vsixFilePath, ICollection<string> publishShareWith, TfxExtensionPublishSettings publishSettings)
public void Publish(FilePath vsixFilePath, TfxExtensionPublishSettings publishSettings)
{
if (vsixFilePath == null)
{
throw new ArgumentNullException(nameof(vsixFilePath));
}

if (publishShareWith == null || publishShareWith.Count == 0)
{
throw new ArgumentNullException(nameof(publishShareWith));
}

if (publishSettings == null)
{
throw new ArgumentNullException(nameof(publishSettings));
}

RunTfx(publishSettings, new TfxExtensionPublishArgumentBuilder(_environment, vsixFilePath, publishShareWith, publishSettings));
RunTfx(publishSettings, new TfxExtensionPublishArgumentBuilder(_environment, vsixFilePath, publishSettings));
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ namespace Cake.Tfx.Extension.Publish
/// </summary>
public sealed class TfxExtensionPublishSettings : TfxServerSettings, ICreatePublishSettings
{
/// <summary>
/// Gets or sets List of VSTS Accounts with which to share the extension.
/// </summary>
public ICollection<string> ShareWith { get; set; }

/// <summary>
/// Gets or sets the Root directory to be used when creating extension.
/// </summary>
Expand Down
12 changes: 6 additions & 6 deletions Source/Cake.Tfx/Namespaces.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace Cake.Tfx
{
/// <summary>
/// This namespace contains Gitter aliases.
/// This namespace contains Tfx aliases.
/// </summary>
[CompilerGenerated]
internal class NamespaceDoc
Expand All @@ -17,7 +17,7 @@ internal class NamespaceDoc
namespace Cake.Tfx.Extension
{
/// <summary>
/// This namespace contains Gitter aliases.
/// This namespace contains members related to Tfx Extension.
/// </summary>
[CompilerGenerated]
internal class NamespaceDoc
Expand All @@ -29,7 +29,7 @@ internal class NamespaceDoc
namespace Cake.Tfx.Extension.Create
{
/// <summary>
/// This namespace contains Gitter aliases.
/// This namespace contains members related to the Tfx Extension Create method.
/// </summary>
[CompilerGenerated]
internal class NamespaceDoc
Expand All @@ -41,7 +41,7 @@ internal class NamespaceDoc
namespace Cake.Tfx.Extension.Install
{
/// <summary>
/// This namespace contains Gitter aliases.
/// This namespace contains members related to the Tfx Extension Install method.
/// </summary>
[CompilerGenerated]
internal class NamespaceDoc
Expand All @@ -53,7 +53,7 @@ internal class NamespaceDoc
namespace Cake.Tfx.Extension.Publish
{
/// <summary>
/// This namespace contains Gitter aliases.
/// This namespace contains members related to the Tfx Extension Publish method.
/// </summary>
[CompilerGenerated]
internal class NamespaceDoc
Expand All @@ -65,7 +65,7 @@ internal class NamespaceDoc
namespace Cake.Tfx.Extension.Share
{
/// <summary>
/// This namespace contains Gitter aliases.
/// This namespace contains members related to the Tfx Extension Share method.
/// </summary>
[CompilerGenerated]
internal class NamespaceDoc
Expand Down
7 changes: 3 additions & 4 deletions Source/Cake.Tfx/TfxAliases.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,22 +96,21 @@ public static void TfxExtensionPublish(this ICakeContext context, TfxExtensionPu
/// </summary>
/// <param name="context">The context.</param>
/// <param name="vsixFilePath">The path to the vsix.</param>
/// <param name="shareWith">The accounts to publish the extension to.</param>
/// <param name="settings">The settings.</param>
/// <example>
/// <code>
/// TfxExtensionPublish("c:/temp/test.vsix", new List&lt;string&gt;{ "account1" }, new TfxExtensionPublishSettings()
/// TfxExtensionPublish("c:/temp/test.vsix", new TfxExtensionPublishSettings()
/// {
/// AuthType = TfxAuthType.Pat,
/// Token = "abcdef"
/// });
/// </code>
/// </example>
[CakeMethodAlias]
public static void TfxExtensionPublish(this ICakeContext context, FilePath vsixFilePath, ICollection<string> shareWith, TfxExtensionPublishSettings settings)
public static void TfxExtensionPublish(this ICakeContext context, FilePath vsixFilePath, TfxExtensionPublishSettings settings)
{
var runner = new TfxExtensionPublishRunner(context.FileSystem, context.Environment, context.ProcessRunner, context.Tools);
runner.Publish(vsixFilePath, shareWith, settings);
runner.Publish(vsixFilePath, settings);
}

/// <summary>
Expand Down

0 comments on commit 8d83a4e

Please sign in to comment.