diff --git a/.build/statiq-docs.cake b/.build/statiq-docs.cake new file mode 100644 index 00000000..b2268b16 --- /dev/null +++ b/.build/statiq-docs.cake @@ -0,0 +1,175 @@ +/////////////////////////////////////////////////////////////////////////////// +// DISABLE WYAM +/////////////////////////////////////////////////////////////////////////////// + +BuildParameters.Tasks.PreviewDocumentationTask.WithCriteria(() => false, "Favor Statiq over Wyam"); +BuildParameters.Tasks.PublishDocumentationTask.WithCriteria(() => false, "Favor Statiq over Wyam"); +BuildParameters.Tasks.ForcePublishDocumentationTask.WithCriteria(() => false, "Favor Statiq over Wyam"); + +/////////////////////////////////////////////////////////////////////////////// +// TASK DEFINITIONS +/////////////////////////////////////////////////////////////////////////////// + +// No Clean task, we re-use the one provided in Wyam.cake + +BuildParameters.Tasks.PublishDocumentationTask = Task("Publish-StatiqDocs") + .IsDependentOn("Clean-Documentation") + .WithCriteria(() => BuildParameters.ShouldGenerateDocumentation, "Statiq documentation has been disabled") + .WithCriteria(() => DirectoryExists(BuildParameters.WyamRootDirectoryPath), "Statiq documentation directory is missing") + .Does(() => { + // ensure submodules are in place + var gitTool = Context.Tools.Resolve("git"); + if (gitTool == null) + { + gitTool = Context.Tools.Resolve("git.exe"); + } + if (gitTool == null) + { + throw new FileNotFoundException("git/git.exe could not be found!"); + } + + var exitCode = Context.StartProcess( + gitTool, + new ProcessSettings { + Arguments = "submodule update --init --recursive", + } + ); + + // Check to see if any documentation has changed + var sourceCommit = GitLogTip("./"); + Information("Source Commit Sha: {0}", sourceCommit.Sha); + var filesChanged = GitDiff("./", sourceCommit.Sha); + Information("Number of changed files: {0}", filesChanged.Count); + var docFileChanged = false; + + var wyamDocsFolderDirectoryName = BuildParameters.WyamRootDirectoryPath.GetDirectoryName(); + + var pathsToTestAgainst = new List() { + string.Format("{0}{1}", wyamDocsFolderDirectoryName, "/input/") + }; + + if (BuildParameters.ShouldDocumentSourceFiles) + { + // BuildParameters.WyamSourceFiles can not be used - the wyam globs are different from globs in GetFiles(). + pathsToTestAgainst.Add(string.Format("{0}{1}", BuildParameters.SourceDirectoryPath.FullPath, '/')); + } + + Verbose("Comparing all file-changes to the following paths:"); + foreach(var p in pathsToTestAgainst) + { + Verbose(" - "+p); + } + + foreach (var file in filesChanged) + { + Verbose("Changed File OldPath: {0}, Path: {1}", file.OldPath, file.Path); + if (pathsToTestAgainst.Any(x => file.OldPath.Contains(x) || file.Path.Contains(x))) + { + docFileChanged = true; + break; + } + } + + if (docFileChanged) + { + Information("Detected that documentation files have changed, so running Statiq..."); + + Statiq(); + PublishStatiqDocs(); + } + else + { + Information("No documentation has changed, so no need to generate documentation"); + } + } +) +.OnError(exception => +{ + Error(exception.Message); + Information("Publish-StatiqDocs Task failed, but continuing with next Task..."); + publishingError = true; +}); + +BuildParameters.Tasks.PreviewDocumentationTask = Task("Preview-StatiqDocs") + .WithCriteria(() => DirectoryExists(BuildParameters.WyamRootDirectoryPath), "Statiq documentation directory is missing") + .Does(() => { + Statiq("preview"); + }); + + +BuildParameters.Tasks.ForcePublishDocumentationTask = Task("Force-Publish-StatiqDocs") + .IsDependentOn("Clean-Documentation") + .WithCriteria(() => DirectoryExists(BuildParameters.WyamRootDirectoryPath), "Statiq documentation directory is missing") + .Does(() => { + Statiq(); + PublishStatiqDocs(); + } +); + +public void PublishStatiqDocs() +{ + var canPublishToGitHub = + !string.IsNullOrEmpty(BuildParameters.Wyam.AccessToken) && + !string.IsNullOrEmpty(BuildParameters.Wyam.DeployBranch) && + !string.IsNullOrEmpty(BuildParameters.RepositoryOwner) && + !string.IsNullOrEmpty(BuildParameters.RepositoryName); + + if (!canPublishToGitHub) + { + Warning("Unable to publish documentation, as not all Statiq configuration is present"); + return; + } + + Statiq("deploy"); +} + +// TODO: Do we need Cake.Statiq ? +public void Statiq(string command = "", IDictionary additionalSetting = null) +{ + var statiqProj = BuildParameters.WyamRootDirectoryPath.CombineWithFilePath("Docs.csproj").FullPath; // TODO: Configurable! + var settings = new Dictionary + { + { "Host", BuildParameters.WebHost }, + { "LinkRoot", BuildParameters.WebLinkRoot }, + { "BaseEditUrl", BuildParameters.WebBaseEditUrl }, + { "Title", BuildParameters.Title }, + { "IncludeGlobalNamespace", "false" }, + { "STATIQ_DEPLOY_OWNER", BuildParameters.RepositoryOwner }, + { "STATIQ_DEPLOY_REPO_NAME", BuildParameters.RepositoryName } + }; + + if (BuildParameters.ShouldDocumentSourceFiles) + { + settings.Add("SourceFiles", BuildParameters.WyamSourceFiles); + } + + if(additionalSetting != null) + { + settings = new[]{settings, additionalSetting}.SelectMany(x => x).ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + } + + if((command.EqualsIgnoreCase("preview") || command.EqualsIgnoreCase("serve")) && !string.IsNullOrEmpty(BuildParameters.WebLinkRoot)) + { + command += $" --virtual-dir={BuildParameters.WebLinkRoot}"; + } + + // TODO: Read log-level from Env/commandline? + + DotNetCoreRun(statiqProj, new DotNetCoreRunSettings + { + EnvironmentVariables = settings, + ArgumentCustomization = args=>args + .Append(" -- ") + .Append(command) + .Append($"--root=\"{BuildParameters.WyamRootDirectoryPath}\""), + }); +} + + +/////////////////////////////////////////////////////////////////////////////// +// BAKE STATIQ IN Cake.Recipe +/////////////////////////////////////////////////////////////////////////////// + +BuildParameters.Tasks.PreviewTask.IsDependentOn("Preview-StatiqDocs"); +BuildParameters.Tasks.PublishDocsTask.IsDependentOn("Force-Publish-StatiqDocs"); +BuildParameters.Tasks.ContinuousIntegrationTask.IsDependentOn("Publish-StatiqDocs"); diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 807a940c..3adb5751 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -41,6 +41,7 @@ jobs: WYAM_ACCESS_TOKEN: ${{ secrets.WYAM_ACCESS_TOKEN }} WYAM_DEPLOY_BRANCH: "gh-pages" WYAM_DEPLOY_REMOTE: ${{ github.event.repository.html_url }} + STATIQ_DEPLOY_OWNER: "cake-contrib" steps: - name: Checkout the repository diff --git a/.github/workflows/publishDocs.yml b/.github/workflows/publishDocs.yml index 8a2a5e8d..51dead8e 100644 --- a/.github/workflows/publishDocs.yml +++ b/.github/workflows/publishDocs.yml @@ -4,10 +4,10 @@ on: workflow_dispatch: env: - WYAM_ACCESS_TOKEN: ${{ secrets.API_TOKEN }} - # secrets.GITHUB_TOKEN has no permissions to push, sadly. - WYAM_DEPLOY_BRANCH: 'gh-pages' - WYAM_DEPLOY_REMOTE: "${{ github.event.repository.html_url }}" + STATIQ_DEPLOY_OWNER: "cake-contrib" + WYAM_ACCESS_TOKEN: ${{ secrets.WYAM_ACCESS_TOKEN }} + WYAM_DEPLOY_BRANCH: "gh-pages" + WYAM_DEPLOY_REMOTE: ${{ github.event.repository.html_url }} jobs: cake: @@ -20,16 +20,19 @@ jobs: - name: Fetch all tags and branches run: git fetch --prune --unshallow + - uses: actions/setup-dotnet@v3.0.3 + with: + dotnet-version: 7.0.x + - name: Cache Tools uses: actions/cache@v3 with: path: tools key: ${{ runner.os }}-doc-tools-${{ hashFiles('recipe.cake') }} - - name: Publishing documentaiton + - name: Publishing documentation uses: cake-build/cake-action@v1 with: script-path: recipe.cake - target: Force-Publish-Documentation - verbosity: Diagnostic + target: PublishDocs cake-version: tool-manifest diff --git a/.gitignore b/.gitignore index 7e15bb8b..ccd4fe7e 100644 --- a/.gitignore +++ b/.gitignore @@ -52,3 +52,5 @@ docs/input/tasks/* # Wyam related config.wyam.* .idea/ +docs/cache/ +docs/output/ diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..e079fc86 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,4 @@ +[submodule "docs/theme"] + path = docs/theme + url = https://github.com/statiqdev/Docable.git + branch = main diff --git a/docs/Docs.csproj b/docs/Docs.csproj new file mode 100644 index 00000000..dd3757cd --- /dev/null +++ b/docs/Docs.csproj @@ -0,0 +1,15 @@ + + + + Exe + net7.0 + enable + enable + latest + + + + + + + diff --git a/docs/Program.cs b/docs/Program.cs new file mode 100644 index 00000000..4dd7b806 --- /dev/null +++ b/docs/Program.cs @@ -0,0 +1,10 @@ +await Bootstrapper + .Factory + .CreateDocs(args) + .DeployToGitHubPagesBranch( + Config.FromSetting("STATIQ_DEPLOY_OWNER"), + Config.FromSetting("WYAM_DEPLOY_REMOTE"), + Config.FromSetting("WYAM_ACCESS_TOKEN"), + Config.FromSetting("WYAM_DEPLOY_BRANCH") + ) + .RunAsync(); diff --git a/docs/input/_Bottom.cshtml b/docs/input/_Bottom.cshtml deleted file mode 100644 index a5d9f142..00000000 --- a/docs/input/_Bottom.cshtml +++ /dev/null @@ -1,8 +0,0 @@ - - - GitHub - - - - Discussion - diff --git a/docs/input/assets/favicons/README.md b/docs/input/assets/favicons/README.md new file mode 100644 index 00000000..dbca9cd8 --- /dev/null +++ b/docs/input/assets/favicons/README.md @@ -0,0 +1,4 @@ +# FAVICON package + +This was all generated by using https://realfavicongenerator.net/ with +https://github.com/cake-contrib/graphics/blob/3344c5e09d33dedb984edf8a362d8a3d32f7acd4/png/addin/cake-contrib-addin-large.png as the source. diff --git a/docs/input/assets/favicons/android-chrome-192x192.png b/docs/input/assets/favicons/android-chrome-192x192.png new file mode 100644 index 00000000..402d066d Binary files /dev/null and b/docs/input/assets/favicons/android-chrome-192x192.png differ diff --git a/docs/input/assets/favicons/android-chrome-512x512.png b/docs/input/assets/favicons/android-chrome-512x512.png new file mode 100644 index 00000000..c3463dd1 Binary files /dev/null and b/docs/input/assets/favicons/android-chrome-512x512.png differ diff --git a/docs/input/assets/favicons/apple-touch-icon.png b/docs/input/assets/favicons/apple-touch-icon.png new file mode 100644 index 00000000..46f68842 Binary files /dev/null and b/docs/input/assets/favicons/apple-touch-icon.png differ diff --git a/docs/input/assets/favicons/browserconfig.xml b/docs/input/assets/favicons/browserconfig.xml new file mode 100644 index 00000000..b3930d0f --- /dev/null +++ b/docs/input/assets/favicons/browserconfig.xml @@ -0,0 +1,9 @@ + + + + + + #da532c + + + diff --git a/docs/input/assets/favicons/favicon-16x16.png b/docs/input/assets/favicons/favicon-16x16.png new file mode 100644 index 00000000..f855802f Binary files /dev/null and b/docs/input/assets/favicons/favicon-16x16.png differ diff --git a/docs/input/assets/favicons/favicon-32x32.png b/docs/input/assets/favicons/favicon-32x32.png new file mode 100644 index 00000000..78e91bcd Binary files /dev/null and b/docs/input/assets/favicons/favicon-32x32.png differ diff --git a/docs/input/assets/favicons/favicon.ico b/docs/input/assets/favicons/favicon.ico new file mode 100644 index 00000000..8ab1bdf9 Binary files /dev/null and b/docs/input/assets/favicons/favicon.ico differ diff --git a/docs/input/assets/favicons/mstile-150x150.png b/docs/input/assets/favicons/mstile-150x150.png new file mode 100644 index 00000000..91ae7b57 Binary files /dev/null and b/docs/input/assets/favicons/mstile-150x150.png differ diff --git a/docs/input/assets/favicons/safari-pinned-tab.svg b/docs/input/assets/favicons/safari-pinned-tab.svg new file mode 100644 index 00000000..da1755f5 --- /dev/null +++ b/docs/input/assets/favicons/safari-pinned-tab.svg @@ -0,0 +1,33 @@ + + + + +Created by potrace 1.14, written by Peter Selinger 2001-2017 + + + + + diff --git a/docs/input/assets/favicons/site.webmanifest b/docs/input/assets/favicons/site.webmanifest new file mode 100644 index 00000000..2ad2da61 --- /dev/null +++ b/docs/input/assets/favicons/site.webmanifest @@ -0,0 +1,19 @@ +{ + "name": "CakeContrib/Cake.7zip", + "short_name": "Cake.7zip", + "icons": [ + { + "src": "/android-chrome-192x192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "/android-chrome-512x512.png", + "sizes": "512x512", + "type": "image/png" + } + ], + "theme_color": "#ffffff", + "background_color": "#ffffff", + "display": "standalone" +} diff --git a/docs/input/assets/logo.png b/docs/input/assets/logo.png new file mode 100644 index 00000000..402d066d Binary files /dev/null and b/docs/input/assets/logo.png differ diff --git a/docs/input/index.cshtml b/docs/input/index.cshtml index f69146f8..e3090b14 100644 --- a/docs/input/index.cshtml +++ b/docs/input/index.cshtml @@ -4,15 +4,10 @@ NoSidebar: true NoContainer: false NoGutter: true --- - -
+

