Skip to content

Commit 69cb743

Browse files
authored
Bump minor version to 24, improve local setup (undo-local) reliability, update module version format logic, and enhance module removal checks, complete round of work to optimize build for local testing (run Local.ps1 for quick testing, Local.ps1 -Package -Analyze for pre PR test of packaging, etc) (#41)
1 parent e02361c commit 69cb743

File tree

5 files changed

+44
-20
lines changed

5 files changed

+44
-20
lines changed

Build.ps1

+7-7
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ param (
1414

1515
[Parameter()]
1616
[Int16]
17-
$minorVersion = 23,
17+
$minorVersion = 24,
1818

1919
[Parameter()]
2020
[Int16]
@@ -54,14 +54,14 @@ Process {
5454
Push-Location src/AzKube
5555

5656
# Increment the module version to the format yymmdd.hhmm.ss
57-
if ($Package) {
57+
# if ($Package) {
5858
$moduleVersion = $("$majorVersion.$minorVersion.$patchVersion")
59-
}
60-
else {
61-
$moduleVersion = $(Get-Date).ToString('yyMMdd.HHmm.ss')
62-
}
59+
# }
60+
# else {
61+
# $moduleVersion = $(Get-Date).ToString('yyMMdd.HHmm.ss')
62+
# }
6363
# $moduleVersion = $("$majorVersion.$minorVersion.$patchVersion+$((Get-Date).ToString('yyMMdd.HHmm.ss'))")
64-
Write-Host "Incrementing module version to $moduleVersion"
64+
Write-Host "Setting module version to $moduleVersion"
6565

6666

6767
# Create the module manifest

Undo-Local.ps1

+21-4
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,19 @@
33
# .\Undo-Local.ps1
44
#
55

6+
$nugetRepoPath = "$PSScriptRoot\src\AzKube\NuGetRepo"
7+
68
# Remove the module from the local repository
79
if (Get-Module -Name AzKube) {
810
Remove-Module -Name AzKube -Force
911

1012
# Verify the module is removed
11-
Get-Module -Name AzKube
13+
if (!(Get-Module -Name AzKube -ErrorAction SilentlyContinue)) {
14+
Write-Host "The AzKube module has been removed"
15+
}
16+
else {
17+
Write-Host "The AzKube module has not been removed"
18+
}
1219
}
1320

1421
# Uninstall the module
@@ -22,11 +29,21 @@ Unregister-PSRepository -Name AzKubeRepo -ErrorAction SilentlyContinue
2229
Push-Location $PSScriptRoot
2330

2431
# Remove the NuGet repository
25-
Remove-Item -Path ./src/AzKube/NuGetRepo -Force -Recurse
32+
if (Test-Path $nugetRepoPath) {
33+
Remove-Item -Path $nugetRepoPath -Force -Recurse
34+
}
2635

2736
# Remove the module from the PSModulePath
28-
$path = (Resolve-Path '.').Path
37+
$path = (Resolve-Path './src/AzKube').Path
38+
$path
2939
if ($env:PSModulePath -like "*$path*") {
30-
$env:PSModulePath = $env:PSModulePath -replace ";$path", ""
40+
$escapedAzKubePath = $path -replace "\\", "\\\\\\\\"
41+
$escapedAzKubePath
42+
$escapedPSModulePath = $env:PSModulePath -replace "\\", "\\\\"
43+
$removedPath = $escapedPSModulePath -replace ";$escapedAzKubePath", ""
44+
$removedPath
45+
if ($removedPath -ne '') {
46+
$env:PSModulePath = $removedPath -replace "\\\\\\\\", "\"
47+
}
3148
}
3249
Pop-Location

src/AzKube/AzKube.psd1

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
RootModule = './AzKube.psm1'
1313

1414
# Version number of this module.
15-
ModuleVersion = '0.22.0'
15+
ModuleVersion = '0.24.0'
1616

1717
# Supported PSEditions
1818
# CompatiblePSEditions = @()
@@ -101,7 +101,7 @@ PrivateData = @{
101101
# LicenseUri = ''
102102

103103
# A URL to the main website for this project.
104-
# ProjectUri = ''
104+
ProjectUri = 'https://github.com/dmealo/AzKube'
105105

106106
# A URL to an icon representing this module.
107107
# IconUri = ''
@@ -120,10 +120,10 @@ PrivateData = @{
120120

121121
} # End of PSData hashtable
122122

123-
} # End of PrivateData hashtable
123+
} # End of PrivateData hashtable
124124

125125
# HelpInfo URI of this module
126-
# HelpInfoURI = ''
126+
HelpInfoURI = 'https://github.com/dmealo/AzKube/README.md'
127127

128128
# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix.
129129
# DefaultCommandPrefix = ''

src/AzKube/private/Aks-Utilities.ps1

+2-2
Original file line numberDiff line numberDiff line change
@@ -111,16 +111,16 @@ function Install-AzModule {
111111

112112
# Install PSMenu if not already installed
113113
function Install-PSMenu {
114-
Write-Host "Installing PSMenu module..."
115114
if (-not (Get-Command Show-Menu -ErrorAction SilentlyContinue)) {
115+
Write-Host "Installing PSMenu module..."
116116
Install-Module -Name PSMenu -Force
117117
}
118118
}
119119

120120
# Function to install kubectl using WinGet if not already installed
121121
function Install-Kubectl {
122-
Write-Host "Installing kubectl using WinGet..."
123122
if (-not (Get-Command kubectl -ErrorAction SilentlyContinue)) {
123+
Write-Host "Installing kubectl using WinGet..."
124124
winget install --id Kubernetes.kubectl -e
125125
}
126126
}

src/AzKube/public/Set-AksClusters.ps1

+10-3
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,20 @@ function Set-AksClusters {
3535
$SkipTestActions
3636
)
3737

38+
Clear-Host
39+
40+
$appTitle = "AzKube"
41+
$Title = " | Starting..."
42+
3843
. "$PSScriptRoot\..\private\Aks-Utilities.ps1"
3944
. "$PSScriptRoot\..\private\Aks-Ui-Utilities.ps1"
4045

4146
$ProxyUrl = Get-DefaultProxyUrl -ProxyUrl $ProxyUrl
4247

48+
Write-Host
49+
Write-Host $appTitle -ForegroundColor Blue -NoNewline
50+
Write-Host $Title -ForegroundColor Cyan
51+
4352
Install-AzureCli
4453
Install-PsMenu
4554

@@ -48,9 +57,6 @@ function Set-AksClusters {
4857
do {
4958
# Create and use a new TenantList object to get all tenants
5059
Clear-Host
51-
Write-Host
52-
Write-Host "Loading interface..." -ForegroundColor Cyan
53-
Clear-Host
5460
if ($global:SelectedTenant) {
5561
# Use the saved tenant to initialize your tenant list
5662
$tenant.SelectedTenant = $global:SelectedTenant
@@ -62,6 +68,7 @@ function Set-AksClusters {
6268
$global:SelectedTenant = $tenant.SelectedTenant
6369
}
6470
}
71+
6572
# Display or select tenant if not already set
6673
$tenant.DisplaySelectedTenant()
6774

0 commit comments

Comments
 (0)