Skip to content

Latest commit

 

History

History
57 lines (42 loc) · 1.6 KB

readme.md

File metadata and controls

57 lines (42 loc) · 1.6 KB

Bob

This project is an exploration of Software Design Patterns in PowerShell. Currently, the goal isn't to produce a usable module, but to test out some ideas of how to put PowerShell modules together. By building a module on top of PowerShell classes utilizing the Strategy pattern, we should be able to build a module that is easier to maintain and plug in additional functionality without changes to the core code.

We can use multiple forms of invocation depending on preference and context.

# PS Classes w/Fluent API
PS> [Job]::New('src', 'dst').
>>         AddStage([Clean]::New()).
>>         AddStage([Copy]::New()).
>>         AddStage([Test]::New()) | Select stages

Stages
------
{Clean, Copy, Test}

# Cmdlet Pipeline
PS> New-BuildJob src dst | Add-StageClean | Add-StageCopy | Add-StageTest | Select stages

Stages
------
{Clean, Copy, Test}


# Cmdlet Pipeline w/ Generic Cmdlet
PS> New-BuildJob src dst | Add-StageClean | Add-StageCopy | Add-BuildStage -Stage ([Test]::New()) | Select stages

Stages
------
{Clean, Copy, Test}


# DSL
BuildJob src dst {
    CleanStg
    CopyStg
    TestStg
} | Select stages

Stages
------
{Clean, Copy, Test}

# YAML Config
PS> New-BuildFromYaml .\build.yaml | Select stages

Stages
------
{Clean, Copy, Test}

⚠️ Please don't pay much attention to the names of things. This is not meant to be an example of a well-formed module. You probably won't win any scripting games by copying the structure of this module.