Skip to content

Commit

Permalink
Added Pilot Command
Browse files Browse the repository at this point in the history
  • Loading branch information
RLittlesII committed Sep 21, 2018
1 parent 5106d8a commit 54e5672
Show file tree
Hide file tree
Showing 4 changed files with 109 additions and 27 deletions.
72 changes: 47 additions & 25 deletions src/Cake.Fastlane.Tests/Pilot/FastlanePilotTests.cs
Expand Up @@ -151,7 +151,29 @@ public void Should_Add_Action_If_No_Configuration_Provided()
var result = fixture.Run();

// Then
Assert.Equal("pilot", result.Args);
Assert.Equal("pilot upload", result.Args);
}

[Theory]
[InlineData(PilotCommand.Upload)]
[InlineData(PilotCommand.Builds)]
[InlineData(PilotCommand.List)]
[InlineData(PilotCommand.Find)]
[InlineData(PilotCommand.Add)]
[InlineData(PilotCommand.Remove)]
[InlineData(PilotCommand.Import)]
[InlineData(PilotCommand.Export)]
public void Should_Add_Command_If_Provided(PilotCommand command)
{
// Given
var fixture = new FastlanePilotFixture();
fixture.Settings.Command = command;

// When
var result = fixture.Run();

// Then
Assert.Equal($"pilot {command.ToString().ToLower()}", result.Args);
}

[Fact]
Expand All @@ -165,7 +187,7 @@ public void Should_Add_User_Name_If_Provided()
var result = fixture.Run();

// Then
Assert.Equal($"pilot -u {fixture.Settings.UserName}", result.Args);
Assert.Equal($"pilot upload -u {fixture.Settings.UserName}", result.Args);
}

[Fact]
Expand All @@ -179,7 +201,7 @@ public void Should_Add_App_Identifier_If_Provided()
var result = fixture.Run();

// Then
Assert.Equal($"pilot -a {fixture.Settings.AppIdentifier}", result.Args);
Assert.Equal($"pilot upload -a {fixture.Settings.AppIdentifier}", result.Args);
}

[Fact]
Expand All @@ -193,7 +215,7 @@ public void Should_Add_App_Platform_If_Provided()
var result = fixture.Run();

// Then
Assert.Equal($"pilot -m {fixture.Settings.Platform}", result.Args);
Assert.Equal($"pilot upload -m {fixture.Settings.Platform}", result.Args);
}

[Fact]
Expand All @@ -207,7 +229,7 @@ public void Should_Add_Ipa_File_Path_If_Provided()
var result = fixture.Run();

// Then
Assert.Equal($"pilot -i \"/Working/cake.fastlane.ipa\"", result.Args);
Assert.Equal($"pilot upload -i \"/Working/cake.fastlane.ipa\"", result.Args);
}

[Fact]
Expand All @@ -221,7 +243,7 @@ public void Should_Add_Change_Log_Provided()
var result = fixture.Run();

// Then
Assert.Equal($"pilot -w {fixture.Settings.ChangeLog}", result.Args);
Assert.Equal($"pilot upload -w {fixture.Settings.ChangeLog}", result.Args);
}

[Fact]
Expand All @@ -235,7 +257,7 @@ public void Should_Add_Beta_App_Description_If_Provided()
var result = fixture.Run();

// Then
Assert.Equal($"pilot -d {fixture.Settings.BetaAppDescription}", result.Args);
Assert.Equal($"pilot upload -d {fixture.Settings.BetaAppDescription}", result.Args);
}

[Fact]
Expand All @@ -249,7 +271,7 @@ public void Should_Add_Beta_App_Feedback_Email_If_Provided()
var result = fixture.Run();

// Then
Assert.Equal($"pilot -n {fixture.Settings.BetaAppFeedbackEmail}", result.Args);
Assert.Equal($"pilot upload -n {fixture.Settings.BetaAppFeedbackEmail}", result.Args);
}

[Fact]
Expand All @@ -263,7 +285,7 @@ public void Should_Add_Skip_Submission_If_Provided()
var result = fixture.Run();

// Then
Assert.Equal($"pilot -s", result.Args);
Assert.Equal($"pilot upload -s", result.Args);
}

