Skip to content

Commit 2280fdf

Browse files
committed
update items in preparation for next release, and for publishing to PowerShellGallery
1 parent 743bfb4 commit 2280fdf

File tree

6 files changed

+133
-64
lines changed

6 files changed

+133
-64
lines changed

ChangeLog.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
### ChangeLog for vNugglets.Utility PowerShell module
22

3-
#### v1.next, not yet released
3+
#### v1.2, not yet released
44

55
- \[improvement] updated function `Get-VNVMByAddress`:
66
- greatly increased speed by using `VMware.Vim.SearchIndex` for by-IP searches (does support wildcard, though -- by wildcard still uses slower mechanism); example speed increase: went from 13s to about 0.25s in a vCenter with about 7,500 VMs -- woo-hoo!
@@ -9,6 +9,7 @@
99
- takes new parameter, `-SourceRole`, for passing VIRole object itself as value, and this parameter accepts value from pipeline, for more natural use of cmdlet
1010
- deduces source vCenter server from `-SourceRole` value, simplifying use of cmdlet (no need to specify `-SourceVCName` parameter when providing the source VIRole object)
1111
- `-DestinationVCName` parameter now optional, further simplifying use of cmdlet; if parameter not specified, destination vCenter will be the same as the source vCenter
12+
- \[internal improvement] updated to using `Update-ModuleManifest` for keeping module manifest in shape, added manifest entries for tags and for URIs for project, release notes, license, etc. (partially in preparation for publishing to the [PowerShellGallery](https://www.powershellgallery.com/))
1213

1314

1415
#### v1.1, released 20 Dec 2016

License

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2016 vNugglets
3+
Copyright (c) since 2016, vNugglets
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

Update-VNModuleManifest.ps1

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<# .Description
2+
Some code to help automate the updating of the ModuleManifest file
3+
#>
4+
[CmdletBinding(SupportsShouldProcess=$true)]
5+
param()
6+
begin {
7+
## some code to generate the module manifest
8+
$strFilespecForPsd1 = "$PSScriptRoot\vNugglets.Utility\vNugglets.Utility.psd1"
9+
10+
$hshModManifestParams = @{
11+
# Confirm = $true
12+
Path = $strFilespecForPsd1
13+
ModuleVersion = "1.2.0"
14+
Description = "Module with the super useful functions that were previously scattered about the web by the vNugglets team (particularly, at vNugglets.com)"
15+
## some aliases, both as written, and with "VN" prefixed on them
16+
AliasesToExport = Write-Output ConnVIServer DisconnVIServer | Foreach-Object {$_; "VN$_"}
17+
FileList = Write-Output vNugglets.Utility.psd1 vNuggletsUtilityMod.psm1 vNuggletsUtilityMod_functions.ps1, vNugglets_SupportingFunctions.ps1, en-US\about_vNugglets.Utility.help.txt
18+
FunctionsToExport = Write-Output Connect-VNVIServer Copy-VNVIRole Disconnect-VNVIServer Find-VNVMWithDuplicateMACAddress Get-VNNetworkClusterInfo Get-VNUplinkNicForVM Get-VNVMByAddress Get-VNVMByRDM Get-VNVMByVirtualPortGroup Get-VNVMDiskAndRDM Get-VNVMEVCInfo Get-VNVMHostBrokenUplink Get-VNVMHostFirmwareInfo Get-VNVMHostHBAWWN Get-VNVMHostLogicalVolumeInfo Get-VNVMHostNICFirmwareAndDriverInfo Invoke-VNEvacuateDatastore Move-VNTemplateFromVMHost Update-VNTitleBarForPowerCLI
19+
IconUri = "http://static.vnugglets.com/imgs/vNuggletsLogo.jpg"
20+
LicenseUri = "https://github.com/vNugglets/vNuggletsPSMod/blob/master/License"
21+
# PassThru = $true
22+
ProjectUri = "https://github.com/vNugglets/vNuggletsPSMod"
23+
ReleaseNotes = "See release notes at https://github.com/vNugglets/vNuggletsPSMod/blob/master/ChangeLog.md"
24+
Tags = Write-Output vNugglets vNugglets.com "VMware vSphere" FaF PowerCLI VIRole "MAC Address" VM RDM vPG "Virtual Portgroup" EVC VMHost HBA Datastore
25+
Verbose = $true
26+
} ## end hashtable
27+
} ## end begin
28+
29+
process {
30+
## do the actual module manifest update
31+
PowerShellGet\Update-ModuleManifest @hshModManifestParams
32+
## replace the comment in the resulting module manifest that includes "PSGet_" prefixed to the actual module name with a line without "PSGet_" in it
33+
(Get-Content -Path $strFilespecForPsd1 -Raw).Replace("# Module manifest for module 'PSGet_vNugglets.Utility'", "# Module manifest for module 'vNugglets.Utility'") | Set-Content -Path $strFilespecForPsd1
34+
} ## end prcoess
35+
36+
37+
<#
38+
## used for original manifest creation
39+
$hshModManifestParams = @{
40+
Path = $strFilespecForPsd1
41+
Author = "Matt Boren"
42+
CompanyName = "vNugglets.com"
43+
Copyright = "MIT License"
44+
## when setting value for DefaultCommandPrefix in module, need to account for that when setting value for Aliases anywhere (need to code those to point at what the functions _will_ be called when the DefaultCommandPrefix is applied)
45+
#DefaultCommandPrefix = ""
46+
#FormatsToProcess = "SomeModule.format.ps1xml"
47+
ModuleToProcess = "vNuggletsUtilityMod.psm1"
48+
ModuleVersion = "1.1.0"
49+
## scripts (.ps1) that are listed in the NestedModules key are run in the module's session state, not in the caller's session state. To run a script in the caller's session state, list the script file name in the value of the ScriptsToProcess key in the manifest
50+
NestedModules = @("vNuggletsUtilityMod_functions.ps1", "vNugglets_SupportingFunctions.ps1")
51+
PowerShellVersion = [System.Version]"4.0"
52+
Description = "Module with the functions that have previously been scattered about the web by the vNugglets team (particularly, at vNugglets.com"
53+
## specifies script (.ps1) files that run in the caller's session state when the module is imported. You can use these scripts to prepare an environment, just as you might use a login script
54+
# ScriptsToProcess = "New-HtmlReport_configItems.ps1"
55+
VariablesToExport = @()
56+
AliasesToExport = @()
57+
CmdletsToExport = @()
58+
FileList = Write-Output vNugglets.Utility.psd1 vNuggletsUtilityMod.psm1 vNuggletsUtilityMod_functions.ps1, vNugglets_SupportingFunctions.ps1, about_vNugglets.Utility.help.txt
59+
Verbose = $true
60+
}
61+
## using -PassThru so as to pass the generated module manifest contents to a var for later output as ASCII (instead of having a .psd1 file of default encoding, Unicode)
62+
$oManifestOutput = New-ModuleManifest @hshModManifestParams -PassThru
63+
## have to do in separate step, as PSD1 file is "being used by another process" -- the New-ModuleManifest cmdlet, it seems
64+
# in order to have this module usable (importable) via PowerShell v2, need to update the newly created .psd1 file, replacing the 'RootModule' keyword with 'ModuleToProcess'
65+
# ($oManifestOutput -split "`n" | Foreach-Object {$_ -replace "^RootModule = ", "ModuleToProcess = "}) -join "`n" | Out-File -Verbose -FilePath $strFilespecForPsd1 -Encoding ASCII
66+
$oManifestOutput | Out-File -Verbose $strFilespecForPsd1 -Encoding ASCII
67+
#>

makeModule.ps1

Lines changed: 0 additions & 31 deletions
This file was deleted.

vNugglets.Utility/vNugglets.Utility.psd1

Lines changed: 56 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
# Generated by: Matt Boren
55
#
6-
# Generated on: 12/6/2016
6+
# Generated on: 6/16/2017
77
#
88

99
@{
@@ -12,7 +12,10 @@
1212
RootModule = 'vNuggletsUtilityMod.psm1'
1313

1414
# Version number of this module.
15-
ModuleVersion = '1.1.0'
15+
ModuleVersion = '1.2.0'
16+
17+
# Supported PSEditions
18+
# CompatiblePSEditions = @()
1619

1720
# ID used to uniquely identify this module
1821
GUID = 'a22ca8fe-3739-463f-b8dd-4d5d2c9ffec4'
@@ -27,7 +30,7 @@ CompanyName = 'vNugglets.com'
2730
Copyright = 'MIT License'
2831

2932
# Description of the functionality provided by this module
30-
Description = 'Module with the functions that have previously been scattered about the web by the vNugglets team (particularly, at vNugglets.com'
33+
Description = 'Module with the super useful functions that were previously scattered about the web by the vNugglets team (particularly, at vNugglets.com)'
3134

3235
# Minimum version of the Windows PowerShell engine required by this module
3336
PowerShellVersion = '4.0'
@@ -38,10 +41,10 @@ PowerShellVersion = '4.0'
3841
# Minimum version of the Windows PowerShell host required by this module
3942
# PowerShellHostVersion = ''
4043

41-
# Minimum version of Microsoft .NET Framework required by this module
44+
# Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
4245
# DotNetFrameworkVersion = ''
4346

44-
# Minimum version of the common language runtime (CLR) required by this module
47+
# Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
4548
# CLRVersion = ''
4649

4750
# Processor architecture (None, X86, Amd64) required by this module
@@ -63,20 +66,31 @@ PowerShellVersion = '4.0'
6366
# FormatsToProcess = @()
6467

6568
# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess
66-
NestedModules = @('vNuggletsUtilityMod_functions.ps1',
67-
'vNugglets_SupportingFunctions.ps1')
68-
69-
# Functions to export from this module
70-
FunctionsToExport = '*'
71-
72-
# Cmdlets to export from this module
73-
# CmdletsToExport = @()
69+
# NestedModules = @()
70+
71+
# Functions 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 functions to export.
72+
FunctionsToExport = 'Connect-VNVIServer', 'Copy-VNVIRole', 'Disconnect-VNVIServer',
73+
'Find-VNVMWithDuplicateMACAddress', 'Get-VNNetworkClusterInfo',
74+
'Get-VNUplinkNicForVM', 'Get-VNVMByAddress', 'Get-VNVMByRDM',
75+
'Get-VNVMByVirtualPortGroup', 'Get-VNVMDiskAndRDM', 'Get-VNVMEVCInfo',
76+
'Get-VNVMHostBrokenUplink', 'Get-VNVMHostFirmwareInfo',
77+
'Get-VNVMHostHBAWWN', 'Get-VNVMHostLogicalVolumeInfo',
78+
'Get-VNVMHostNICFirmwareAndDriverInfo',
79+
'Invoke-VNEvacuateDatastore', 'Move-VNTemplateFromVMHost',
80+
'Update-VNTitleBarForPowerCLI'
81+
82+
# 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.
83+
CmdletsToExport = @()
7484

7585
# Variables to export from this module
7686
# VariablesToExport = @()
7787

78-
# Aliases to export from this module
79-
# AliasesToExport = @()
88+
# 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.
89+
AliasesToExport = 'ConnVIServer', 'VNConnVIServer', 'DisconnVIServer',
90+
'VNDisconnVIServer'
91+
92+
# DSC resources to export from this module
93+
# DscResourcesToExport = @()
8094

8195
# List of all modules packaged with this module
8296
# ModuleList = @()
@@ -85,10 +99,34 @@ FunctionsToExport = '*'
8599
FileList = 'vNugglets.Utility.psd1', 'vNuggletsUtilityMod.psm1',
86100
'vNuggletsUtilityMod_functions.ps1',
87101
'vNugglets_SupportingFunctions.ps1',
88-
'about_vNugglets.Utility.help.txt'
102+
'en-US\about_vNugglets.Utility.help.txt'
103+
104+
# 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.
105+
PrivateData = @{
106+
107+
PSData = @{
108+
109+
# Tags applied to this module. These help with module discovery in online galleries.
110+
Tags = 'vNugglets','vNugglets.com','VMware vSphere','FaF','PowerCLI','VIRole','MAC Address','VM','RDM','vPG','Virtual Portgroup','EVC','VMHost','HBA','Datastore'
111+
112+
# A URL to the license for this module.
113+
LicenseUri = 'https://github.com/vNugglets/vNuggletsPSMod/blob/master/License'
114+
115+
# A URL to the main website for this project.
116+
ProjectUri = 'https://github.com/vNugglets/vNuggletsPSMod'
117+
118+
# A URL to an icon representing this module.
119+
IconUri = 'http://static.vnugglets.com/imgs/vNuggletsLogo.jpg'
120+
121+
# ReleaseNotes of this module
122+
ReleaseNotes = 'See release notes at https://github.com/vNugglets/vNuggletsPSMod/blob/master/ChangeLog.md'
123+
124+
# External dependent modules of this module
125+
# ExternalModuleDependencies = ''
89126

90-
# Private data to pass to the module specified in RootModule/ModuleToProcess
91-
# PrivateData = ''
127+
} # End of PSData hashtable
128+
129+
} # End of PrivateData hashtable
92130

93131
# HelpInfo URI of this module
94132
# HelpInfoURI = ''
Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
## dot-source the config items file
2-
#. $PSScriptRoot\configItems.ps1
3-
41
## Set aliases; when setting value for DefaultCommandPrefix in module, need to account for that when setting value for Alias here (value needs to be of what the final function name will be with that DefaultCommandPrefix)
52
$hshNewAliasInfo = @{
63
## Connect and Disconnect VIServer
@@ -13,14 +10,11 @@ $arrAliasNamesToExport = $hshNewAliasInfo.GetEnumerator() | Foreach-Object {
1310
$strNameThisAlias,"VN$strNameThisAlias" | Foreach-Object {if (-not (Get-Alias -Name $_ -ErrorAction:SilentlyContinue)) {New-Alias -Name $_ -Value $strValueThisAlias; $_}}
1411
} ## end foreach-object
1512

16-
## export these items for use by consumer
17-
$hshModuleMemberParams = @{
18-
Function = Write-Output Connect-VNVIServer, Copy-VNVIRole, Disconnect-VNVIServer, Find-VNVMWithDuplicateMACAddress,
19-
Get-VNNetworkClusterInfo, Get-VNUplinkNicForVM, Get-VNVMByAddress, Get-VNVMByRDM, Get-VNVMByVirtualPortGroup, Get-VNVMDiskAndRDM, Get-VNVMEVCInfo,
20-
Get-VNVMHostBrokenUplink, Get-VNVMHostFirmwareInfo, Get-VNVMHostHBAWWN, Get-VNVMHostLogicalVolumeInfo, Get-VNVMHostNICFirmwareAndDriverInfo,
21-
Invoke-VNEvacuateDatastore, Move-VNTemplateFromVMHost, Update-VNTitleBarForPowerCLI
22-
Alias = $arrAliasNamesToExport
23-
} ## end hsh
13+
## now handled in module manifest
14+
# ## export these items for use by consumer
15+
# $hshModuleMemberParams = @{
16+
# Alias = $arrAliasNamesToExport
17+
# } ## end hsh
2418

25-
## do the actual member export
26-
Export-ModuleMember @hshModuleMemberParams
19+
# ## do the actual member export
20+
# Export-ModuleMember @hshModuleMemberParams

0 commit comments

Comments
 (0)