Skip to content

Commit

Permalink
include the cake.wyam2 source to fix the docs tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
arturcic committed Dec 23, 2022
1 parent fc5b3ff commit 8327840
Show file tree
Hide file tree
Showing 12 changed files with 608 additions and 12 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/docs.yml
Expand Up @@ -2,10 +2,11 @@ name: Verify & Publish Docs

on:
workflow_dispatch:
repository_dispatch:
types: [release]
push:
branches:
# - main
- 'support/*'
- main
paths:
- docs/**
- package*.json
Expand All @@ -15,8 +16,7 @@ on:
- .github/workflows/docs.yml
pull_request:
branches:
# - main
- 'support/*'
- main
paths:
- docs/**
- package*.json
Expand Down
3 changes: 1 addition & 2 deletions build/Directory.Packages.props
Expand Up @@ -12,7 +12,6 @@
<PackageVersion Include="Cake.Docker" Version="1.1.2" />
<PackageVersion Include="Cake.Git" Version="2.0.0" />
<PackageVersion Include="Cake.Json" Version="7.0.1" />
<PackageVersion Include="Cake.Wyam2" Version="3.0.0" />
<PackageVersion Include="xunit.assert" Version="2.4.2" />
</ItemGroup>
</Project>
</Project>
38 changes: 38 additions & 0 deletions build/common/Addins/Cake.Wyam/NuGetSettings.cs
@@ -0,0 +1,38 @@
#nullable disable
namespace Common.Addins.Cake.Wyam;

/// <summary>
/// Settings for specifying NuGet packages.
/// </summary>
public class NuGetSettings
{
/// <summary>
/// Specifies that prerelease packages are allowed.
/// </summary>
public bool Prerelease { get; set; }

/// <summary>
/// Specifies that unlisted packages are allowed.
/// </summary>
public bool Unlisted { get; set; }

/// <summary>
/// Indicates that only the specified package source(s) should be used to find the package.
/// </summary>
public bool Exclusive { get; set; }

/// <summary>
/// Specifies the version of the package to use.
/// </summary>
public string Version { get; set; }

/// <summary>
/// Specifies the package source(s) to get the package from.
/// </summary>
public IEnumerable<string> Source { get; set; }

/// <summary>
/// The package to install.
/// </summary>
public string Package { get; set; }
}
64 changes: 64 additions & 0 deletions build/common/Addins/Cake.Wyam/WyamAliases.cs
@@ -0,0 +1,64 @@
#nullable disable
namespace Common.Addins.Cake.Wyam;

/// <summary>
/// <para>Contains functionality related to <see href="https://github.com/Wyam2/wyam">Wyam2</see>.</para>
/// <para>
/// In order to use the commands for this alias, include the following in your build.cake file to download and install from NuGet.org, or specify the ToolPath within the WyamSettings class:
/// <code>
/// #addin "nuget:?package=Cake.Wyam2"
/// #tool "nuget:?package=Wyam2"
/// </code>
/// </para>
/// </summary>
/// <remarks>
/// Make sure to remove existing references to old Cake.Wyam addin (https://www.nuget.org/packages/Wyam/).
/// </remarks>
[CakeAliasCategory("Wyam2")]
public static class WyamAliases
{
/// <summary>
/// Runs Wyam2 using the specified settings.
/// </summary>
/// <param name="context">The context.</param>
/// <example>
/// <code>
/// Wyam();
/// </code>
/// </example>
[CakeMethodAlias]
public static void Wyam(this ICakeContext context)
{
if (context == null)
{
throw new ArgumentNullException(nameof(context));
}

Wyam(context, new WyamSettings());
}

/// <summary>
/// Runs Wyam2 using the specified settings.
/// </summary>
/// <param name="context">The context.</param>
/// <param name="settings">The settings.</param>
/// <example>
/// <code>
/// Wyam(new WyamSettings()
/// {
/// OutputPath = Directory("C:/Output")
/// });
/// </code>
/// </example>
[CakeMethodAlias]
public static void Wyam(this ICakeContext context, WyamSettings settings)
{
if (context == null)
{
throw new ArgumentNullException(nameof(context));
}

WyamRunner runner = new WyamRunner(context.FileSystem, context.Environment, context.ProcessRunner, context.Tools);
runner.Run(settings);
}
}

0 comments on commit 8327840

Please sign in to comment.