diff --git a/.gitignore b/.gitignore index eef02fd..2a052a7 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ /Carbon.DSC/LICENSE.txt /Carbon.DSC/NOTICE.txt /Carbon.DSC/README.md -/Carbon.DSC/Modules/ \ No newline at end of file +/Carbon.DSC/Carbon +/Carbon.DSC/Carbon.* diff --git a/CHANGELOG.md b/CHANGELOG.md index 2394a9c..f5bed41 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,14 @@ # Carbon.DSC Changelog +## 1.0.1 + +Reducing directory depth of internal, private nested module dependencies. + ## 1.0.0 +> Released 13 Sep 2024 + ### Upgrade Instructions Migrated DSC functionality from Carbon. diff --git a/Carbon.DSC/Carbon.DSC.psd1 b/Carbon.DSC/Carbon.DSC.psd1 index f07a365..7056a89 100644 --- a/Carbon.DSC/Carbon.DSC.psd1 +++ b/Carbon.DSC/Carbon.DSC.psd1 @@ -18,7 +18,7 @@ RootModule = 'Carbon.DSC.psm1' # Version number of this module. - ModuleVersion = '1.0.0' + ModuleVersion = '1.0.1' # ID used to uniquely identify this module GUID = '8aa43ac0-cd66-4fc0-aa13-efa08d573946' diff --git a/Carbon.DSC/Carbon.DSC.psm1 b/Carbon.DSC/Carbon.DSC.psm1 index 9da4d9d..b2105c3 100644 --- a/Carbon.DSC/Carbon.DSC.psm1 +++ b/Carbon.DSC/Carbon.DSC.psm1 @@ -20,7 +20,7 @@ Set-StrictMode -Version 'Latest' # module in development has its functions in the Functions directory. $script:moduleRoot = $PSScriptRoot -$psModulesRoot = Join-Path -Path $script:moduleRoot -ChildPath 'Modules' -Resolve +$psModulesRoot = $script:moduleRoot Import-Module -Name (Join-Path -Path $psModulesRoot -ChildPath 'Carbon.Cryptography' -Resolve) ` -Function @('Get-CCertificate') ` diff --git a/Carbon.DSC/DscResources/Carbon_EnvironmentVariable/Carbon_EnvironmentVariable.psm1 b/Carbon.DSC/DscResources/Carbon_EnvironmentVariable/Carbon_EnvironmentVariable.psm1 index 3f28948..a1e46e6 100644 --- a/Carbon.DSC/DscResources/Carbon_EnvironmentVariable/Carbon_EnvironmentVariable.psm1 +++ b/Carbon.DSC/DscResources/Carbon_EnvironmentVariable/Carbon_EnvironmentVariable.psm1 @@ -10,7 +10,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -$psModulesPath = Join-Path -Path $PSScriptRoot -ChildPath '..\..\Modules' -Resolve +$psModulesPath = Join-Path -Path $PSScriptRoot -ChildPath '..\..' -Resolve Import-Module -Name (Join-Path -Path $psModulesPath -ChildPath 'Carbon' -Resolve) ` -Function @('Set-CEnvironmentVariable') diff --git a/Carbon.DSC/DscResources/Carbon_FirewallRule/Carbon_FirewallRule.psm1 b/Carbon.DSC/DscResources/Carbon_FirewallRule/Carbon_FirewallRule.psm1 index b08e14f..7623943 100644 --- a/Carbon.DSC/DscResources/Carbon_FirewallRule/Carbon_FirewallRule.psm1 +++ b/Carbon.DSC/DscResources/Carbon_FirewallRule/Carbon_FirewallRule.psm1 @@ -10,7 +10,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -$psModulesPath = Join-Path -Path $PSScriptRoot -ChildPath '..\..\Modules' -Resolve +$psModulesPath = Join-Path -Path $PSScriptRoot -ChildPath '..\..' -Resolve Import-Module -Name (Join-Path -Path $psModulesPath -ChildPath 'Carbon' -Resolve) ` -Function @('Get-CFirewallRule') diff --git a/Carbon.DSC/DscResources/Carbon_Group/Carbon_Group.psm1 b/Carbon.DSC/DscResources/Carbon_Group/Carbon_Group.psm1 index 834ea12..3f96532 100644 --- a/Carbon.DSC/DscResources/Carbon_Group/Carbon_Group.psm1 +++ b/Carbon.DSC/DscResources/Carbon_Group/Carbon_Group.psm1 @@ -10,7 +10,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -$psModulesPath = Join-Path -Path $PSScriptRoot -ChildPath '..\..\Modules' -Resolve +$psModulesPath = Join-Path -Path $PSScriptRoot -ChildPath '..\..' -Resolve Import-Module -Name (Join-Path -Path $psModulesPath -ChildPath 'Carbon' -Resolve) ` -Function @('Install-CGroup', 'Get-CGroup', 'Test-CGroup', 'Uninstall-CGroup') diff --git a/Carbon.DSC/DscResources/Carbon_IniFile/Carbon_IniFile.psm1 b/Carbon.DSC/DscResources/Carbon_IniFile/Carbon_IniFile.psm1 index 00cc244..8aa038f 100644 --- a/Carbon.DSC/DscResources/Carbon_IniFile/Carbon_IniFile.psm1 +++ b/Carbon.DSC/DscResources/Carbon_IniFile/Carbon_IniFile.psm1 @@ -10,7 +10,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -$psModulesPath = Join-Path -Path $PSScriptRoot -ChildPath '..\..\Modules' -Resolve +$psModulesPath = Join-Path -Path $PSScriptRoot -ChildPath '..\..' -Resolve Import-Module -Name (Join-Path -Path $psModulesPath -ChildPath 'Carbon' -Resolve) ` -Function @('Remove-CIniEntry', 'Set-CIniEntry', 'Split-CIni') diff --git a/Carbon.DSC/DscResources/Carbon_Permission/Carbon_Permission.psm1 b/Carbon.DSC/DscResources/Carbon_Permission/Carbon_Permission.psm1 index 3c57b88..0da659b 100644 --- a/Carbon.DSC/DscResources/Carbon_Permission/Carbon_Permission.psm1 +++ b/Carbon.DSC/DscResources/Carbon_Permission/Carbon_Permission.psm1 @@ -10,7 +10,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -$psModulesPath = Join-Path -Path $PSScriptRoot -ChildPath '..\..\Modules' -Resolve +$psModulesPath = Join-Path -Path $PSScriptRoot -ChildPath '..\..' -Resolve Import-Module -Name (Join-Path -Path $psModulesPath -ChildPath 'Carbon' -Resolve) ` -Function @( 'ConvertTo-CContainerInheritanceFlags', diff --git a/Carbon.DSC/DscResources/Carbon_Privilege/Carbon_Privilege.psm1 b/Carbon.DSC/DscResources/Carbon_Privilege/Carbon_Privilege.psm1 index 7f092f9..f91450a 100644 --- a/Carbon.DSC/DscResources/Carbon_Privilege/Carbon_Privilege.psm1 +++ b/Carbon.DSC/DscResources/Carbon_Privilege/Carbon_Privilege.psm1 @@ -10,7 +10,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -$psModulesPath = Join-Path -Path $PSScriptRoot -ChildPath '..\..\Modules' -Resolve +$psModulesPath = Join-Path -Path $PSScriptRoot -ChildPath '..\..' -Resolve Import-Module -Name (Join-Path -Path $psModulesPath -ChildPath 'Carbon.Security' -Resolve) ` -Function @('Get-CPrivilege', 'Grant-CPrivilege', 'Revoke-CPrivilege') diff --git a/Carbon.DSC/DscResources/Carbon_ScheduledTask/Carbon_ScheduledTask.psm1 b/Carbon.DSC/DscResources/Carbon_ScheduledTask/Carbon_ScheduledTask.psm1 index 75639b6..43d37f4 100644 --- a/Carbon.DSC/DscResources/Carbon_ScheduledTask/Carbon_ScheduledTask.psm1 +++ b/Carbon.DSC/DscResources/Carbon_ScheduledTask/Carbon_ScheduledTask.psm1 @@ -10,7 +10,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -$psModulesPath = Join-Path -Path $PSScriptRoot -ChildPath '..\..\Modules' -Resolve +$psModulesPath = Join-Path -Path $PSScriptRoot -ChildPath '..\..' -Resolve Import-Module -Name (Join-Path -Path $psModulesPath -ChildPath 'Carbon' -Resolve) ` -Function @( 'Get-CScheduledTask', diff --git a/Carbon.DSC/DscResources/Carbon_Service/Carbon_Service.psm1 b/Carbon.DSC/DscResources/Carbon_Service/Carbon_Service.psm1 index 5c57925..f92167b 100644 --- a/Carbon.DSC/DscResources/Carbon_Service/Carbon_Service.psm1 +++ b/Carbon.DSC/DscResources/Carbon_Service/Carbon_Service.psm1 @@ -10,7 +10,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -$psModulesPath = Join-Path -Path $PSScriptRoot -ChildPath '..\..\Modules' -Resolve +$psModulesPath = Join-Path -Path $PSScriptRoot -ChildPath '..\..' -Resolve Import-Module -Name (Join-Path -Path $psModulesPath -ChildPath 'Carbon' -Resolve) ` -Function @('Install-CService', 'Test-CService', 'Uninstall-CService' ) Import-Module -Name (Join-Path -Path $psModulesPath -ChildPath 'Carbon.Accounts' -Resolve) ` diff --git a/Carbon.DSC/prism.json b/Carbon.DSC/prism.json index a76a81e..00e8221 100644 --- a/Carbon.DSC/prism.json +++ b/Carbon.DSC/prism.json @@ -24,6 +24,5 @@ "Name": "Carbon.Security", "Version": "1.*" } - ], - "PSModulesDirectoryName": "Modules" + ] } \ No newline at end of file diff --git a/Complete-CarbonDscTest.ps1 b/Complete-CarbonDscTest.ps1 index 867c966..c7de37e 100644 --- a/Complete-CarbonDscTest.ps1 +++ b/Complete-CarbonDscTest.ps1 @@ -24,7 +24,7 @@ param( #Requires -Version 5.1 Set-StrictMode -Version 'Latest' -$psModulesPath = Join-Path -Path $PSScriptRoot -ChildPath 'Carbon.DSC\Modules' -Resolve +$psModulesPath = Join-Path -Path $PSScriptRoot -ChildPath 'Carbon.DSC' -Resolve Import-Module -Name (Join-Path -Path $psModulesPath -ChildPath 'Carbon' -Resolve) ` -Function @('Get-CPowerShellModuleInstallPath', 'Uninstall-CJunction') ` diff --git a/README.md b/README.md index 50af3ea..9ad0a1d 100644 --- a/README.md +++ b/README.md @@ -54,3 +54,23 @@ Import-Module -Name '.\Carbon.DSC' * `Start-CDscPullConfiguration`: performs a configuraiton check on a computer that is using DSC's pull refresh mode. * `Test-CDscTargetResource`: determines if a target resource is out of date compared to a desired resource. * `Write-CDscError`: takes DSC error events and writes them as PowerShell errors. + +## Developing + +We use [Whiskey](https://github.com/webmd-health-services/Whiskey/wiki) to script our builds. You can find the build +script in the whiskey.yml file. We use [AppVeyor](https://ci.appveyor.com/project/WebMD-Health-Services/carbon-dsc) to +run our builds. You can find AppVeyor script in appveyor.yml. + +To get your local environment setup, run `.\build.ps1` from an administrator PowerShell prompt. Once the Pester tests +start running, you can quit the build or wait for them to finish. A full build should take less than 10 minutes. You can +check AppVeyor to see current approximate build times. If any tests are failing, reach out to the team to help figure +out why. + +All code should have tests that are written using Pester 5. We recommend installing a global instance of the Pester 5 +PowerShell module. + +When you're developing and testing DSC resources, PowerShell expects the module containing the DSC resources to be in +the global `PSModulePath` environment variable. Use the `Start-CarbonDscTest.ps1` script to get your machine configured +so that the Carbon.DSC module you're working on gets added to PowerShell's module path. When you're done developing, +run `Complete-CarbonDscTest.ps1` to undo this configuration change. Note that a full build runs both scripts so you'll +still need to run `Start-CarbonDscTest.ps1` despite running a full build. diff --git a/Start-CarbonDscTest.ps1 b/Start-CarbonDscTest.ps1 index 42c8528..e8228e4 100644 --- a/Start-CarbonDscTest.ps1 +++ b/Start-CarbonDscTest.ps1 @@ -18,7 +18,7 @@ Import-Module -Name (Join-Path -Path $PSScriptRoot -ChildPath 'Carbon.DSC' -Reso -Function @('Clear-CDscLocalResourceCache') ` -Verbose:$false -$psModulesPath = Join-Path -Path $PSScriptRoot -ChildPath 'Carbon.DSC\Modules' -Resolve +$psModulesPath = Join-Path -Path $PSScriptRoot -ChildPath 'Carbon.DSC' -Resolve Import-Module -Name (Join-Path -Path $psModulesPath -ChildPath 'Carbon' -Resolve) ` -Function @('Get-CCimInstance', 'Get-CPowerShellModuleInstallPath', 'Install-CJunction') ` diff --git a/TODO.md b/TODO.md deleted file mode 100644 index 23dd1ba..0000000 --- a/TODO.md +++ /dev/null @@ -1,36 +0,0 @@ - -# Template-PSModules-OSS-Apache2.0-AppVeyor - -## Using This Template - -Click the "Use this template" button above. Clone the new repository. Run the `.\Initialize-Repository.ps1` script. -Pass the name of the module to the `ModuleName` parameter, the module's description to the `ModuleDescription` -parameter, and your GitHub organization URL slug to the `GitHubOrganizationName` parameter. - -The script will: - -* Rename this file to TODO.md (there are additional steps to take afterward) -* Puts the default README.md file in place. -* Rename every file that has `Carbon.DSC` in its name, replacing `Carbon.DSC` with the module name. -* Replaces `Carbon.DSC` in every file with the module name. -* Installs and enables [Whiskey](https://github.com/webmd-health-services/Whiskey/wiki). -* Removes this script. -* If Git is installed, adds all the changes, and amends the initial commit with them so all traces of the template are - removed. - -## Manual Steps - -Things you'll still need to do after creating your repository: - -* Turn on branch protections. -* Create a build in AppVeyor. -* Create a feature branch. -* Commit and push your new branch. A build should run in AppVeyor and finish successfully after a minute or so. The -default build will run using: - * Windows PowerShell 5.1/.NET 4.6.2 - * Windows PowerShell 5.1/.NET 4.8 - * PowerShell 6.2 on Windows - * PowerShell 7.1 on Windows - * PowerShell 7.2 on Windows - * PowerShell 7.1 on macOS - * PowerShell 7.2 on Ubuntu diff --git a/Tests/Carbon_FirewallRule.Tests.ps1 b/Tests/Carbon_FirewallRule.Tests.ps1 index f9d550a..9b6c2f6 100644 --- a/Tests/Carbon_FirewallRule.Tests.ps1 +++ b/Tests/Carbon_FirewallRule.Tests.ps1 @@ -7,7 +7,7 @@ BeforeAll { & (Join-Path -Path $PSScriptRoot -ChildPath 'Initialize-Test.ps1' -Resolve) - $psModulesPath = Join-Path -Path $PSScriptRoot -ChildPath '..\Carbon.DSC\Modules' -Resolve + $psModulesPath = Join-Path -Path $PSScriptRoot -ChildPath '..\Carbon.DSC' -Resolve Import-Module -Name (Join-Path -Path $psModulesPath -ChildPath 'Carbon' -Resolve) ` -Function @('Get-CFirewallRule') ` -Verbose:$false diff --git a/Tests/Carbon_Group.Tests.ps1 b/Tests/Carbon_Group.Tests.ps1 index ce140d7..021f7ec 100644 --- a/Tests/Carbon_Group.Tests.ps1 +++ b/Tests/Carbon_Group.Tests.ps1 @@ -7,7 +7,7 @@ BeforeAll { & (Join-Path -Path $PSScriptRoot -ChildPath 'Initialize-Test.ps1' -Resolve) - $psModulesPath = Join-Path -Path $PSScriptRoot -ChildPath '..\Carbon.DSC\Modules' -Resolve + $psModulesPath = Join-Path -Path $PSScriptRoot -ChildPath '..\Carbon.DSC' -Resolve Import-Module -Name (Join-Path -Path $psModulesPath -ChildPath 'Carbon' -Resolve) ` -Function @('Get-CGroup', 'Install-CUser', 'Install-CGroup', 'Test-CGroup') ` -Verbose:$false diff --git a/Tests/Carbon_IniFile.Tests.ps1 b/Tests/Carbon_IniFile.Tests.ps1 index aeb7de3..cb592c8 100644 --- a/Tests/Carbon_IniFile.Tests.ps1 +++ b/Tests/Carbon_IniFile.Tests.ps1 @@ -7,7 +7,7 @@ BeforeAll { & (Join-Path -Path $PSScriptRoot -ChildPath 'Initialize-Test.ps1' -Resolve) - $psModulesPath = Join-Path -Path $PSScriptRoot -ChildPath '..\Carbon.DSC\Modules' -Resolve + $psModulesPath = Join-Path -Path $PSScriptRoot -ChildPath '..\Carbon.DSC' -Resolve Import-Module -Name (Join-Path -Path $psModulesPath -ChildPath 'Carbon' -Resolve) ` -Function @('Split-CIni') ` -Verbose:$false diff --git a/Tests/Carbon_Permission.Tests.ps1 b/Tests/Carbon_Permission.Tests.ps1 index ae62d57..487f640 100644 --- a/Tests/Carbon_Permission.Tests.ps1 +++ b/Tests/Carbon_Permission.Tests.ps1 @@ -7,7 +7,7 @@ BeforeAll { & (Join-Path -Path $PSScriptRoot -ChildPath 'Initialize-Test.ps1' -Resolve) - $psModulesPath = Join-Path -Path $PSScriptRoot -ChildPath '..\Carbon.DSC\Modules' -Resolve + $psModulesPath = Join-Path -Path $PSScriptRoot -ChildPath '..\Carbon.DSC' -Resolve Import-Module -Name (Join-Path -Path $psModulesPath -ChildPath 'Carbon' -Resolve) ` -Function @( 'Get-CPermission', diff --git a/Tests/Carbon_Privilege.Tests.ps1 b/Tests/Carbon_Privilege.Tests.ps1 index d228abe..2a1f2c9 100644 --- a/Tests/Carbon_Privilege.Tests.ps1 +++ b/Tests/Carbon_Privilege.Tests.ps1 @@ -7,7 +7,7 @@ BeforeAll { & (Join-Path -Path $PSScriptRoot -ChildPath 'Initialize-Test.ps1' -Resolve) - $psModulesPath = Join-Path -Path $PSScriptRoot -ChildPath '..\Carbon.DSC\Modules' -Resolve + $psModulesPath = Join-Path -Path $PSScriptRoot -ChildPath '..\Carbon.DSC' -Resolve Import-Module -Name (Join-Path -Path $psModulesPath -ChildPath 'Carbon' -Resolve) ` -Function @('Install-CUser') ` -Verbose:$false diff --git a/Tests/Carbon_ScheduledTask.Tests.ps1 b/Tests/Carbon_ScheduledTask.Tests.ps1 index 6712b27..0e3a76d 100644 --- a/Tests/Carbon_ScheduledTask.Tests.ps1 +++ b/Tests/Carbon_ScheduledTask.Tests.ps1 @@ -18,7 +18,7 @@ BeforeAll { & (Join-Path -Path $PSScriptRoot -ChildPath 'Initialize-Test.ps1' -Resolve) - $psModulesPath = Join-Path -Path $PSScriptRoot -ChildPath '..\Carbon.DSC\Modules' -Resolve + $psModulesPath = Join-Path -Path $PSScriptRoot -ChildPath '..\Carbon.DSC' -Resolve Import-Module -Name (Join-Path -Path $psModulesPath -ChildPath 'Carbon' -Resolve) ` -Function @( 'Get-CScheduledTask', diff --git a/Tests/Carbon_Service.Tests.ps1 b/Tests/Carbon_Service.Tests.ps1 index b921036..c0b0a34 100644 --- a/Tests/Carbon_Service.Tests.ps1 +++ b/Tests/Carbon_Service.Tests.ps1 @@ -7,7 +7,7 @@ BeforeAll { & (Join-Path -Path $PSScriptRoot -ChildPath 'Initialize-Test.ps1' -Resolve) - $psModulesPath = Join-Path -Path $PSScriptRoot -ChildPath '..\Carbon.DSC\Modules' -Resolve + $psModulesPath = Join-Path -Path $PSScriptRoot -ChildPath '..\Carbon.DSC' -Resolve Import-Module -Name (Join-Path -Path $psModulesPath -ChildPath 'Carbon' -Resolve) ` -Function @('Install-CUser', 'Uninstall-CService') ` -Verbose:$false diff --git a/Tests/Initialize-CLcm.Tests.ps1 b/Tests/Initialize-CLcm.Tests.ps1 index 5b17664..db9fc73 100644 --- a/Tests/Initialize-CLcm.Tests.ps1 +++ b/Tests/Initialize-CLcm.Tests.ps1 @@ -7,7 +7,7 @@ BeforeAll { & (Join-Path -Path $PSScriptRoot -ChildPath 'Initialize-Test.ps1' -Resolve) - $modulesPath = Join-Path -Path $PSScriptRoot -ChildPath '..\Carbon.DSC\Modules' -Resolve + $modulesPath = Join-Path -Path $PSScriptRoot -ChildPath '..\Carbon.DSC' -Resolve Import-Module -Name (Join-Path -Path $modulesPath -ChildPath 'Carbon.Cryptography' -Resolve) ` -Function @('Get-CCertificate', 'Uninstall-CCertificate') ` -Verbose:$false diff --git a/Tests/Initialize-Test.ps1 b/Tests/Initialize-Test.ps1 index 493f1fa..9dd5c98 100644 --- a/Tests/Initialize-Test.ps1 +++ b/Tests/Initialize-Test.ps1 @@ -58,7 +58,7 @@ finally $Global:WhatIfPreference = $originalWhatIfPref } -$psModulesPath = Join-Path -Path $PSScriptRoot -ChildPath '..\Carbon.DSC\Modules' -Resolve +$psModulesPath = Join-Path -Path $PSScriptRoot -ChildPath '..\Carbon.DSC' -Resolve Import-Module -Name (Join-Path -Path $psModulesPath -ChildPath 'Carbon' -Resolve) ` -Function @('Install-CUser', 'Test-CUser') `