What is it?

- Cake.7zip is an Addin for Cake to use 7Zip. + Cake.7zip is an Addin for Cake to use 7Zip.

@@ -20,24 +15,30 @@ if(!document.location.href.endsWith("/")){

Usage in Cake

- Have a look at SevenZipAliases on how to integrate with Cake. There are also some examples there. + Have a look at SevenZipAliases + on how to integrate with Cake. There are also some examples there.

Available Commands

- All available commands are listed at the ICommand-Interface. + All available commands are listed at the + ICommand-Interface.

Available Switches

- All available switches are listed at the ISupportSwitch-Interface. However, not all commands support every switch. + All available switches are listed at the + ISupportSwitch-Interface. + However, not all commands support every switch.

Available Arguments

- All available arguments are listed at the IHaveArgument-Interface. However, not all commands support every argument. + All available arguments are listed at the + IHaveArgument-Interface. + However, not all commands support every argument.

diff --git a/docs/input/shared/_ExtraNavigation.cshtml b/docs/input/shared/_ExtraNavigation.cshtml new file mode 100644 index 00000000..d1fa7b73 --- /dev/null +++ b/docs/input/shared/_ExtraNavigation.cshtml @@ -0,0 +1,10 @@ + + \ No newline at end of file diff --git a/docs/input/shared/_Footer.cshtml b/docs/input/shared/_Footer.cshtml new file mode 100644 index 00000000..73043361 --- /dev/null +++ b/docs/input/shared/_Footer.cshtml @@ -0,0 +1,7 @@ +
+
+
+ Generated By Statiq +
+
+
\ No newline at end of file diff --git a/docs/settings.yml b/docs/settings.yml index e69de29b..371b8eb8 100644 --- a/docs/settings.yml +++ b/docs/settings.yml @@ -0,0 +1,4 @@ +Logo: /Cake.7zip/assets/Logo.png +EditRoot: https://github.com/cake-contrib/cake.7zip/edit/main/input +MirrorResources: true +OptimizeContentFileNames: false diff --git a/docs/theme b/docs/theme new file mode 160000 index 00000000..58c6080b --- /dev/null +++ b/docs/theme @@ -0,0 +1 @@ +Subproject commit 58c6080b5573153cb37e91a08129d80b4eb4c85f diff --git a/recipe.cake b/recipe.cake index 4afae1e3..68c59cf1 100644 --- a/recipe.cake +++ b/recipe.cake @@ -1,4 +1,5 @@ #load nuget:?package=Cake.Recipe&version=3.1.1 +#l ./.build/statiq-docs.cake Environment.SetVariableNames();