[Fact]
Expand All @@ -277,7 +299,7 @@ public void Should_Add_Skip_Waiting_If_Provided()
var result = fixture.Run();

// Then
Assert.Equal($"pilot -z", result.Args);
Assert.Equal($"pilot upload -z", result.Args);
}

[Fact]
Expand All @@ -291,7 +313,7 @@ public void Should_Add_Apple_Id_If_Provided()
var result = fixture.Run();

// Then
Assert.Equal($"pilot -p {fixture.Settings.AppleId}", result.Args);
Assert.Equal($"pilot upload -p {fixture.Settings.AppleId}", result.Args);
}

[Fact]
Expand All @@ -305,7 +327,7 @@ public void Should_Add_Distribute_If_Provided()
var result = fixture.Run();

// Then
Assert.Equal("pilot --distribute_external", result.Args);
Assert.Equal("pilot upload --distribute_external", result.Args);
}

[Fact]
Expand All @@ -319,7 +341,7 @@ public void Should_Add_Demo_Account_Required_If_Provided()
var result = fixture.Run();

// Then
Assert.Equal("pilot --demo_account_required", result.Args);
Assert.Equal("pilot upload --demo_account_required", result.Args);
}

[Fact]
Expand All @@ -333,7 +355,7 @@ public void Should_Add_First_Name_If_Provided()
var result = fixture.Run();

// Then
Assert.Equal($"pilot -f {fixture.Settings.FirstName}", result.Args);
Assert.Equal($"pilot upload -f {fixture.Settings.FirstName}", result.Args);
}

[Fact]
Expand All @@ -347,7 +369,7 @@ public void Should_Add_Last_Name_If_Provided()
var result = fixture.Run();

// Then
Assert.Equal($"pilot -l {fixture.Settings.LastName}", result.Args);
Assert.Equal($"pilot upload -l {fixture.Settings.LastName}", result.Args);
}

[Fact]
Expand All @@ -361,7 +383,7 @@ public void Should_Add_Email_If_Provided()
var result = fixture.Run();

// Then
Assert.Equal($"pilot -e {fixture.Settings.Email}", result.Args);
Assert.Equal($"pilot upload -e {fixture.Settings.Email}", result.Args);
}

[Fact]
Expand All @@ -375,7 +397,7 @@ public void Should_Add_Tester_File_Path_If_Provided()
var result = fixture.Run();

// Then
Assert.Equal($"pilot -c \"/Working/testers.csv\"", result.Args);
Assert.Equal($"pilot upload -c \"/Working/testers.csv\"", result.Args);
}

[Fact]
Expand All @@ -389,7 +411,7 @@ public void Should_Add_Wait_Processing_Interval_If_Provided()
var result = fixture.Run();

// Then
Assert.Equal($"pilot -k {fixture.Settings.WaitProcessingInterval}", result.Args);
Assert.Equal($"pilot upload -k {fixture.Settings.WaitProcessingInterval}", result.Args);
}

[Fact]
Expand All @@ -403,7 +425,7 @@ public void Should_Add_Team_Id_If_Provided()
var result = fixture.Run();

// Then
Assert.Equal($"pilot -q {fixture.Settings.TeamId}", result.Args);
Assert.Equal($"pilot upload -q {fixture.Settings.TeamId}", result.Args);
}

[Fact]
Expand All @@ -417,7 +439,7 @@ public void Should_Add_Team_Name_If_Provided()
var result = fixture.Run();

// Then
Assert.Equal($"pilot -r {fixture.Settings.TeamName}", result.Args);
Assert.Equal($"pilot upload -r {fixture.Settings.TeamName}", result.Args);
}

[Fact]
Expand All @@ -431,7 +453,7 @@ public void Should_Add_Portal_Team_Name_If_Provided()
var result = fixture.Run();

// Then
Assert.Equal($"pilot --dev_portal_team_id {fixture.Settings.PortalTeamId}", result.Args);
Assert.Equal($"pilot upload --dev_portal_team_id {fixture.Settings.PortalTeamId}", result.Args);
}

[Fact]
Expand All @@ -445,7 +467,7 @@ public void Should_Add_Itc_Provider_If_Provided()
var result = fixture.Run();

