Giter VIP home page Giter VIP logo

psclassutils's Introduction

PSClassUtils

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)

How to install PSClassUtils

Find-module PSClassUtils | install-Module

Release Notes

Release notes can be found here --> Release Notes

Functions currently available:

Install-CUDiagramPrerequisites
Write-CUClassDiagram
Get-CUClass
Get-CUClassConstructor
Get-CUClassMethod
Get-CUClassProperty
Get-CUCommands

Write-CUClassDiagram

Allows to generate UML diagrams of powerShell scripts / modules that contain PowerShell classes.

Prerequisites

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

Functionality

Drawings

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)

Inputs

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.

Examples

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(){

    }
}

Calling Write-CUClassDiagram

Write-CUClassDiagram -Path ".\Inheritance.ps1"

Results

example with inheritance

Live examples from existing modules on the internet:

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!

Class.HostsManagement

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)

Class.HostsManagement

Poshbot

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:

PoshBot

Get-ClassConstructors

Coming soon...

Get-ClassProperties

Coming soon...

Get-ClassMethods

Coming soon...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.