|
8 | 8 | )
|
9 | 9 | begin {
|
10 | 10 | $strModuleName = "vNugglets.VDNetworking"
|
11 |
| - ## some code to generate the module manifest |
12 |
| - $strFilespecForPsd1 = "$PSScriptRoot\$strModuleName\${strModuleName}.psd1" |
| 11 | + $strModuleFolderFilespec = "$PSScriptRoot\$strModuleName" |
| 12 | + $strFilespecForPsd1 = Join-Path $strModuleFolderFilespec "${strModuleName}.psd1" |
13 | 13 |
|
14 |
| - $hshModManifestParams = @{ |
| 14 | + ## parameters for use by both New-ModuleManifest and Update-ModuleManifest |
| 15 | + $hshManifestParams = @{ |
15 | 16 | # Confirm = $true
|
16 | 17 | Path = $strFilespecForPsd1
|
17 |
| - ModuleVersion = "1.0.0" |
| 18 | + ModuleVersion = "1.1.0" |
18 | 19 | Author = "Matt Boren (@mtboren)"
|
19 | 20 | CompanyName = 'vNugglets for the VMware PowerCLI community'
|
20 | 21 | Copyright = "MIT License"
|
21 | 22 | Description = "Module with functions for managing VMware vSphere Virtual Distributed Networking components like traffic filtering and marking"
|
22 | 23 | # AliasesToExport = @()
|
23 |
| - FileList = Write-Output "${strModuleName}.psd1" "${strModuleName}_ModRoot.psm1" "en-US\about_${strModuleName}.help.txt" GetItems.ps1 NewItems.ps1 RemoveItems.ps1 SetItems.ps1 "${strModuleName}_SupportingFunctions.ps1" "${strModuleName}.format.ps1xml" |
| 24 | + FileList = Write-Output "${strModuleName}.psd1" "${strModuleName}_ModRoot.psm1" "en-US\about_${strModuleName}.help.txt" GetItems.ps1 NewItems.ps1 RemoveItems.ps1 SetItems.ps1 "${strModuleName}_SupportingFunctions.ps1" "${strModuleName}.format.ps1xml" "${strModuleName}_init.ps1" "${strModuleName}_ClassDefinition.ps1" |
24 | 25 | FormatsToProcess = "${strModuleName}.format.ps1xml"
|
25 | 26 | FunctionsToExport = Write-Output Get-VNVDTrafficFilterPolicyConfig Get-VNVDTrafficRuleSet Get-VNVDTrafficRule Get-VNVDTrafficRuleQualifier Get-VNVDTrafficRuleAction New-VNVDTrafficRuleQualifier New-VNVDTrafficRuleAction New-VNVDTrafficRule Remove-VNVDTrafficRule Set-VNVDTrafficRuleSet
|
26 | 27 | IconUri = "https://avatars0.githubusercontent.com/u/10615837"
|
27 | 28 | LicenseUri = "https://github.com/vNugglets/vNuggletsPSMod_vDNetworking/blob/master/License"
|
28 | 29 | NestedModules = Write-Output GetItems.ps1 NewItems.ps1 RemoveItems.ps1 SetItems.ps1 "${strModuleName}_SupportingFunctions.ps1"
|
29 | 30 | PowerShellVersion = [System.Version]"5.0"
|
30 | 31 | ProjectUri = "https://github.com/vNugglets/vNuggletsPSMod_vDNetworking"
|
31 |
| - ReleaseNotes = "See release notes at https://github.com/vNugglets/vNuggletsPSMod_vDNetworking/blob/master/ChangeLog.md" |
| 32 | + ReleaseNotes = "See ReadMe and other docs at https://github.com/vNugglets/vNuggletsPSMod_vDNetworking" |
| 33 | + RequiredModules = "VMware.VimAutomation.Vds" |
32 | 34 | RootModule = "${strModuleName}_ModRoot.psm1"
|
33 |
| - ScriptsToProcess = "${strModuleName}_ClassDefinition.ps1" |
| 35 | + ScriptsToProcess = "${strModuleName}_init.ps1", "${strModuleName}_ClassDefinition.ps1" |
34 | 36 | Tags = Write-Output vNugglets VMware vSphere PowerCLI VDPortGroup TrafficFiltering Filter Filtering TrafficMarking Mark Marking VDSwitch
|
35 | 37 | # Verbose = $true
|
36 | 38 | } ## end hashtable
|
| 39 | + |
| 40 | + # $hshUpdateManifestParams = @{ |
| 41 | + # ## modules that are external to this module and that this module requires; per help, "Specifies an array of external module dependencies" |
| 42 | + # ExternalModuleDependencies = VMware.VimAutomation.Vds |
| 43 | + # } |
37 | 44 | } ## end begin
|
38 | 45 |
|
39 | 46 | process {
|
40 | 47 | $bManifestFileAlreadyExists = Test-Path $strFilespecForPsd1
|
| 48 | + ## check that the FileList property holds the names of all of the files in the module directory, relative to the module directory |
| 49 | + ## the relative names of the files in the module directory (just filename for those in module directory, "subdir\filename.txt" for a file in a subdir, etc.) |
| 50 | + $arrRelativeNameOfFilesInModuleDirectory = Get-ChildItem $strModuleFolderFilespec -Recurse | Where-Object {-not $_.PSIsContainer} | ForEach-Object {$_.FullName.Replace($strModuleFolderFilespec, "").TrimStart("\")} |
| 51 | + if ($null -eq (Compare-Object -ReferenceObject $hshManifestParams.FileList -DifferenceObject $arrRelativeNameOfFilesInModuleDirectory)) {Write-Verbose -Verbose "Hurray, all of the files in the module directory are named in the FileList property to use for the module manifest"} else {Write-Error "Uh-oh -- FileList property value for making/updating module manifest and actual files present in module directory do not match. Better check that."} |
41 | 52 | $strMsgForShouldProcess = "{0} module manifest" -f $(if ((-not $bManifestFileAlreadyExists) -or $Recreate) {"Create"} else {"Update"})
|
42 | 53 | if ($PsCmdlet.ShouldProcess($strFilespecForPsd1, $strMsgForShouldProcess)) {
|
43 | 54 | ## do the actual module manifest creation/update
|
44 |
| - if ((-not $bManifestFileAlreadyExists) -or $Recreate) {Microsoft.PowerShell.Core\New-ModuleManifest @hshModManifestParams} |
45 |
| - else {PowerShellGet\Update-ModuleManifest @hshModManifestParams} |
| 55 | + if ((-not $bManifestFileAlreadyExists) -or $Recreate) {Microsoft.PowerShell.Core\New-ModuleManifest @hshManifestParams} |
| 56 | + else {PowerShellGet\Update-ModuleManifest @hshManifestParams} |
46 | 57 | ## replace the comment in the resulting module manifest that includes "PSGet_" prefixed to the actual module name with a line without "PSGet_" in it
|
47 | 58 | (Get-Content -Path $strFilespecForPsd1 -Raw).Replace("# Module manifest for module 'PSGet_$strModuleName'", "# Module manifest for module '$strModuleName'") | Set-Content -Path $strFilespecForPsd1
|
48 | 59 | } ## end if
|
|
0 commit comments