smurawski / powershellguard Goto Github PK
View Code? Open in Web Editor NEWA Guard implementation for PowerShell
License: MIT License
A Guard implementation for PowerShell
License: MIT License
The readme references Guard but doesn't give a newcomer any idea of what Guard is, or even what company makes it. Maybe add a link to the wiki page of Guard, or a link to the Guard company's product site?
Of course, we can't rule out the very real possibility that everyone else in the world knows about Guard, except me.
Get tests running in jobs and make wait-guard just block on returning jobs.
The New-Guard command does not like me giving it a folder name with spaces in it. I tried many work around but I cannot find a way to protect the path.
I am happy to help with debugging if I am given some guidance where to inject some code.
I have made a small module to create the guards I need, based on VSCodeWatcherTask
Watch-Project -WorkspaceRoot "c:\Users\fma146\OneDrive - Maersk Group\PowerShell\Build" -Type Project
which basically runs:
New-Guard -Path "$WorkspaceRoot" -PathFilter "*.ps1" -MonitorSubdirectories -TestPath
"$WorkspaceRoot\Tests" -TestCommand {
Write-Host "Invoking Watch.Project"
Invoke-Pester -PesterOption @{IncludeVSCodeMarker=$true}
} -Wait
which, when tests complete, results in:
Tests completed in 5.24s
Passed: 42 Failed: 0 Skipped: 0 Pending: 0 Inconclusive: 0
Exception calling "InvokeScript" with "1" argument(s): "The term 'C:\Users\fma146\OneDrive' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if apath was included, verify that the path is correct and try again."
At C:\Users\fma146\Documents\WindowsPowerShell\Modules\PowerShellGuard\0.8.68\PowerShellGuard.psm1:195 char:7
$ExecutionContext.InvokeCommand.InvokeScript($Command)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CategoryInfo : NotSpecified: (:) [], MethodInvocationException
FullyQualifiedErrorId : CommandNotFoundException
When tests run as jobs, there should be commands to start and stop them.
How to add your module to the directory. Great way to manage the distribution of PSGuard.
Error generated when attempting to Import-Module:
The "=" operator is missing after a named argument.
At C:\Users\cb2215\Documents\WindowsPowerShell\Modules\PowerShellGuard\PowerShellGuard.psm1:23 char:50
[parameter(ValueFromPipelineByPropertyName) <<<< ]
- CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
- FullyQualifiedErrorId : MissingEqualsInNamedArgument
PS> $PSVersionTable.PSVersion
Major Minor Build Revision
----- ----- ----- --------
2 0 -1 -1
Running the second example yields lot of these errors:
PS C:\Projects\PSTMigration> dir *.ps1 | New-Guard -TestPath {"./Tests/$($_.basename).Tests.ps1"}
Resolve-Path : Cannot evaluate parameter 'Path' because its argument is specified as a script block and there is no
input. A script block cannot be evaluated without input.
At C:\Projects\PowerShellGuard\PowerShellGuard.psm1:52 char:33
+ $TestPath = (resolve-path $TestPath).Path
+ ~~~~~~~~~
+ CategoryInfo : MetadataError: (:) [Resolve-Path], ParameterBindingException
+ FullyQualifiedErrorId : ScriptBlockArgumentNoInput,Microsoft.PowerShell.Commands.ResolvePathCommand
Adding ValueFromPipeline=$true
to $Path
does not solve the issue, it only changes the error to:
Resolve-Path : Cannot evaluate parameter 'Path' because its argument is specified as a script block and there is no
input. A script block cannot be evaluated without input.
At C:\Projects\PowerShellGuard\PowerShellGuard.psm1:52 char:33
+ $TestPath = (resolve-path $TestPath).Path
+ ~~~~~~~~~
+ CategoryInfo : MetadataError: (:) [Resolve-Path], ParameterBindingException
+ FullyQualifiedErrorId : ScriptBlockArgumentNoInput,Microsoft.PowerShell.Commands.ResolvePathCommand
Feature Enhancement :)
It would be nice to be able to supply my own Powershell script block to execute instead of just a string of text. Further, it would be awesome if the script block could pass the changed file(s) to the script block as an argument.
I use this module every day and when I setup a new machine I have to register the AppVeyor nuget feed to get the latest bits.
This should be called Action
Need some error handling.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.