{"id":13599419,"url":"https://github.com/Stephanevg/PSClassUtils","last_synced_at":"2025-04-10T12:32:41.970Z","repository":{"id":76032453,"uuid":"137509983","full_name":"Stephanevg/PSClassUtils","owner":"Stephanevg","description":"A set of utilities to work with Powershell Classes","archived":false,"fork":false,"pushed_at":"2024-06-19T09:23:48.000Z","size":23959,"stargazers_count":95,"open_issues_count":53,"forks_count":24,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-06T12:03:56.269Z","etag":null,"topics":["classes","graphviz","powershell","powershell-modules","uml"],"latest_commit_sha":null,"homepage":"http://powershelldistrict.com/how-to-generate-a-uml-diagram-using-powershell/","language":"PowerShell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Stephanevg.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":"CONTRIBUTING.MD","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-06-15T16:30:15.000Z","updated_at":"2025-01-03T20:49:05.000Z","dependencies_parsed_at":null,"dependency_job_id":"4e8004ed-b6fd-412d-b985-7f3bed05a386","html_url":"https://github.com/Stephanevg/PSClassUtils","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Stephanevg%2FPSClassUtils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Stephanevg%2FPSClassUtils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Stephanevg%2FPSClassUtils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Stephanevg%2FPSClassUtils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Stephanevg","download_url":"https://codeload.github.com/Stephanevg/PSClassUtils/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248217145,"owners_count":21066633,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["classes","graphviz","powershell","powershell-modules","uml"],"created_at":"2024-08-01T17:01:03.823Z","updated_at":"2025-04-10T12:32:36.947Z","avatar_url":"https://github.com/Stephanevg.png","language":"PowerShell","funding_links":[],"categories":["PowerShell"],"sub_categories":[],"readme":"# PSClassUtils\n\n\n## Summary\n\nPsClassUtils, is a Powershell module which contains tools to ease the work with Powershell Classes.\n\nOne cool feature is available is the fact  **that it can generate UML-like Class Diagrams in png format of your scripts / modules in a glimps!** (See ```Write-CUClassDiagram```)\n\nSince version `2.6.0` we have also added the possibility to **automatically generate your pester tests for your entiere module / script / file(s)**.( See ```Write-CUPesterTest``` below.)\n\n-----\n\n## Build Status\n|Master |Dev| Downloads\n|---|---|---|\n|[![master](https://ci.appveyor.com/api/projects/status/p30qxvifokv5fsjg/branch/master?svg=true)](https://ci.appveyor.com/project/Stephanevg/psclassutils/branch/master) |[![dev](https://ci.appveyor.com/api/projects/status/p30qxvifokv5fsjg/branch/master?svg=true)](https://ci.appveyor.com/project/Stephanevg/psclassutils/branch/dev) | [![PSClassUtils](https://img.shields.io/powershellgallery/dt/PsClassUtils.svg)](https://www.powershellgallery.com/packages/PsClassUtils/)\n\n-----\n## How to install PSClassUtils\n\n```powershell\nFind-module PSClassUtils | install-Module\n```\n\n## Release Notes\n\nRelease notes can be found here --\u003e [Release Notes](.\\ReleaseNotes.md)\n\n\n## Functions currently available:\n\n```powershell\n\nGet-CUClass\nGet-CUClassConstructor\nGet-CUClassMethod\nGet-CUClassProperty\nGet-CUCommands\nGet-CUEnum\nGet-CULoadedClass\nInstall-CUDiagramPrerequisites\nWrite-CUClassDiagram\nWrite-CUInterfaceImplementation\nWrite-CUPesterTest\n\n\n```\n\n\n\n## Write-CUClassDiagram\n\nAllows to generate UML diagrams of powerShell scripts / modules that contain PowerShell classes.\n\n\n### Prerequisites\n\nThis module has a dependency on [Kevin Marquette](https://Twitter/KevinMarquette)'s [PSGraph](https://github.com/KevinMarquette/PSGraph) powershell module.\nThe prerequisites can be installed either manually, or by using the following methodology:\n\n```powershell\n\nImport-Module PSClassutils\nInstall-CUDiagramPreRequisites\n\n```\n\n### Functionality\n\n#### Drawings\n\nWrite-CUClassDiagram currently allows to draw diagrams (or components of diagrams) of the follow items:\n- Document a Class\n    - it's Properties\n    - it's Methods\n    - it's Constructors\n    - it's Inheritance\n\nHas a relationships (Composition) is currently not supported. (But is planned for a future release)\n\n#### Inputs\n\nIt is possible to draw diagrams from classes in the following different manners:\n- On a folder level\n    - 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.\n- File base (.ps1)\n    - you can point the function to a single .ps1 file, and will generate the diagram for all the classes located in that file.\n- File base (.psm1)\n    - you can point the function to a single .psm1 file, and will generate the diagram for all the classes located in that file.\n\n#### Examples\n\nA script called ```inheritance.ps1``` contains the following code:\n\n```powershell\n\nClass Woop {\n    [String]$String\n    [int]$number\n\n    Woop([String]$String,[int]$Number){\n\n    }\n\n    [String]DoSomething(){\n        return $this.String\n    }\n}\n\nClass Wap :Woop {\n    [String]$prop3\n\n    DoChildthing(){}\n\n}\n\nClass Wep : Woop {\n    [String]$prop4\n\n    DoOtherChildThing(){\n\n    }\n}\n\n```\n\n#### Calling Write-CUClassDiagram\n```Powershell\nWrite-CUClassDiagram -Path \".\\Inheritance.ps1\"\n```\n\n#### Results\n\n![example with inheritance](/PSClassUtils/Examples/02/Inheritance.png)\n\n## Live examples from existing modules on the internet:\n\nI took the 'liberty' to run Write-CUClassDiagram on some well known modules available on the internet that are classed based.\nThese are all great modules, and I recommend you have a look at them!\n\n### PSClassUtils\n\nThis is the result of running `Write-CUClassDiagram` on this module itself\n\n\n![PSClassUtils](/Images/PSClassUtilsClasses.png)\n\n\n\n### Class.HostsManagement\n\nBelow 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](https://github.com/Stephanevg/Class.HostsManagement))\n\n\n![Class.HostsManagement](https://github.com/Stephanevg/Class.HostsManagement/blob/master/Images//Class.HostsManagement.png?raw=true)\n\n\n### Poshbot\n\nWrite-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:\n\n![PoshBot](https://github.com/Stephanevg/PSClassUtils/blob/master/PSClassUtils/Examples/06/PoshBot_Diagram.png?raw=true)\nhttps://github.com/Stephanevg/PSClassUtils/blob/master/PSClassUtils/Examples/06/PoshBot_Diagram.png\n\n\n## Write-CUPesterTest\n\nSince version `2.6.0` the PsClassUtils module received a few new cmdlets related to pester tests. The most interesting one is without a doubt the: ```Write-CUPesterTest```\n\nAs it's name implies, this function allows to automatically generate your pester tests. (Click on the image below for an example.)\n\n\u003ca href=\"http://powershelldistrict.com/write-cupestertest-demo-org//\"\u003e![PesterTest](./Images/PesterTests.jpg)]\u003c/a\u003e\n\n\n\n## Contributing guide\n\nYou feel like contributing to this project? Awesome! We are happy to hear that, and will to help you succeed in that.\nYou can start by reading our [Contribution guide](CONTRIBUTING.MD).\n\nPlease don't hesitate to open an issue so we can quickly discuss about implementation details  and design of your, perhaps to be, new feature of PSClassutils :)\n\n\n## Community contributions\n\nfor 'HacktOberFest' I created an issue to push people to use the module on their classes, and PR us their classes + examples.\n\nHere under is the list of community driven contributions:\n\n### AclApp\n\nThanks to [LxLeChat](https://github.com/LxLeChat) !!\n\nAcl class is used to create a 3 levels folder structure in a standardized way. The acl creates both folders and corresponding groups and set acl.\n\n![AclApp](https://raw.githubusercontent.com/Stephanevg/PSClassUtils/master/PSClassUtils/Examples/07/aclapp.class.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FStephanevg%2FPSClassUtils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FStephanevg%2FPSClassUtils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FStephanevg%2FPSClassUtils/lists"}