Scriptbook is a cross platform PowerShell module to define your code as a Workflow. It's a way to structure your PowerShell script with Actions or Steps.
- Define your Workflow in PowerShell
- Supports Sequential and Dependency based Workflows
- Allows for nested Actions
- Extent Workflow with your own Actions / Action Modules
- Use all the PowerShell and .Net features in your Workflows
- Test your Workflow in Test Mode with Test Actions
- Run and Debug your Workflow like a normal PowerShell script
- Document your Workflow
Import-Module Scriptbook
Action Hello {
Write-Info "Hello"
}
Action GoodBy {
Write-Info "GoodBy"
}
Start-Workflow -Name 'Hello-Workflow'
You can download and install the Scriptbook module from the PowerShell Gallery
Install-Module -Name Scriptbook -Repository PSGallery -Scope CurrentUser -AllowClobber
Ensure you have installed Scriptbook module
-
Create new PowerShell script file: hello-workflow.ps1
-
Import Scriptbook Module
Import-Module Scriptbook
- Define you actions
Action Hello {
Write-Host "Hello"
}
Action GoodBy {
Write-Host "GoodBy"
}
- Start your Workflow actions
Start-Workflow -Name 'Hello-Workflow'
Scriptbook extends PowerShell with domain specific language (DSL) keywords and Commands.
The following language keywords are used by the Scriptbook module:
- Action - An Action definition / ScriptBlock
- Test - A Test definition / ScriptBlock
- Info - A Documentation definition / ScriptBlock
The following commands exist in the Scriptbook module:
- Start-Workflow - Starts a workflow of Actions
- Enable-Action - Enables an action at runtime
- Disable-Action - Disables an action at runtime
- Invoke-Action - Invokes an action at runtime
- Import-Action - Import actions from another ps file
- Assert-Condition - Checks the supplied boolean condition/ScriptBlock
- PowerShell Core or
- PowerShell 5.1
This project welcomes contributions and suggestions. If you are ready to contribute, please visit the contribution guide.
This project uses the following Code of Conduct.
- Edwin Hagen Tedon Technology BV
This project is licensed under the MIT License.
- Pester Module (Build only)
- PSScriptAnalyzer (Build only)
- platyPS (Build only)
- Docker (Optional at RunTime)
- Run the build.ps1 file from PowerShell console to create the module in the deploy folder and perform the tests from the src/tests folder with Pester
Scriptbook module contains private functions, public functions and Scriptbook Actions. The folder layout used within this git repo is:
- build
- deploy
- docs
- src
- Scriptbook
- Private
- Public
- Scriptbook.psd
- Scriptbook.psm
- tests
- Scriptbook