From 6ba6e808153111387e23119e9bf2f3b3164d40b6 Mon Sep 17 00:00:00 2001 From: Gilbert Sanchez Date: Mon, 21 Jul 2025 13:22:05 -0700 Subject: [PATCH 01/12] Update FeatureFlag.ps1 Signed-off-by: Gilbert Sanchez --- Gatekeeper/Classes/FeatureFlag.ps1 | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Gatekeeper/Classes/FeatureFlag.ps1 b/Gatekeeper/Classes/FeatureFlag.ps1 index 0824226..d1b59be 100644 --- a/Gatekeeper/Classes/FeatureFlag.ps1 +++ b/Gatekeeper/Classes/FeatureFlag.ps1 @@ -163,6 +163,16 @@ class FeatureFlag { return [FeatureFlag]::new($data) } + static [FeatureFlag] FromFile([string]$filePath) { + if (-not (Test-Path $filePath)) { + throw "File not found: $filePath" + } + $json = Get-Content -Raw -Path $filePath + $featureFlag = [FeatureFlag]::FromJson($json) + $featureFlag.FilePath = $filePath + return $featureFlag + } + [void]Save() { if ($null -eq $this.FilePath) { throw "No file path specified to save FeatureFlag." From 4f9bd96fdee022504a9de3a5647a2fc89127c17d Mon Sep 17 00:00:00 2001 From: Gilbert Sanchez Date: Mon, 21 Jul 2025 13:23:01 -0700 Subject: [PATCH 02/12] Update Read-FeatureFlag.ps1 Signed-off-by: Gilbert Sanchez --- Gatekeeper/Public/Read-FeatureFlag.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gatekeeper/Public/Read-FeatureFlag.ps1 b/Gatekeeper/Public/Read-FeatureFlag.ps1 index 98a9baf..4501988 100644 --- a/Gatekeeper/Public/Read-FeatureFlag.ps1 +++ b/Gatekeeper/Public/Read-FeatureFlag.ps1 @@ -42,7 +42,7 @@ function Read-FeatureFlag { } $json = Get-Content -Raw $FilePath $featureFlags.Add( - ([FeatureFlag]::FromJson($json)) + ([FeatureFlag]::FromFile($json)) ) } From e4e8109283f31d6672ce67f21e14e20941c97c18 Mon Sep 17 00:00:00 2001 From: Gilbert Sanchez Date: Mon, 21 Jul 2025 13:25:03 -0700 Subject: [PATCH 03/12] Update CHANGELOG.md Signed-off-by: Gilbert Sanchez --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fad7089..d28884d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## Unreleased + +### Fixed + +- `Read-FeatureFile` uses a new static method to read the file and set the + FilePath. + ## [0.1.0] Initial Release ### Added From 9ee2630d245298491e3eb4994053ff9cb41a1061 Mon Sep 17 00:00:00 2001 From: Gilbert Sanchez Date: Mon, 21 Jul 2025 13:52:07 -0700 Subject: [PATCH 04/12] =?UTF-8?q?feat(Read-FeatureFlag):=20=E2=9C=A8=20add?= =?UTF-8?q?=20tests=20and=20improve=20functionality?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Refactored `Read-FeatureFlag` function to streamline processing. * Added error handling for invalid file paths. * Introduced unit tests for `Read-FeatureFlag` to ensure reliability. * Created a sample `FeatureFlag.json` for testing purposes. --- Gatekeeper/Public/Read-FeatureFlag.ps1 | 13 ++---- tests/Read-FeatureFlag.Tests.ps1 | 32 ++++++++++++++ tests/fixtures/FeatureFlag.json | 59 ++++++++++++++++++++++++++ 3 files changed, 94 insertions(+), 10 deletions(-) create mode 100644 tests/Read-FeatureFlag.Tests.ps1 create mode 100644 tests/fixtures/FeatureFlag.json diff --git a/Gatekeeper/Public/Read-FeatureFlag.ps1 b/Gatekeeper/Public/Read-FeatureFlag.ps1 index 4501988..226cea0 100644 --- a/Gatekeeper/Public/Read-FeatureFlag.ps1 +++ b/Gatekeeper/Public/Read-FeatureFlag.ps1 @@ -29,9 +29,7 @@ function Read-FeatureFlag { [Parameter(Mandatory, ValueFromPipeline, ParameterSetName = 'ByFilePath')] $FilePath ) - begin { - $featureFlags = [System.Collections.Generic.List[PropertySet]]::new() - } + begin {} process { if ($PSBoundParameters.ContainsKey('FilePath')) { Write-Verbose "Reading FeatureFlag from file: $FilePath" @@ -40,13 +38,8 @@ function Read-FeatureFlag { $folder = Get-FeatureFlagFolder $FilePath = Join-Path $folder "$Name.json" } - $json = Get-Content -Raw $FilePath - $featureFlags.Add( - ([FeatureFlag]::FromFile($json)) - ) + [FeatureFlag]::FromFile($FilePath) } - end { - return $featureFlags - } + end {} } diff --git a/tests/Read-FeatureFlag.Tests.ps1 b/tests/Read-FeatureFlag.Tests.ps1 new file mode 100644 index 0000000..d6d55f8 --- /dev/null +++ b/tests/Read-FeatureFlag.Tests.ps1 @@ -0,0 +1,32 @@ +BeforeDiscovery { + $manifest = Import-PowerShellDataFile -Path $env:BHPSModuleManifest + $outputDir = Join-Path -Path $env:BHProjectPath -ChildPath 'Output' + $outputModDir = Join-Path -Path $outputDir -ChildPath $env:BHProjectName + $outputModVerDir = Join-Path -Path $outputModDir -ChildPath $manifest.ModuleVersion + $outputModVerManifest = Join-Path -Path $outputModVerDir -ChildPath "$($env:BHProjectName).psd1" + + # Get module commands + # Remove all versions of the module from the session. Pester can't handle multiple versions. + Get-Module $env:BHProjectName | Remove-Module -Force -ErrorAction Ignore + Import-Module -Name $outputModVerManifest -Verbose:$false -ErrorAction Stop +} +Describe 'Read-FeatureFlag' { + BeforeAll { + $script:actual = Read-FeatureFlag -FilePath "$PSScriptRoot\fixtures\FeatureFlag.json" + } + It 'Throws file path error' { + { Read-FeatureFlag -FilePath 'fakepath.json' } | Should -Throw -ExpectedMessage 'File not found: fakepath.json' + } + It 'Returns a FeatureFlag object' { + $script:actual | Should -BeOfType 'FeatureFlag' + } + It 'Has the correct property: <_.Name>' -ForEach @( + @{ Name = 'Name'; Type = 'String'; Value = 'New Startup Sound' }, + @{ Name = 'Description'; Type = 'String'; Value = 'Roll out new screaming goat start up sound.' }, + @{ Name = 'Tags'; Type = 'String'; Value = @('Goat', 'Managed') }, + @{ Name = 'DefaultEffect'; Type = 'Effect'; Value = "Deny" } + ) { + $script:actual.$($_.Name) | Should -BeOfType $_.Type + $script:actual.$($_.Name) | Should -Be $_.Value + } +} diff --git a/tests/fixtures/FeatureFlag.json b/tests/fixtures/FeatureFlag.json new file mode 100644 index 0000000..67b623e --- /dev/null +++ b/tests/fixtures/FeatureFlag.json @@ -0,0 +1,59 @@ +{ + "$schema": "../../Gatekeeper/Schemas/FeatureFlag.json", + "Name": "New Startup Sound", + "Description": "Roll out new screaming goat start up sound.", + "Version": "1.0.0", + "Author": "Your Name aka who to e-mail when customers are upset", + "Tags": [ + "Goat", + "Managed" + ], + "DefaultEffect": "Deny", + "Rules": [ + { + "Name": "Audit staging", + "Effect": "Audit", + "Conditions": { + "Property": "Environment", + "Operator": "Equals", + "Value": "Staging" + } + }, + { + "Name": "Warn Production", + "Effect": "Warn", + "Conditions": { + "Property": "Environment", + "Operator": "Equals", + "Value": "Production" + } + }, + { + "Name": "Allow Staging and Complaint or 10%", + "Effect": "Allow", + "Conditions": { + "AllOf": [ + { + "AnyOf": [ + { + "Property": "IsCompliant", + "Operator": "Equals", + "Value": "true" + }, + { + "Property": "Percent", + "Operator": "LessThan", + "Value": "11" + } + ] + }, + { + "Property": "Environment", + "Operator": "Equals", + "Value": "Staging" + } + ] + } + } + ] +} From bfe85105598723cb8c771d6cd319b7e40907200d Mon Sep 17 00:00:00 2001 From: Gilbert Sanchez Date: Mon, 21 Jul 2025 13:56:58 -0700 Subject: [PATCH 05/12] =?UTF-8?q?feat(tests):=20=E2=9C=A8=20add=20tests=20?= =?UTF-8?q?for=20new=20file=20creation=20cmdlets?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Implemented tests to verify the functionality of new file creation cmdlets. * Ensured that the tests cover the creation of conditions and rules. * Mocked necessary functions to isolate tests and improve reliability. --- tests/NewFiles.tests.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/NewFiles.tests.ps1 b/tests/NewFiles.tests.ps1 index cd69c3f..5eb72c0 100644 --- a/tests/NewFiles.tests.ps1 +++ b/tests/NewFiles.tests.ps1 @@ -20,7 +20,7 @@ BeforeDiscovery { Describe 'File Creations' { BeforeAll { # Override the default file path for testing - Mock Get-ConfigurationPath -ModuleName Configuration { + Mock Get-ConfigurationPath -ModuleName $env:BHProjectName { return (Get-PSDrive TestDrive).Root } } @@ -39,7 +39,7 @@ Describe 'File Creations' { Context 'Feature Flag Creation' { BeforeAll { # Mock the Get-FeatureFlagFolder to return a test path - Mock Get-FeatureFlagFolder -ModuleName Gatekeeper { + Mock Get-FeatureFlagFolder -ModuleName $env:BHProjectName { return (Get-PSDrive TestDrive).Root } From 335d250949e02f15b0c083f9e9a47e7c9ee774c4 Mon Sep 17 00:00:00 2001 From: Gilbert Sanchez Date: Mon, 21 Jul 2025 14:09:48 -0700 Subject: [PATCH 06/12] =?UTF-8?q?fix(Read-FeatureFlag):=20=F0=9F=90=9B=20c?= =?UTF-8?q?orrect=20output=20type=20annotation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Updated the output type of `Read-FeatureFlag` function to `[PropertySet]` for accuracy. * Ensures proper type handling when reading feature flags from disk. --- Gatekeeper/Public/Read-FeatureFlag.ps1 | 2 +- tests/NewFiles.tests.ps1 | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Gatekeeper/Public/Read-FeatureFlag.ps1 b/Gatekeeper/Public/Read-FeatureFlag.ps1 index 226cea0..19f129b 100644 --- a/Gatekeeper/Public/Read-FeatureFlag.ps1 +++ b/Gatekeeper/Public/Read-FeatureFlag.ps1 @@ -20,7 +20,7 @@ function Read-FeatureFlag { Read the feature from disk. #> [CmdletBinding()] - [OutputType([System.Collections.Generic.List[PropertySet]])] + [OutputType([PropertySet])] param ( [Parameter(Mandatory, Position = 0, ParameterSetName = 'ByName')] [ValidateNotNullOrEmpty()] diff --git a/tests/NewFiles.tests.ps1 b/tests/NewFiles.tests.ps1 index 5eb72c0..fc0b0ef 100644 --- a/tests/NewFiles.tests.ps1 +++ b/tests/NewFiles.tests.ps1 @@ -20,8 +20,10 @@ BeforeDiscovery { Describe 'File Creations' { BeforeAll { # Override the default file path for testing - Mock Get-ConfigurationPath -ModuleName $env:BHProjectName { - return (Get-PSDrive TestDrive).Root + InModuleScope $env:BHProjectName { + Mock Get-ConfigurationPath -ModuleName 'Configuration' { + return (Get-PSDrive TestDrive).Root + } } } # I'm doing a no-no IMO, but this is probably fine. From 8daab40e84c03dbcef294dbfed853d47bfaa58bb Mon Sep 17 00:00:00 2001 From: Gilbert Sanchez Date: Mon, 21 Jul 2025 14:19:51 -0700 Subject: [PATCH 07/12] =?UTF-8?q?fix(tests):=20=F0=9F=90=9B=20update=20moc?= =?UTF-8?q?k=20configuration=20for=20file=20creation=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Refactored the test setup to directly assign the `$script:GatekeeperConfiguration` variable. * Removed unnecessary `InModuleScope` for mocking `Get-ConfigurationPath`. * Ensured the test paths are correctly set for feature flag and property set directories. --- tests/NewFiles.tests.ps1 | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tests/NewFiles.tests.ps1 b/tests/NewFiles.tests.ps1 index fc0b0ef..ac2504c 100644 --- a/tests/NewFiles.tests.ps1 +++ b/tests/NewFiles.tests.ps1 @@ -20,10 +20,9 @@ BeforeDiscovery { Describe 'File Creations' { BeforeAll { # Override the default file path for testing - InModuleScope $env:BHProjectName { - Mock Get-ConfigurationPath -ModuleName 'Configuration' { - return (Get-PSDrive TestDrive).Root - } + $script:GatekeeperConfiguration = @{ + FeatureFlagFolder = Join-Path (Get-PSDrive TestDrive).Root 'FeatureFlags' + PropertySet = Join-Path (Get-PSDrive TestDrive).Root 'PropertySet' } } # I'm doing a no-no IMO, but this is probably fine. @@ -42,7 +41,6 @@ Describe 'File Creations' { BeforeAll { # Mock the Get-FeatureFlagFolder to return a test path Mock Get-FeatureFlagFolder -ModuleName $env:BHProjectName { - return (Get-PSDrive TestDrive).Root } $condition = New-Condition -Property 'UserRole' -Operator 'Equals' -Value 'Admin' From d5021b7e5295298160c4c288cf713113c19b3ce4 Mon Sep 17 00:00:00 2001 From: Gilbert Sanchez Date: Mon, 21 Jul 2025 14:24:47 -0700 Subject: [PATCH 08/12] =?UTF-8?q?fix(tests):=20=F0=9F=90=9B=20update=20moc?= =?UTF-8?q?k=20configuration=20and=20file=20paths=20in=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Refactored the mock for `Get-PropertySetFolder` to ensure consistent test behavior. * Updated the `$script:GatekeeperConfiguration` to include `FilePaths` for better clarity and organization. --- tests/NewFiles.tests.ps1 | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tests/NewFiles.tests.ps1 b/tests/NewFiles.tests.ps1 index ac2504c..98f00c0 100644 --- a/tests/NewFiles.tests.ps1 +++ b/tests/NewFiles.tests.ps1 @@ -19,10 +19,19 @@ BeforeDiscovery { } Describe 'File Creations' { BeforeAll { + Mock -CommandName 'Get-PropertySetFolder' { + return (Join-Path -Path (Get-PSDrive TestDrive).Root -ChildPath 'PropertySet') + } + Mock -CommandName 'Get-PropertySetFolder' { + return (Join-Path -Path (Get-PSDrive TestDrive).Root -ChildPath 'PropertySet') + } # Override the default file path for testing $script:GatekeeperConfiguration = @{ - FeatureFlagFolder = Join-Path (Get-PSDrive TestDrive).Root 'FeatureFlags' - PropertySet = Join-Path (Get-PSDrive TestDrive).Root 'PropertySet' + FilePaths = @{ + #Schemas = Join-Path (Get-PSDrive TestDrive).Root 'Schemas' + FeatureFlags = Join-Path (Get-PSDrive TestDrive).Root 'FeatureFlags' + PropertySet = Join-Path (Get-PSDrive TestDrive).Root 'PropertySet' + } } } # I'm doing a no-no IMO, but this is probably fine. From 40708e80d35bae35abc79c3d88b76f98a1f9189a Mon Sep 17 00:00:00 2001 From: Gilbert Sanchez Date: Mon, 21 Jul 2025 14:27:52 -0700 Subject: [PATCH 09/12] =?UTF-8?q?fix(tests):=20=F0=9F=90=9B=20update=20moc?= =?UTF-8?q?k=20configurations=20for=20file=20creation=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Added `-ModuleName` to mock commands for better clarity and context. * Ensured that the mocks are correctly scoped to the `$env:BHProjectName`. --- tests/NewFiles.tests.ps1 | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/NewFiles.tests.ps1 b/tests/NewFiles.tests.ps1 index 98f00c0..7d88a18 100644 --- a/tests/NewFiles.tests.ps1 +++ b/tests/NewFiles.tests.ps1 @@ -19,11 +19,14 @@ BeforeDiscovery { } Describe 'File Creations' { BeforeAll { - Mock -CommandName 'Get-PropertySetFolder' { + Mock -CommandName 'Get-PropertySetFolder' -ModuleName $env:BHProjectName { return (Join-Path -Path (Get-PSDrive TestDrive).Root -ChildPath 'PropertySet') } - Mock -CommandName 'Get-PropertySetFolder' { - return (Join-Path -Path (Get-PSDrive TestDrive).Root -ChildPath 'PropertySet') + Mock -CommandName 'Get-FeatureFlagFolder' -ModuleName $env:BHProjectName { + return (Join-Path -Path (Get-PSDrive TestDrive).Root -ChildPath 'FeatureFlags') + } + Mock -CommandName 'Get-ConfigurationPath' -ModuleName Configuration { + return (Join-Path -Path (Get-PSDrive TestDrive).Root -ChildPath 'Configuration') } # Override the default file path for testing $script:GatekeeperConfiguration = @{ From 8436b2579a15a15d419a34f4472a5555a78325ae Mon Sep 17 00:00:00 2001 From: Gilbert Sanchez Date: Mon, 21 Jul 2025 14:28:18 -0700 Subject: [PATCH 10/12] =?UTF-8?q?fix(Read-FeatureFlag):=20=F0=9F=90=9B=20c?= =?UTF-8?q?orrect=20output=20type=20annotation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Updated the output type annotation from `[PropertySet]` to `[FeatureFlag]` for the `Read-FeatureFlag` function. * This change ensures that the function correctly reflects the type of object it returns. --- Gatekeeper/Public/Read-FeatureFlag.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gatekeeper/Public/Read-FeatureFlag.ps1 b/Gatekeeper/Public/Read-FeatureFlag.ps1 index 19f129b..482eea5 100644 --- a/Gatekeeper/Public/Read-FeatureFlag.ps1 +++ b/Gatekeeper/Public/Read-FeatureFlag.ps1 @@ -20,7 +20,7 @@ function Read-FeatureFlag { Read the feature from disk. #> [CmdletBinding()] - [OutputType([PropertySet])] + [OutputType([FeatureFlag])] param ( [Parameter(Mandatory, Position = 0, ParameterSetName = 'ByName')] [ValidateNotNullOrEmpty()] From 8f34889eea3ee7586cfddeca3a82ce8bf4f0d8ee Mon Sep 17 00:00:00 2001 From: Gilbert Sanchez Date: Mon, 21 Jul 2025 14:35:10 -0700 Subject: [PATCH 11/12] =?UTF-8?q?fix(tests):=20=F0=9F=90=9B=20create=20mis?= =?UTF-8?q?sing=20directories=20for=20test=20setup?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Ensure necessary directories for `PropertySet`, `FeatureFlags`, and `Configuration` are created before tests run. * Update `$global:GatekeeperConfiguration` to reflect the correct scope for configuration settings. --- tests/NewFiles.tests.ps1 | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/NewFiles.tests.ps1 b/tests/NewFiles.tests.ps1 index 7d88a18..8e79c94 100644 --- a/tests/NewFiles.tests.ps1 +++ b/tests/NewFiles.tests.ps1 @@ -19,6 +19,16 @@ BeforeDiscovery { } Describe 'File Creations' { BeforeAll { + @( + 'PropertySet', + 'FeatureFlags', + 'Configuration' + ) | ForEach-Object { + $folder = Join-Path -Path (Get-PSDrive TestDrive).Root -ChildPath $_ + if (-not (Test-Path -Path $folder)) { + New-Item -Path $folder -ItemType Directory | Out-Null + } + } Mock -CommandName 'Get-PropertySetFolder' -ModuleName $env:BHProjectName { return (Join-Path -Path (Get-PSDrive TestDrive).Root -ChildPath 'PropertySet') } @@ -29,7 +39,7 @@ Describe 'File Creations' { return (Join-Path -Path (Get-PSDrive TestDrive).Root -ChildPath 'Configuration') } # Override the default file path for testing - $script:GatekeeperConfiguration = @{ + $global:GatekeeperConfiguration = @{ FilePaths = @{ #Schemas = Join-Path (Get-PSDrive TestDrive).Root 'Schemas' FeatureFlags = Join-Path (Get-PSDrive TestDrive).Root 'FeatureFlags' From a77add497b11f5cf46441fd4f82c00cb433b8bc4 Mon Sep 17 00:00:00 2001 From: Gilbert Sanchez Date: Tue, 22 Jul 2025 14:54:24 -0700 Subject: [PATCH 12/12] =?UTF-8?q?chore:=20=E2=9C=8F=EF=B8=8F=20update=20CH?= =?UTF-8?q?ANGELOG=20and=20module=20manifest=20for=20version=200.1.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Updated CHANGELOG to reflect the new version. * Incremented `ModuleVersion` to '0.1.1' in the module manifest. * Corrected file path casing in test for consistency. --- CHANGELOG.md | 4 +--- Gatekeeper/Classes/FeatureFlag.ps1 | 2 +- Gatekeeper/Gatekeeper.psd1 | 36 +++++++++++++++--------------- tests/Read-FeatureFlag.Tests.ps1 | 2 +- 4 files changed, 21 insertions(+), 23 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d28884d..36210bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,9 +5,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). -## Unreleased - -### Fixed +## [0.1.1] - `Read-FeatureFile` uses a new static method to read the file and set the FilePath. diff --git a/Gatekeeper/Classes/FeatureFlag.ps1 b/Gatekeeper/Classes/FeatureFlag.ps1 index d1b59be..f3d0376 100644 --- a/Gatekeeper/Classes/FeatureFlag.ps1 +++ b/Gatekeeper/Classes/FeatureFlag.ps1 @@ -156,7 +156,7 @@ class FeatureFlag { } # Example usage: - # $json = Get-Content -Raw -Path 'd:\Gatekeeper\Gatekeeper\featureflag.json' + # $json = Get-Content -Raw -Path 'd:\Gatekeeper\Gatekeeper\featureFlag.json' # $featureFlag = [FeatureFlag]::FromJson($json) static [FeatureFlag] FromJson([string]$json) { $data = ConvertFrom-Json $json -AsHashtable diff --git a/Gatekeeper/Gatekeeper.psd1 b/Gatekeeper/Gatekeeper.psd1 index 9308ea4..c947a7c 100644 --- a/Gatekeeper/Gatekeeper.psd1 +++ b/Gatekeeper/Gatekeeper.psd1 @@ -9,28 +9,28 @@ @{ # Script module or binary module file associated with this manifest. - RootModule = 'Gatekeeper.psm1' + RootModule = 'Gatekeeper.psm1' # Version number of this module. - ModuleVersion = '0.1.0' + ModuleVersion = '0.1.1' # Supported PSEditions # CompatiblePSEditions = @() # ID used to uniquely identify this module - GUID = '7c2fb6fe-e024-4c39-b687-84fbe7473e3f' + GUID = '7c2fb6fe-e024-4c39-b687-84fbe7473e3f' # Author of this module - Author = 'Gilbert Sanchez' + Author = 'Gilbert Sanchez' # Company or vendor of this module - CompanyName = 'Gilbert Sanchez' + CompanyName = 'Gilbert Sanchez' # Copyright statement for this module - Copyright = '(c) Gilbert Sanchez. All rights reserved.' + Copyright = '(c) Gilbert Sanchez. All rights reserved.' # Description of the functionality provided by this module - Description = 'Helps implement feature flags in your PowerShell projects.' + Description = 'Helps implement feature flags in your PowerShell projects.' # Minimum version of the PowerShell engine required by this module # PowerShellVersion = '' @@ -51,9 +51,9 @@ # ProcessorArchitecture = '' # Modules that must be imported into the global environment prior to importing this module - RequiredModules = @( + RequiredModules = @( @{ - ModuleName = 'Configuration' + ModuleName = 'Configuration' ModuleVersion = '1.6.0' } ) @@ -62,7 +62,7 @@ # RequiredAssemblies = @() # Script files (.ps1) that are run in the caller's environment prior to importing this module. - ScriptsToProcess = @('Enums\Effect.ps1', 'Classes\Property.ps1', 'Classes\FeatureFlag.ps1') + ScriptsToProcess = @('Enums\Effect.ps1', 'Classes\Property.ps1', 'Classes\FeatureFlag.ps1') # Type files (.ps1xml) to be loaded when importing this module # TypesToProcess = @() @@ -77,13 +77,13 @@ FunctionsToExport = '*' # Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export. - CmdletsToExport = '*' + CmdletsToExport = '*' # Variables to export from this module VariablesToExport = '*' # Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export. - AliasesToExport = '*' + AliasesToExport = '*' # DSC resources to export from this module # DscResourcesToExport = @() @@ -95,12 +95,12 @@ # FileList = @() # 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. - PrivateData = @{ + PrivateData = @{ PSData = @{ # Tags applied to this module. These help with module discovery in online galleries. - Tags = @( + Tags = @( 'PSEdition_Core', 'Windows', 'Linux', @@ -108,16 +108,16 @@ ) # A URL to the license for this module. - LicenseUri = 'https://github.com/HeyItsGilbert/Gatekeeper/blob/master/LICENSE' + LicenseUri = 'https://github.com/HeyItsGilbert/Gatekeeper/blob/master/LICENSE' # A URL to the main website for this project. - ProjectUri = 'https://github.com/HeyItsGilbert/Gatekeeper/' + ProjectUri = 'https://github.com/HeyItsGilbert/Gatekeeper/' # A URL to an icon representing this module. - IconUri = 'https://raw.githubusercontent.com/HeyItsGilbert/Gatekeeper/main/static/icon.png' + IconUri = 'https://raw.githubusercontent.com/HeyItsGilbert/Gatekeeper/main/static/icon.png' # ReleaseNotes of this module - ReleaseNotes = 'https://github.com/HeyItsGilbert/Gatekeeper/blob/master/CHANGELOG.md' + ReleaseNotes = 'https://github.com/HeyItsGilbert/Gatekeeper/blob/master/CHANGELOG.md' # Prerelease string of this module # Prerelease = '' diff --git a/tests/Read-FeatureFlag.Tests.ps1 b/tests/Read-FeatureFlag.Tests.ps1 index d6d55f8..9df2fe4 100644 --- a/tests/Read-FeatureFlag.Tests.ps1 +++ b/tests/Read-FeatureFlag.Tests.ps1 @@ -15,7 +15,7 @@ Describe 'Read-FeatureFlag' { $script:actual = Read-FeatureFlag -FilePath "$PSScriptRoot\fixtures\FeatureFlag.json" } It 'Throws file path error' { - { Read-FeatureFlag -FilePath 'fakepath.json' } | Should -Throw -ExpectedMessage 'File not found: fakepath.json' + { Read-FeatureFlag -FilePath 'fakePath.json' } | Should -Throw -ExpectedMessage 'File not found: fakePath.json' } It 'Returns a FeatureFlag object' { $script:actual | Should -BeOfType 'FeatureFlag'