Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Generate_Wiki_Content a metatask that runs other build tasks #135

Closed
johlju opened this issue Dec 31, 2023 · 7 comments · Fixed by #145
Closed

Make Generate_Wiki_Content a metatask that runs other build tasks #135

johlju opened this issue Dec 31, 2023 · 7 comments · Fixed by #145
Labels
enhancement The issue is an enhancement request. good first issue The issue should be easier to fix and can be taken up by a beginner to learn to contribute on GitHub

Comments

@johlju
Copy link
Member

johlju commented Dec 31, 2023

Suggest making Generate_Wiki_Content a metatask and the current Generate_Wiki_Content is renamed to Generate_Markdown_For_DSC_Resources (or something similar).

The new metatask Generate_Wiki_Content will run all the tasks that is needed to generate the wiki content:

  • Generate_Markdown_For_DSC_Resources
  • Generate_Markdown_For_Public_Commands
  • Generate_External_Help_File_For_Public_Commands
  • Clean_Markdown_Of_Public_Commands
@johlju johlju changed the title Make Genererat_Wiki_Content a metatask that runs other build tasks Make Generate_Wiki_Content a metatask that runs other build tasks Dec 31, 2023
@johlju
Copy link
Member Author

johlju commented May 1, 2024

There is an issue excluding certain part of the documentation being generated. To simplify that I suggest we should also have:

  • New tasks Create_Wiki_Output_Folder for the code:

$wikiOutputPath = Join-Path -Path $OutputDirectory -ChildPath 'WikiContent'
if ((Test-Path -Path $wikiOutputPath) -eq $false)
{
$null = New-Item -Path $wikiOutputPath -ItemType Directory
}
"`tWiki Output Path = $wikiOutputPath"

  • New task Copy_Source_Wiki_Folder for the code:

$wikiSourcePath = Join-Path -Path $SourcePath -ChildPath $WikiSourceFolderName
$wikiSourceExist = Test-Path -Path $wikiSourcePath
if ($wikiSourceExist)
{
"`tWiki Source Path = $wikiSourcePath"
}

if ($wikiSourceExist)
{
Write-Build -Color 'Magenta' -Text 'Copying Wiki content from the Wiki source folder.'
Copy-Item -Path (Join-Path $wikiSourcePath -ChildPath '*') -Destination $wikiOutputPath -Recurse -Force
$homeMarkdownFilePath = Join-Path -Path $wikiOutputPath -ChildPath 'Home.md'
if (Test-Path -Path $homeMarkdownFilePath)
{
Write-Build -Color 'Magenta' -Text 'Updating module version in Home.md if there are any placeholders found.'
Set-WikiModuleVersion -Path $homeMarkdownFilePath -ModuleVersion $moduleVersion
}
}

  • The following code goes into the (above) suggested Generate_Markdown_For_DSC_Resources:

Write-Build -Color 'Magenta' -Text 'Generating Wiki content for all DSC resources based on source and built module.'
$dscResourceMarkdownMetadata = $BuildInfo.'DscResource.DocGenerator'.Generate_Wiki_Content
New-DscResourceWikiPage -SourcePath $SourcePath -BuiltModulePath $builtModuleBase -OutputPath $wikiOutputPath -Metadata $dscResourceMarkdownMetadata -Force

@johlju johlju added enhancement The issue is an enhancement request. good first issue The issue should be easier to fix and can be taken up by a beginner to learn to contribute on GitHub help wanted The issue is up for grabs for anyone in the community. labels May 1, 2024
@dan-hughes
Copy link
Contributor

@johlju, do you have an example of this. Looks to be a good one to release at the same time as the other task addition.

@johlju
Copy link
Member Author

johlju commented May 29, 2024

A meta task is made the same way as other task, it just references other tasks instead of having code by itself

Task Generate_Wiki_Content Create_Wiki_Output_Folder, Copy_Source_Wiki_Folder, Generate_Markdown_For_DSC_Resources, Generate_Markdown_For_Public_Commands, Generate_External_Help_File_For_Public_Commands, Clean_Markdown_Of_Public_Commands

Happy to review this if you have the time.

@dan-hughes
Copy link
Contributor

Let me draft something and see if I understand it.

@johlju
Copy link
Member Author

johlju commented May 29, 2024

There is a bit of work splitting up the existing task into seperate tasks. But would be great to get it in, then I can complete a PR in Sampler that waits for this issue. 🙂

@dan-hughes
Copy link
Contributor

Params - are these the same for each of the tasks?
Also how can I pass variables between tasks?

@johlju
Copy link
Member Author

johlju commented May 29, 2024

Yes I would say so, unless one is not specifically used I guess it can be skipped 🤔
But easiest is just copy all params to all tasks.

johlju pushed a commit that referenced this issue May 31, 2024
- Task `Generate_Wiki_Content` converted to a metatask. Existing
  functionality split into smaller tasks. Fixes issue #135
@johlju johlju removed the help wanted The issue is up for grabs for anyone in the community. label May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement The issue is an enhancement request. good first issue The issue should be easier to fix and can be taken up by a beginner to learn to contribute on GitHub
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants