This module contains tools to ease the work with Powershell Classes.
The most usefull feature is probably the one that it can generate UML-like Class Diagrams in png format of your scripts / modules. (See Write-CUClassDiagram)
Find-module PSClassUtils | install-Module
Release notes can be found here --> Release Notes
Install-CUDiagramPrerequisites
Write-CUClassDiagram
Get-CUClass
Get-CUClassConstructor
Get-CUClassMethod
Get-CUClassProperty
Get-CUCommands
Allows to generate UML diagrams of powerShell scripts / modules that contain PowerShell classes.
This module has a dependency on Kevin Marquette's PSGraph powershell module. The prerequisites can be installed either manually, or by using the following methodology:
Import-Module PSClassutils
Install-CUDiagramPreRequisites
Write-CUClassDiagram currently allows to draw diagrams (or components of diagrams) of the follow items:
- Document a Class
- it's Properties
- it's Methods
- it's Constructors
- it's Inheritance
Has a relationships (Composition) is currently not supported. (But is planned for a future release)
It is possible to draw diagrams from classes in the following different manners:
- On a folder level
- This will create a diagram and document each independant .ps1 file that contains a class. If no classes are found, it will be an empty square.
- File base (.ps1)
- you can point the function to a single .ps1 file, and will generate the diagram for all the classes located in that file.
- File base (.psm1)
- you can point the function to a single .psm1 file, and will generate the diagram for all the classes located in that file.
A script called inheritance.ps1
contains the following code:
Class Woop {
[String]$String
[int]$number
Woop([String]$String,[int]$Number){
s
}
[String]DoSomething(){
return $this.String
}
}
Class Wap :Woop {
[String]$prop3
DoChildthing(){}
}
Class Wep : Woop {
[String]$prop4
DoOtherChildThing(){
}
}
Write-CUClassDiagram -Path ".\Inheritance.ps1"
I took the 'liberty' to run Write-CUClassDiagram on some well known modules available on the internet that are classed based. These are all great modules, and I recommend you have a look at them!
Below is the export of the Class Diagram of a module I wrote that helps to manage HostsFiles accross the network using PowerShell classes. (The project is accessible Here)
Write-CUClassDiagram allows to generate diagrams of complex class based modules, and gives you the ability to have a global picture of any project quickly, without reading through the code. PoshBot is probably the best example:
Coming soon...
Coming soon...
Coming soon...