https://github.com/cdhunt/bob
PowerShell module builder
https://github.com/cdhunt/bob
ci-cd experimental learning-exercise powershell
Last synced: 11 months ago
JSON representation
PowerShell module builder
- Host: GitHub
- URL: https://github.com/cdhunt/bob
- Owner: cdhunt
- Created: 2018-04-30T17:08:28.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-05-05T17:21:17.000Z (over 7 years ago)
- Last Synced: 2025-03-01T05:25:40.205Z (11 months ago)
- Topics: ci-cd, experimental, learning-exercise, powershell
- Language: PowerShell
- Size: 20.5 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Bob
This project is an exploration of [Software Design Patterns in PowerShell](https://www.automatedops.com/blog/2018/04/11/software-design-patterns-in-powershell-strategy-pattern/).
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](http://www.blackwasp.co.uk/Strategy.aspx), 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.
```powershell
# 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}
```
:warning: 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.