Skip to content

Commit

Permalink
Merge branch 'release/v0.5.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
RLittlesII committed Oct 25, 2018
2 parents f3355c9 + aafd2cd commit 95fe251
Show file tree
Hide file tree
Showing 24 changed files with 243 additions and 101 deletions.
19 changes: 0 additions & 19 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Cake addin that extends Cake with support for fastlane tools.
| Build server | Platform | Dev | Master |
|-----------------------------|--------------|--------------|---------------------------------------------------------------------------------------------------------------------------|
| AppVeyor | Windows | [![Build status](https://ci.appveyor.com/api/projects/status/bvxpbhtyrhr88bfj/branch/dev?svg=true)](https://ci.appveyor.com/project/RLittlesII/cake-fastlane/branch/dev) | [![Build status](https://ci.appveyor.com/api/projects/status/bvxpbhtyrhr88bfj/branch/master?svg=true)](https://ci.appveyor.com/project/RLittlesII/cake-fastlane/branch/master) |
| TravisCI | OS X | [![Build Status](https://travis-ci.org/RLittlesII/Cake.Fastlane.svg?branch=dev)](https://travis-ci.org/RLittlesII/Cake.Fastlane) | [![Build Status](https://travis-ci.org/RLittlesII/Cake.Fastlane.svg?branch=master)](https://travis-ci.org/RLittlesII/Cake.Fastlane) |
| Azure Pipelines | OS X | [![Build Status](https://dev.azure.com/rlittlesii/Cake.Fastlane/_apis/build/status/Cake.Fastlane)](https://dev.azure.com/rlittlesii/Cake.Fastlane/_build/latest?definitionId=1) | |

## Information
| | Stable |
Expand Down
6 changes: 6 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pool:
vmImage: 'macOS-10.13'

steps:
- script: ./build.sh --target AzureDevOps --verbosity diagnostic
displayName: Cake.Recipe
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
TOOLS_DIR=$CAKE_PATHS_TOOLS
NUGET_EXE=$SCRIPT_DIR/nuget.exe
NUGET_URL=https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
CAKE_VERSION=0.26.0
CAKE_VERSION=0.29.0
CAKE_EXE=$TOOLS_DIR/Cake.$CAKE_VERSION/Cake.exe

# Define default arguments.
Expand Down
10 changes: 10 additions & 0 deletions recipe.cake
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,19 @@ BuildParameters.SetParameters(context: Context,
repositoryOwner: "RLittlesII",
repositoryName: "Cake.Fastlane",
appVeyorAccountName: "RLittlesII",
integrationTestScriptPath: "./tests/integration/test.cake",
shouldRunIntegrationTests: true,
shouldRunCodecov: false,
shouldRunDotNetCorePack: true);

Task("AzureDevOps")
.IsDependentOn("Publish-MyGet-Packages")
.IsDependentOn("Publish-Nuget-Packages")
.IsDependentOn("Publish-GitHub-Release")
.IsDependentOn("Publish-Documentation");

BuildParameters.Tasks.IntegrationTestTask.WithCriteria(() => BuildParameters.IsRunningOnUnix);

BuildParameters.PrintParameters(Context);

ToolSettings.SetToolSettings(context: Context,
Expand Down
16 changes: 16 additions & 0 deletions src/Cake.Fastlane.Tests/Deliver/FastlaneDeliverProviderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,22 @@ public void Should_Throw_If_Process_Was_Not_Started()
Assert.Equal("fastlane: Process was not started.", result?.Message);
}

[Fact]
public void Should_Throw_Bundle_Exec_Process_Was_Not_Started_()
{
// Given
var fixture = new FastlaneDeliverProviderFixture();
fixture.Settings.UseBundleExecution = true;
fixture.GivenProcessCannotStart();

// When
var result = Record.Exception(() => fixture.Run());

// Then
Assert.IsType<CakeException>(result);
Assert.Equal("bundle exec fastlane: Process was not started.", result?.Message);
}

[Fact]
public void Should_Throw_If_Settings_Is_Null()
{
Expand Down
20 changes: 14 additions & 6 deletions src/Cake.Fastlane.Tests/Supply/FastlaneSupplyTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

namespace Cake.Fastlane.Tests.Supply
{
#pragma warning disable CS0618 // Type or member is obsolete
public sealed class FastlaneSupplyTests
{
public sealed class TheSupplyMethod
Expand All @@ -14,8 +15,10 @@ public sealed class TheSupplyMethod
public void Should_Throw_If_Settings_Is_Null()
{
// Given
var fixture = new FastlaneSupplyFixture();
fixture.Settings = null;
var fixture = new FastlaneSupplyFixture
{
Settings = null
};

// When
var result = Record.Exception(() => fixture.Run());
Expand Down Expand Up @@ -116,8 +119,10 @@ public void Should_Throw_If_Process_Has_A_Non_Zero_Exit_Code()
public void Should_Throw_If_Configuration_Null()
{
// Given
var fixture = new FastlaneSupplyFixture();
fixture.Settings = null;
var fixture = new FastlaneSupplyFixture
{
Settings = null
};

// When
var result = Record.Exception(() => fixture.Run());
Expand All @@ -131,8 +136,10 @@ public void Should_Throw_If_Configuration_Null()
public void Should_Throw_If_Configuration_Null_OSX()
{
// Given
var fixture = new FastlaneSupplyFixture();
fixture.Settings = null;
var fixture = new FastlaneSupplyFixture
{
Settings = null
};

// When
var result = Record.Exception(() => fixture.Run());
Expand Down Expand Up @@ -464,4 +471,5 @@ public void Should_Add_Check_Superseded_Tracks_If_Provided()
}
}
}
#pragma warning restore CS0618 // Type or member is obsolete
}
20 changes: 20 additions & 0 deletions src/Cake.Fastlane.Tests/Tool/FastlaneToolFixture.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System;
using Cake.Testing.Fixtures;

namespace Cake.Fastlane.Tests
{
public class FastlaneToolFixture : ToolFixture<FastlaneConfiguration>
{
public FastlaneToolFixture()
: base("fastlane")
{
}

protected override void RunTool()
{
var runner = new FastlaneToolProvider(FileSystem, Environment, ProcessRunner, Tools);

runner.Update();
}
}
}
25 changes: 25 additions & 0 deletions src/Cake.Fastlane.Tests/Tool/FastlaneToolTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System.Collections.Generic;
using System.Text;
using Xunit;

namespace Cake.Fastlane.Tests
{
public sealed class FastlaneToolTests
{
public class TheUpdateMethod
{
[Fact]
public void Should_Add_Update_Fastlane()
{
// Given
var fixture = new FastlaneToolFixture();

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

// Then
Assert.Equal("update_fastlane", result.Args);
}
}
}
}
20 changes: 14 additions & 6 deletions src/Cake.Fastlane.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@ VisualStudioVersion = 15.0.27130.2020
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{5566CF64-2C66-4B3D-A098-678DA8510C03}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "solution", "solution", "{BBED9237-B10E-482D-BBB2-85954307B55A}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".solution", ".solution", "{BBED9237-B10E-482D-BBB2-85954307B55A}"
ProjectSection(SolutionItems) = preProject
..\build.ps1 = ..\build.ps1
..\build.sh = ..\build.sh
..\GitVersion.yml = ..\GitVersion.yml
..\tools\packages.config = ..\tools\packages.config
..\recipe.cake = ..\recipe.cake
..\.gitignore = ..\.gitignore
..\GitReleaseManager.yaml = ..\GitReleaseManager.yaml
..\GitVersion.yml = ..\GitVersion.yml
..\LICENSE = ..\LICENSE
..\README.md = ..\README.md
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{C1CDD8F5-93C9-4DFC-A812-CEA4251D7337}"
Expand All @@ -21,6 +20,15 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cake.Fastlane", "Cake.Fastl
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cake.Fastlane.Tests", "Cake.Fastlane.Tests\Cake.Fastlane.Tests.csproj", "{68AF191E-8CD7-475A-BC80-F8B73CB4B377}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".build", ".build", "{65F84FBD-7711-4837-8CD1-F55CFC995444}"
ProjectSection(SolutionItems) = preProject
..\.appveyor.yml = ..\.appveyor.yml
..\azure-pipelines.yml = ..\azure-pipelines.yml
..\build.ps1 = ..\build.ps1
..\build.sh = ..\build.sh
..\recipe.cake = ..\recipe.cake
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down
18 changes: 10 additions & 8 deletions src/Cake.Fastlane/Deliver/FastlaneDeliverProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,6 @@ internal class FastlaneDeliverProvider : FastlaneTool<FastlaneDeliverConfigurati
{
private readonly ICakeEnvironment _environment;

private readonly Func<Dictionary<string, string>, string> Aggregate = (dictionary) =>
{
return dictionary.Aggregate(string.Empty, (current, hash) => current + $"{hash.Key}:{hash.Value}")
.TrimEnd(',');
};

/// <summary>
/// Initializes a new instance of the <see cref="FastlaneDeliverProvider"/> class.
/// </summary>
Expand All @@ -31,7 +25,8 @@ internal class FastlaneDeliverProvider : FastlaneTool<FastlaneDeliverConfigurati
public FastlaneDeliverProvider(IFileSystem fileSystem,
ICakeEnvironment environment,
IProcessRunner processRunner,
IToolLocator tools) : base(fileSystem, environment, processRunner, tools)
IToolLocator tools)
: base(fileSystem, environment, processRunner, tools)
{
_environment = environment;
}
Expand All @@ -51,6 +46,8 @@ public void Deliver(FastlaneDeliverConfiguration configuration)
Run(configuration, ArgumentBuilder(configuration));
}

protected override string GetToolName() => ToolName;

/// <summary>
/// https://github.com/fastlane/fastlane/blob/master/deliver/lib/deliver/options.rb
/// </summary>
Expand All @@ -62,6 +59,11 @@ private ProcessArgumentBuilder ArgumentBuilder(FastlaneDeliverConfiguration conf

builder.Append("deliver");

if (configuration.UseBundleExecution)
{
ToolName = BundleExecution;
}

if (!string.IsNullOrWhiteSpace(configuration.AppIdentifier))
{
builder.AppendSwitch("-a", configuration.AppIdentifier);
Expand Down Expand Up @@ -288,7 +290,7 @@ private ProcessArgumentBuilder ArgumentBuilder(FastlaneDeliverConfiguration conf
builder.AppendSwitch("--marketing_url", configuration.MarketingUrl);
}

return builder;
return builder.RenderSafe();
}
}
}
6 changes: 4 additions & 2 deletions src/Cake.Fastlane/Deliver/IFastlaneDeliverProvider.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
namespace Cake.Fastlane
using Cake.Core.IO;

namespace Cake.Fastlane
{
/// <summary>
/// Interface that represents fastlane deliver.
/// </summary>
public interface IFastlaneDeliverProvider
internal interface IFastlaneDeliverProvider
{
/// <summary>
/// Executes fastlane deliver with the specified configuration.
Expand Down
3 changes: 3 additions & 0 deletions src/Cake.Fastlane/FastlaneAliases.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
using System;
using System.Runtime.CompilerServices;
using Cake.Core;
using Cake.Core.Annotations;

[assembly: InternalsVisibleTo("Cake.Fastlane.Tests")]

namespace Cake.Fastlane
{
/// <summary>
Expand Down
35 changes: 23 additions & 12 deletions src/Cake.Fastlane/FastlaneProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,18 @@ namespace Cake.Fastlane
public sealed class FastlaneProvider : IFastlaneProvider
{
private readonly ICakeContext _context;
private IFastlaneDeliverProvider _fastlaneDeliverProvider;
private IFastlaneMatchProvider _fastlaneMatchProvider;
private IFastlanePemProvider _fastlanePemProvider;
private IFastlaneDeliverProvider _fastlaneDeliverProvider;
private IFastlanePilotProvider _fastlanePilotProvider;
private IFastlaneSupplyProvider _fastlaneSupplyProvider;
private IFastlaneToolProvider _fastlaneToolProvider;

/// <summary>
/// Initializes a new instance of the <see cref="FastlaneProvider"/> class.
/// </summary>
/// <param name="context">The context.</param>
public FastlaneProvider(ICakeContext context)
{
if (context == null)
{
throw new ArgumentNullException(nameof(context));
}

_context = context;
}
public FastlaneProvider(ICakeContext context) => _context = context ?? throw new ArgumentNullException(nameof(context));

/// <inheritdoc />
/// <summary>
Expand Down Expand Up @@ -213,7 +206,6 @@ public void Pem(Action<FastlanePemConfiguration> configurator)
Pem(configuration);
}


/// <inheritdoc />
/// <summary>
/// Executes fastlane pilot with the specified configuration.
Expand Down Expand Up @@ -288,7 +280,7 @@ public void Pilot(Action<FastlanePilotConfiguration> configurator)
/// SkipUploadImages = true,
/// SkipUploadScreenShots = true
/// };
///
///
/// Fastlane.Supply(configuration);
/// </code>
/// </example>
Expand Down Expand Up @@ -335,5 +327,24 @@ public void Supply(Action<FastlaneSupplyConfiguration> configurator)

Supply(configuration);
}

/// <inheritdoc />
/// <example>
/// <code>
/// Fastlane.Update();
/// </code>
/// </example>
public void Update()
{
if (_fastlaneToolProvider == null)
{
_fastlaneToolProvider = new FastlaneToolProvider(_context.FileSystem,
_context.Environment,
_context.ProcessRunner,
_context.Tools);
}

_fastlaneToolProvider.Update();
}
}
}
Loading

0 comments on commit 95fe251

Please sign in to comment.