├── Media ├── e2_events.png ├── e1_process.png ├── scom_plain.png ├── scom_spicy.png ├── pester_simple.PNG ├── pester_simple.png ├── pester_advanced.PNG └── pester_advanced.png ├── appveyor.yml ├── PSHTMLTable ├── PSHTMLTable.psm1 ├── en-US │ └── about_PSHTMLTable.help.txt ├── PSHTMLTable.psd1 └── Public │ ├── Close-HTML.ps1 │ ├── New-HTMLHead.ps1 │ ├── New-HTMLTable.ps1 │ ├── ConvertTo-PropertyValue.ps1 │ └── Add-HTMLTableColor.ps1 ├── deploy.psdeploy.ps1 ├── Tests └── PSHTMLTable.Tests.ps1 ├── LICENSE ├── psake.ps1 └── README.md /Media/e2_events.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RamblingCookieMonster/PSHTMLTable/HEAD/Media/e2_events.png -------------------------------------------------------------------------------- /Media/e1_process.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RamblingCookieMonster/PSHTMLTable/HEAD/Media/e1_process.png -------------------------------------------------------------------------------- /Media/scom_plain.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RamblingCookieMonster/PSHTMLTable/HEAD/Media/scom_plain.png -------------------------------------------------------------------------------- /Media/scom_spicy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RamblingCookieMonster/PSHTMLTable/HEAD/Media/scom_spicy.png -------------------------------------------------------------------------------- /Media/pester_simple.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RamblingCookieMonster/PSHTMLTable/HEAD/Media/pester_simple.PNG -------------------------------------------------------------------------------- /Media/pester_simple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RamblingCookieMonster/PSHTMLTable/HEAD/Media/pester_simple.png -------------------------------------------------------------------------------- /Media/pester_advanced.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RamblingCookieMonster/PSHTMLTable/HEAD/Media/pester_advanced.PNG -------------------------------------------------------------------------------- /Media/pester_advanced.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RamblingCookieMonster/PSHTMLTable/HEAD/Media/pester_advanced.png -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | # See http://www.appveyor.com/docs/appveyor-yml for many more options 2 | 3 | #Publish to PowerShell Gallery with this key 4 | environment: 5 | NuGetApiKey: 6 | secure: oqMFzG8F65K5l572V7VzlZIWU7xnSYDLtSXECJAAURrXe8M2+BAp9vHLT+1h1lR0 7 | 8 | # Allow WMF5 (i.e. PowerShellGallery functionality) 9 | os: WMF 5 10 | 11 | # Skip on updates to the readme. 12 | # We can force this by adding [skip ci] or [ci skip] anywhere in commit message 13 | skip_commits: 14 | message: /updated readme.*|update readme.*s/ 15 | 16 | build: false 17 | 18 | #Kick off the CI/CD pipeline 19 | test_script: 20 | - ps: . .\build.ps1 -------------------------------------------------------------------------------- /PSHTMLTable/PSHTMLTable.psm1: -------------------------------------------------------------------------------- 1 | #handle PS2 2 | if(-not $PSScriptRoot) 3 | { 4 | $PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent 5 | } 6 | #Get public and private function definition files. 7 | $Public = @( Get-ChildItem -Path $PSScriptRoot\Public\*.ps1 -ErrorAction SilentlyContinue ) 8 | $Private = @( Get-ChildItem -Path $PSScriptRoot\Private\*.ps1 -ErrorAction SilentlyContinue ) 9 | 10 | #Dot source the files 11 | Foreach($import in @($Public + $Private)) 12 | { 13 | Try 14 | { 15 | . $import.fullname 16 | } 17 | Catch 18 | { 19 | Write-Error -Message "Failed to import function $($import.fullname): $_" 20 | } 21 | } 22 | 23 | Export-ModuleMember -Function ($Public | Select -ExpandProperty BaseName) 24 | -------------------------------------------------------------------------------- /deploy.psdeploy.ps1: -------------------------------------------------------------------------------- 1 | # Generic module deployment. 2 | # This stuff should be moved to psake for a cleaner deployment view 3 | 4 | # ASSUMPTIONS: 5 | 6 | # folder structure of: 7 | # - RepoFolder 8 | # - This PSDeploy file 9 | # - ModuleName 10 | # - ModuleName.psd1 11 | 12 | # Nuget key in $ENV:NugetApiKey 13 | 14 | # Set-BuildEnvironment from BuildHelpers module has populated ENV:BHProjectName 15 | 16 | # find a folder that has psd1 of same name... 17 | 18 | if($ENV:BHProjectName -and $ENV:BHProjectName.Count -eq 1) 19 | { 20 | Deploy Module { 21 | By PSGalleryModule { 22 | FromSource $ENV:BHProjectName 23 | To PSGallery 24 | WithOptions @{ 25 | ApiKey = $ENV:NugetApiKey 26 | } 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /Tests/PSHTMLTable.Tests.ps1: -------------------------------------------------------------------------------- 1 | $PSVersion = $PSVersionTable.PSVersion.Major 2 | $ModuleName = $ENV:BHProjectName 3 | 4 | # Verbose output for non-master builds on appveyor 5 | # Handy for troubleshooting. 6 | # Splat @Verbose against commands as needed (here or in pester tests) 7 | $Verbose = @{} 8 | if($ENV:BHBranchName -notlike "master" -or $env:BHCommitMessage -match "!verbose") 9 | { 10 | $Verbose.add("Verbose",$True) 11 | } 12 | 13 | Import-Module $PSScriptRoot\..\$ModuleName -Force 14 | 15 | Describe "$ModuleName PS$PSVersion" { 16 | Context 'Strict mode' { 17 | 18 | Set-StrictMode -Version latest 19 | 20 | It 'Should load' { 21 | $Module = Get-Module $ModuleName 22 | $Module.Name | Should be $ModuleName 23 | $Commands = $Module.ExportedCommands.Keys 24 | $Commands -contains 'Add-HTMLTableColor' | Should Be $True 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 Warren F. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /PSHTMLTable/en-US/about_PSHTMLTable.help.txt: -------------------------------------------------------------------------------- 1 | PSTOPIC 2 | about_PSHTMLTable 3 | 4 | SHORT DESCRIPTION 5 | This is a set of functions used to generate HTML tables, and highlight cells within them on demand. 6 | 7 | DETAILED DESCRIPTION 8 | This is a set of functions used to generate HTML tables, and highlight cells within them on demand. 9 | 10 | You can use and combine several functions to create HTML pages: 11 | 12 | * New-HTMLHead - Starts building HTML including internal style sheet (leaves body, html tags open) 13 | * New-HTMLTable - Create an HTML table from one or more objects 14 | * Add-HTMLTableColor - Colorize cells or rows in an HTML table, or add other inline CSS 15 | * CloseHTML - Close out the body and html tags 16 | * ConvertTo-PropertyValue - Convert an object with various properties into an array of property,value pairs 17 | 18 | Note that these should work together. New-HTMLTable just creates a table, not the full HTML around it, thus allowing you to build multiple tables per page. 19 | 20 | See Get-Help New-HTMLHead -Full to see a variety of examples, including the use of all functions together. 21 | 22 | LINK 23 | https://github.com/RamblingCookieMonster/PSHTMLTable 24 | -------------------------------------------------------------------------------- /psake.ps1: -------------------------------------------------------------------------------- 1 | # PSake makes variables declared here available in other scriptblocks 2 | # Init some things 3 | Properties { 4 | # Find the build folder based on build system 5 | $ProjectRoot = $ENV:BHProjectPath 6 | if(-not $ProjectRoot) 7 | { 8 | $ProjectRoot = $PSScriptRoot 9 | } 10 | 11 | $Timestamp = Get-date -uformat "%Y%m%d-%H%M%S" 12 | $PSVersion = $PSVersionTable.PSVersion.Major 13 | $TestFile = "TestResults_PS$PSVersion`_$TimeStamp.xml" 14 | $lines = '----------------------------------------------------------------------' 15 | 16 | $Verbose = @{} 17 | if($ENV:BHCommitMessage -match "!verbose") 18 | { 19 | $Verbose = @{Verbose = $True} 20 | } 21 | } 22 | 23 | Task Default -Depends Deploy 24 | 25 | Task Init { 26 | $lines 27 | Set-Location $ProjectRoot 28 | "Build System Details:" 29 | Get-Item ENV:BH* 30 | "`n" 31 | } 32 | 33 | Task Test -Depends Init { 34 | $lines 35 | "`n`tSTATUS: Testing with PowerShell $PSVersion" 36 | 37 | # Gather test results. Store them in a variable and file 38 | $TestResults = Invoke-Pester -Path $ProjectRoot\Tests -PassThru -OutputFormat NUnitXml -OutputFile "$ProjectRoot\$TestFile" 39 | 40 | # In Appveyor? Upload our tests! #Abstract this into a function? 41 | If($ENV:BHBuildSystem -eq 'AppVeyor') 42 | { 43 | (New-Object 'System.Net.WebClient').UploadFile( 44 | "https://ci.appveyor.com/api/testresults/nunit/$($env:APPVEYOR_JOB_ID)", 45 | "$ProjectRoot\$TestFile" ) 46 | } 47 | 48 | Remove-Item "$ProjectRoot\$TestFile" -Force -ErrorAction SilentlyContinue 49 | 50 | # Failed tests? 51 | # Need to tell psake or it will proceed to the deployment. Danger! 52 | if($TestResults.FailedCount -gt 0) 53 | { 54 | Write-Error "Failed '$($TestResults.FailedCount)' tests, build failed" 55 | } 56 | "`n" 57 | } 58 | 59 | Task Build -Depends Test { 60 | $lines 61 | 62 | # Load the module, read the exported functions, update the psd1 FunctionsToExport 63 | Set-ModuleFunctions 64 | 65 | # Bump the module version 66 | $Version = Get-NextPSGalleryVersion -Name $env:BHProjectName 67 | Update-Metadata -Path $env:BHPSModuleManifest -PropertyName ModuleVersion -Value $Version 68 | } 69 | 70 | Task Deploy -Depends Build { 71 | $lines 72 | 73 | # Gate deployment 74 | if( 75 | $ENV:BHBuildSystem -ne 'Unknown' -and 76 | $ENV:BHBranchName -eq "master" -and 77 | $ENV:BHCommitMessage -match '!deploy' 78 | ) 79 | { 80 | $Params = @{ 81 | Path = $ProjectRoot 82 | Force = $true 83 | } 84 | 85 | Invoke-PSDeploy @Verbose @Params 86 | } 87 | else 88 | { 89 | "Skipping deployment: To deploy, ensure that...`n" + 90 | "`t* You are in a known build system (Current: $ENV:BHBuildSystem)`n" + 91 | "`t* You are committing to the master branch (Current: $ENV:BHBranchName) `n" + 92 | "`t* Your commit message includes !deploy (Current: $ENV:BHCommitMessage)" 93 | } 94 | } -------------------------------------------------------------------------------- /PSHTMLTable/PSHTMLTable.psd1: -------------------------------------------------------------------------------- 1 | @{ 2 | 3 | # Script module or binary module file associated with this manifest. 4 | RootModule = 'PSHTMLTable.psm1' 5 | 6 | # Version number of this module. 7 | ModuleVersion = '0.0.1' 8 | 9 | # ID used to uniquely identify this module 10 | GUID = 'ce5f0fbd-d393-4095-aee6-61259a2e0fb4' 11 | 12 | # Author of this module 13 | Author = 'Warren Frame' 14 | 15 | # Company or vendor of this module 16 | #CompanyName = 'Unknown' 17 | 18 | # Copyright statement for this module 19 | Copyright = '(c) 2016 Warren F. All rights reserved.' 20 | 21 | # Description of the functionality provided by this module 22 | Description = 'Simplify creating HTML tables' 23 | 24 | # Minimum version of the Windows PowerShell engine required by this module 25 | PowerShellVersion = '2.0' 26 | 27 | # Name of the Windows PowerShell host required by this module 28 | # PowerShellHostName = '' 29 | 30 | # Minimum version of the Windows PowerShell host required by this module 31 | # PowerShellHostVersion = '' 32 | 33 | # Minimum version of Microsoft .NET Framework required by this module 34 | # DotNetFrameworkVersion = '' 35 | 36 | # Minimum version of the common language runtime (CLR) required by this module 37 | # CLRVersion = '' 38 | 39 | # Processor architecture (None, X86, Amd64) required by this module 40 | # ProcessorArchitecture = '' 41 | 42 | # Modules that must be imported into the global environment prior to importing this module 43 | # RequiredModules = @() 44 | 45 | # Assemblies that must be loaded prior to importing this module 46 | # RequiredAssemblies = @() 47 | 48 | # Script files (.ps1) that are run in the caller's environment prior to importing this module. 49 | # ScriptsToProcess = @() 50 | 51 | # Type files (.ps1xml) to be loaded when importing this module 52 | # TypesToProcess = @() 53 | 54 | # Format files (.ps1xml) to be loaded when importing this module 55 | #FormatsToProcess = '.Format.ps1xml' 56 | 57 | # Modules to import as nested modules of the module specified in RootModule/ModuleToProcess 58 | # NestedModules = @() 59 | 60 | # Functions to export from this module 61 | FunctionsToExport = '*' 62 | 63 | # Cmdlets to export from this module 64 | CmdletsToExport = '*' 65 | 66 | # Variables to export from this module 67 | VariablesToExport = '*' 68 | 69 | # Aliases to export from this module 70 | AliasesToExport = '*' 71 | 72 | # DSC resources to export from this module 73 | # DscResourcesToExport = @() 74 | 75 | # List of all modules packaged with this module 76 | # ModuleList = @() 77 | 78 | # List of all files packaged with this module 79 | # FileList = @() 80 | 81 | # Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. 82 | PrivateData = @{ 83 | 84 | PSData = @{ 85 | 86 | # Tags applied to this module. These help with module discovery in online galleries. 87 | Tags = @('HTML', 'Table', 'Color', 'Mail', 'Report', 'Webpage') 88 | 89 | # A URL to the license for this module. 90 | LicenseUri = 'https://github.com/RamblingCookieMonster/PSHTMLTable/blob/master/LICENSE' 91 | 92 | # A URL to the main website for this project. 93 | ProjectUri = 'https://github.com/RamblingCookieMonster/PSHTMLTable/' 94 | 95 | # A URL to an icon representing this module. 96 | # IconUri = '' 97 | 98 | # ReleaseNotes of this module 99 | # ReleaseNotes = '' 100 | 101 | } # End of PSData hashtable 102 | 103 | } # End of PrivateData hashtable 104 | 105 | # HelpInfo URI of this module 106 | # HelpInfoURI = '' 107 | 108 | # Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix. 109 | # DefaultCommandPrefix = '' 110 | 111 | } 112 | -------------------------------------------------------------------------------- /PSHTMLTable/Public/Close-HTML.ps1: -------------------------------------------------------------------------------- 1 | function Close-HTML { 2 | <# 3 | .SYNOPSIS 4 | Close out the body and html tags 5 | 6 | .DESCRIPTION 7 | Close out the body and html tags 8 | 9 | .PARAMETER HTML 10 | HTML string to work with 11 | 12 | .PARAMETER Decode 13 | If specified, run HTML string through HtmlDecode 14 | 15 | .EXAMPLE 16 | #This example requires and demonstrates using the New-HTMLHead, New-HTMLTable, Add-HTMLTableColor, ConvertTo-PropertyValue and Close-HTML functions. 17 | 18 | #get processes to work with 19 | $processes = Get-Process 20 | 21 | #Build HTML header 22 | $HTML = New-HTMLHead -title "Process details" 23 | 24 | #Add CPU time section with top 10 PrivateMemorySize processes. This example does not highlight any particular cells 25 | $HTML += "