// Then
Assert.Equal($"pilot --itc_provider {fixture.Settings.ItcProvider}", result.Args);
Assert.Equal($"pilot upload --itc_provider {fixture.Settings.ItcProvider}", result.Args);
}

[Fact]
Expand All @@ -459,7 +481,7 @@ public void Should_Add_Groups_If_Provided()
var result = fixture.Run();

// Then
Assert.Equal($"pilot -g \"Team Wilson\",\"Brady Bunch\"", result.Args);
Assert.Equal($"pilot upload -g \"Team Wilson\",\"Brady Bunch\"", result.Args);
}

[Fact]
Expand All @@ -473,7 +495,7 @@ public void Should_Add_Wait_For_Build_If_Provided()
var result = fixture.Run();

// Then
Assert.Equal("pilot --wait_for_uploaded_build", result.Args);
Assert.Equal("pilot upload --wait_for_uploaded_build", result.Args);
}

[Fact]
Expand All @@ -487,7 +509,7 @@ public void Should_Add_Reject_Build_Waiting_For_Review_If_Provided()
var result = fixture.Run();

// Then
Assert.Equal("pilot --reject_build_waiting_for_review", result.Args);
Assert.Equal("pilot upload --reject_build_waiting_for_review", result.Args);
}
}
}
Expand Down
10 changes: 9 additions & 1 deletion src/Cake.Fastlane/Pilot/FastlanePilotConfiguration.cs
Expand Up @@ -20,6 +20,14 @@ public FastlanePilotConfiguration()
Groups = Enumerable.Empty<string>();
}

/// <summary>
/// Gets or sets the command to run with pilot.
/// </summary>
/// <value>
/// The command.
/// </value>
public PilotCommand Command { get; set; }

/// <summary>
/// Gets or sets the path to the ipa file to upload.
/// </summary>
Expand Down Expand Up @@ -62,7 +70,7 @@ public FastlanePilotConfiguration()
public bool Distribute { get; set; }

/// <summary>
/// Gets or sets a value indicating whether to notify testers.
/// Gets or sets a value indicating whether to notify external testers.
/// </summary>
public bool Notify { get; set; }

Expand Down
5 changes: 4 additions & 1 deletion src/Cake.Fastlane/Pilot/FastlanePilotProvider.cs
@@ -1,4 +1,5 @@
using System;
using System.Globalization;
using System.Linq;
using Cake.Core;
using Cake.Core.IO;
Expand Down Expand Up @@ -49,6 +50,8 @@ private ProcessArgumentBuilder ArgumentBuilder(FastlanePilotConfiguration config

builder.Append("pilot");

builder.Append(configuration.Command.ToString().ToLower());

if (!string.IsNullOrEmpty(configuration.UserName))
{
builder.AppendSwitch("-u", configuration.UserName);
Expand Down Expand Up @@ -106,7 +109,7 @@ private ProcessArgumentBuilder ArgumentBuilder(FastlanePilotConfiguration config

if (configuration.Notify)
{
//TODO: Determine how to shut this thing off
// TODO: This is true by default. Not sure if providing the switch turns it off.
}

if (configuration.DemoAccountRequired)
Expand Down
49 changes: 49 additions & 0 deletions src/Cake.Fastlane/Pilot/PilotCommand.cs
@@ -0,0 +1,49 @@
namespace Cake.Fastlane
{
/// <summary>
/// Commands for the pilot tool.
/// </summary>
public enum PilotCommand
{

/// <summary>
/// Uploads a build.
/// </summary>
Upload,

/// <summary>
/// Lists all the builds.
/// </summary>
Builds,

/// <summary>
/// Lists all the testers.
/// </summary>
List,

/// <summary>
/// Adds a new tester.
/// </summary>
Add,

/// <summary>
/// Finds a tester.
/// </summary>
Find,

/// <summary>
/// Remove external beta testers.
/// </summary>
Remove,

/// <summary>
/// Export all external testers to csv.
/// </summary>
Export,

/// <summary>
/// Add external testers from csv.
/// </summary>
Import
}
}

0 comments on commit 54e5672

Please sign in to comment.