Skip to content
This repository was archived by the owner on Dec 8, 2021. It is now read-only.

[WIP] #152: Website for hosted documentation #159

Merged
merged 2 commits into from
Nov 23, 2018
Merged

[WIP] #152: Website for hosted documentation #159

merged 2 commits into from
Nov 23, 2018

Conversation

Tiberriver256
Copy link
Contributor

@Tiberriver256 Tiberriver256 commented Nov 11, 2018

This is just a first crack at a simple site for Polaris. We can fine tune a little bit on how we want to present the help information and add a little bit extra where it's useful.

Two big things I would love to accomplish here is

  • How to keep this up-to-date with the changes being made on the master branch using the appveyor build process.
  • Make sure the styling and such is acceptable

Once we get those two things out of the way we can really just focus on creating excellent documentation using comment based documentation or about_ files in the main repository and we won't have to worry about keeping the site up-to-date.

Notes on the build process

The site currently has two requirements for help files as markdown:

  1. Every file has to have layout, title, and type set in the metadata. Type can be set to either api or about. layout should always be set to default since we didn't need to get fancy.

image

The type determines where the file will go in the navigation. A type of api gets put into the API Documentation section of the navigation and a type of about gets put into the About Guides section of the navigation.

image

  1. The files have to be somewhere in the gh-pages branch of the repository. My proposal is to mimic the same documentation folder structure as we have in master and just keep everything in the docs folder to keep things clear and also make the build process easier.

This looks like a lot but we can achieve all of that for the API documentation using platyPS and the -Metadata parameter like this:

Get-Command -Module Polaris | foreach { 
New-MarkdownHelp -Command $_ -OnlineVersionUrl "https://powershell.github.io/Polaris/docs/$($_.Name).html" -Metadata @{layout="default";title=$_.Name;type="api"
} -OutputFolder .\docs\api -Force  }

That will auto-generate all of our markdown files for api from comment-based help with the necessary metadata in the header.

For writing about_ files we want to include with the module we can write them following platyPS standards just adding the required metadata fields at the top. i.e.

---
layout: default
title: About Polaris
type: about
---

# Polaris

## about_Polaris

. . .

If we can get that command into our standard build process and we could set up git push to allow pushing back into the gh-pages branch from appveyor. We could do the following steps during an automated release:

  1. Regenerate the API documentation using the above command
  2. Copy the docs folder to somewhere outside the checked out repo
  3. Checkout the gh-pages branch
  4. Copy the docs folder back in replacing everything that's existing
  5. Push all changes back up to gh-pages

Phew... that was a lot... lol. Let me know what you think or if you have a simpler solution or would rather not tackle all of that in one PR.

Related issue #152

@TylerLeonhardt
Copy link
Member

Sorry I took so long to see this!

This looks great. I think if we can just write a quick script that will do the git-push, I can make sure it gets run on releases. :)

@TylerLeonhardt
Copy link
Member

this?

$tempPath = Join-Path ([System.IO.Path]::GetTempPath()) polaris_api_docs
Get-Command -Module Polaris | foreach { 
    New-MarkdownHelp -Command $_ -OnlineVersionUrl "https://powershell.github.io/Polaris/docs/$($_.Name).html" -Metadata @{layout="default";title=$_.Name;type="api" } -OutputFolder $tempPath -Force
}
git checkout gh-pages
Copy-Item -Recurse -Force $tempPath docs/api
git push origin gh-pages

@Tiberriver256
Copy link
Contributor Author

Tiberriver256 commented Nov 17, 2018 via email

Copy link
Member

@TylerLeonhardt TylerLeonhardt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! I don't think there's anything else to address. Do you @Tiberriver256?

@Tiberriver256
Copy link
Contributor Author

Sweet nope! We can merge away and I can get started on writing some about_ files.

@Tiberriver256 Tiberriver256 merged commit 06fe1d6 into PowerShell:gh-pages Nov 23, 2018
@Tiberriver256 Tiberriver256 deleted the gh-pages branch November 23, 2018 02:41
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants