Skip to content

Commit 943871a

Browse files
author
devizer
committed
Resolve name conflicts [skip ci]
1 parent 3271763 commit 943871a

2 files changed

Lines changed: 100 additions & 11 deletions

File tree

Install-SqlServer-Version-Management.ps1

Lines changed: 70 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Param(
44
)
55

66
$ModuleName = 'SqlServer-Version-Management';
7-
$ModuleVersion = '2.1.171';
7+
$ModuleVersion = '2.1.173';
88
$ModuleFiles = @(
99
@{
1010
FileName = 'SqlServer-Version-Management\SqlServer-Version-Management.psd1';
@@ -15,7 +15,7 @@ $ModuleFiles = @(
1515
" ModuleToProcess = @('SqlServer-Version-Management.psm1')",
1616
"",
1717
" # Version below is automatically incremented on build",
18-
" ModuleVersion = `"2.1.171`"",
18+
" ModuleVersion = `"2.1.173`"",
1919
"",
2020
" GUID = 'dd03b53d-575a-4056-ae08-e6dfea3384ea'",
2121
"",
@@ -100,14 +100,14 @@ $ModuleFiles = @(
100100
"",
101101
" ",
102102
" Tags = @(",
103-
" `"SQL`", `"Server`", `"SqlServer`", `"CI`", `"Unattended`", `"Setup`", `"Install`", `"RTM`", `"ServicePack`", `"CU`", `"ComulativeUpdate`", `"2022`", `"2019`", `"2017`", `"2016`", `"2014`", `"2012`", `"2008R2`", `"2008`", `"2005`", `"Windows`"",
103+
" `"SQL`", `"Server`", `"SqlServer`", `"CI`", `"Unattended`", `"Setup`", `"Install`", `"RTM`", `"ServicePack`", `"CU`", `"ComulativeUpdate`", `"2022`", `"2019`", `"2017`", `"2016`", `"2014`", `"2012`", `"2008R2`", `"2008`", `"2005`", `"Windows`", `"Try-And-Retry`"",
104104
" )",
105105
"",
106106
" LicenseUri = 'https://opensource.org/license/mit/'",
107107
"",
108108
"",
109109
" # Does not tested on powershell below 5.1",
110-
" ProjectUri = 'https://github.com/devizer/Universe.SqlServerJam/tree/master/SqlServer-Version-Management'",
110+
" ProjectUri = 'https://github.com/devizer/SqlServer-Version-Management'",
111111
"",
112112
" # IconUri = ''",
113113
"",
@@ -131,7 +131,63 @@ $ModuleFiles = @(
131131
@{
132132
FileName = 'SqlServer-Version-Management\SqlServer-Version-Management.psm1';
133133
Content = @(
134-
"# Include Directive: [ src\Synopsis.ps1 ]",
134+
"# Include Directive: [ src\Includes\Synopsis.ps1 ]",
135+
"# Include File: [\SqlSetup.PS1Project\src\Includes\Synopsis.ps1]",
136+
"<#",
137+
" .Synopsis",
138+
"SQL Server Setup and Management including Developer, Express, and LocalDB editions. ",
139+
"The intended use of this project is for Continuous Integration (CI) scenarios, where:",
140+
" • SQL Server or LocalDB needs to be installed without user interaction.",
141+
" • SQL Server or LocalDB installation doesn’t need to persist across multiple CI runs.",
142+
"",
143+
"SQL Server Setup defaults:",
144+
" • Features are SQL Engine and full text search,",
145+
" • Built-in Administrators (or localized name) are SQL Server Administrators for SSPI,",
146+
" • TCP/IP and Named Pipe protocols are on,",
147+
" • sa password is ‘Meaga`$tr0ng’.",
148+
"",
149+
"The guide: https://devizer.github.io/SqlServer-Version-Management",
150+
"",
151+
" .Description",
152+
" - Supports Windows 7 ... Windows 11, and Windows Server 2008 R2+ ... Windows Server 2025. Windows on ARM64 is also supported.",
153+
"",
154+
" .Example",
155+
" `$errors = Setup-SqlServers -SqlServers `"2025 Developer: MSSQLSERVER`"",
156+
"",
157+
" .Example",
158+
" `$errors = Setup-SqlServers -SqlServers `"2025 Developer: DEVELOPER2022, 2019 Developer: DEVELOPER2019`"",
159+
"",
160+
" .Example",
161+
" # Next example installs 32 or 64 bit Sql Server 2014 depending on Windows Architecture",
162+
" `$errors = Setup-SqlServers -SqlServers `"2014 Developer: DEVELOPER2014`"",
163+
"",
164+
" .Example",
165+
" # Next example installs 32 or 64 bit Sql Server 2016 Express depending on Windows Architecture",
166+
" `$errors = Setup-SqlServers -SqlServers `"2016 Core: SQLEXPRESS`"",
167+
"#>",
168+
"",
169+
"# Include Directive: [ src\Includes\Import-DevOps.ps1 ]",
170+
"# Include File: [\SqlSetup.PS1Project\src\Includes\Import-DevOps.ps1]",
171+
"# This implicit call resolves conflict with bash shell scripts names",
172+
"function Import-DevOps() {",
173+
" `$ModuleName = `"SqlServer-Version-Management`"",
174+
" `$exception=`$null;",
175+
" `$wp=`$WarningPreference;",
176+
" `$WarningPreference=`"SilentlyContinue`"",
177+
" # Actual Powershell Version",
178+
" try { Import-Module `"`$ModuleName`" 3>`$null; `$okActual = `$true; } catch { `$exception = `$_.Exception; }",
179+
" if (-not `$okActual) {",
180+
" # Legacy Powershell Version",
181+
" try { Import-Module `"`$ModuleName`" ; `$okLegacy = `$true; } catch { `$exception = `$_.Exception; Write-Host `"Warning! Import-Module `$ModuleName failed`$([Environment]::NewLine)`$(`$_.Exception)`" -ForegroundColor DarkRed }",
182+
" }",
183+
" if (`$okActual -or `$okLegacy) {",
184+
" # Write-Host `"Module '`$ModuleTitle' Successfully imported`" -ForeGroundColor Green",
185+
" }",
186+
" `$WarningPreference=`$wp;",
187+
"",
188+
"}",
189+
"# Import-DevOps; Try-And-Retry `"curl should fail`" { & `"curl.exe`" -I https://google.com2 }",
190+
"",
135191
"# Include Directive: [ ..\Includes\*.ps1 ]",
136192
"# Include File: [\Includes\`$Full7zLinksMetadata.ps1]",
137193
"`$Full7zLinksMetadata_onWindows = @(",
@@ -641,6 +697,7 @@ $ModuleFiles = @(
641697
" `$linkXp=`"https://github.com/q3aql/aria2-static-builds/releases/download/v1.19.2/aria2-1.19.2-win-xp-build1.7z`"",
642698
" `$linkX86=`"https://github.com/aria2/aria2/releases/download/release-1.36.0/aria2-1.36.0-win-32bit-build1.zip`"",
643699
" `$linkX64=`"https://github.com/aria2/aria2/releases/download/release-1.36.0/aria2-1.36.0-win-64bit-build1.zip`"",
700+
" `$linkArm64=`"https://github.com/minnyres/aria2-windows-arm64/releases/download/v1.37.0/aria2_1.37.0_arm64.zip`" # Not Tested",
644701
"",
645702
" if (-not `$arch) { ",
646703
" `$currentArch = Get-CPU-Architecture-Suffix-for-Windows;",
@@ -1401,15 +1458,19 @@ $ModuleFiles = @(
14011458
" `$ErrorActionPreference = `"SilentlyContinue`"",
14021459
" if (-not `$err) {",
14031460
" Write-Host `"Success. `" -ForeGroundColor Green -NoNewLine;",
1404-
" Write-Host `"'`$title' took `$(`$msec.ToString(`"n0`")) ms`"",
1461+
" Write-Host `"'`$title'`" -ForeGroundColor Cyan -NoNewLine;",
1462+
" Write-Host `" took `$(`$msec.ToString(`"n0`")) ms`"",
14051463
" } else {",
14061464
" # Write-Host `$err.GetType()",
1407-
" Write-Host `"Fail. `$(`$err.Message)`" -ForeGroundColor Red -NoNewLine;",
1408-
" Write-Host `" '`$title' took `$(`$msec.ToString(`"n0`")) ms`"",
1465+
" Write-Host `"Fail. `$(`$err.Message) `" -ForeGroundColor Red -NoNewLine;",
1466+
" Write-Host `"'`$title'`" -ForeGroundColor Magenta -NoNewLine;",
1467+
" Write-Host `" took `$(`$msec.ToString(`"n0`")) ms`"",
14091468
" }",
14101469
" `$ErrorActionPreference=`$ea",
14111470
"}",
14121471
"",
1472+
"# Measure-Action `"Test OK`" { }; Measure-Action `"Test Error`" { `$x = 5 / 0 }",
1473+
"",
14131474
"# Include File: [\Includes\Out-String-And-TrimEnd.ps1]",
14141475
"Function Out-String-And-TrimEnd",
14151476
"{",
@@ -4057,6 +4118,7 @@ $ModuleFiles = @(
40574118
"",
40584119
"",
40594120
"",
4121+
"Export-ModuleMember -Function Import-DevOps",
40604122
"Export-ModuleMember -Function Parse-SqlServers-Input",
40614123
"Export-ModuleMember -Function Setup-SqlServers",
40624124
"Export-ModuleMember -Function Query-SqlServer-Version",

SqlServer-Version-Management.ps1

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,28 @@ The guide: https://devizer.github.io/SqlServer-Version-Management
3333
$errors = Setup-SqlServers -SqlServers "2016 Core: SQLEXPRESS"
3434
#>
3535

36+
# Include Directive: [ src\Includes\Import-DevOps.ps1 ]
37+
# Include File: [\SqlSetup.PS1Project\src\Includes\Import-DevOps.ps1]
38+
# This implicit call resolves conflict with bash shell scripts names
39+
function Import-DevOps() {
40+
$ModuleName = "SqlServer-Version-Management"
41+
$exception=$null;
42+
$wp=$WarningPreference;
43+
$WarningPreference="SilentlyContinue"
44+
# Actual Powershell Version
45+
try { Import-Module "$ModuleName" 3>$null; $okActual = $true; } catch { $exception = $_.Exception; }
46+
if (-not $okActual) {
47+
# Legacy Powershell Version
48+
try { Import-Module "$ModuleName" ; $okLegacy = $true; } catch { $exception = $_.Exception; Write-Host "Warning! Import-Module $ModuleName failed$([Environment]::NewLine)$($_.Exception)" -ForegroundColor DarkRed }
49+
}
50+
if ($okActual -or $okLegacy) {
51+
# Write-Host "Module '$ModuleTitle' Successfully imported" -ForeGroundColor Green
52+
}
53+
$WarningPreference=$wp;
54+
55+
}
56+
# Import-DevOps; Try-And-Retry "curl should fail" { & "curl.exe" -I https://google.com2 }
57+
3658
# Include Directive: [ ..\Includes\*.ps1 ]
3759
# Include File: [\Includes\$Full7zLinksMetadata.ps1]
3860
$Full7zLinksMetadata_onWindows = @(
@@ -542,6 +564,7 @@ function Get-Aria2c-Exe-FullPath-for-Windows([string] $arch) {
542564
$linkXp="https://github.com/q3aql/aria2-static-builds/releases/download/v1.19.2/aria2-1.19.2-win-xp-build1.7z"
543565
$linkX86="https://github.com/aria2/aria2/releases/download/release-1.36.0/aria2-1.36.0-win-32bit-build1.zip"
544566
$linkX64="https://github.com/aria2/aria2/releases/download/release-1.36.0/aria2-1.36.0-win-64bit-build1.zip"
567+
$linkArm64="https://github.com/minnyres/aria2-windows-arm64/releases/download/v1.37.0/aria2_1.37.0_arm64.zip" # Not Tested
545568

546569
if (-not $arch) {
547570
$currentArch = Get-CPU-Architecture-Suffix-for-Windows;
@@ -1302,15 +1325,19 @@ function Measure-Action {
13021325
$ErrorActionPreference = "SilentlyContinue"
13031326
if (-not $err) {
13041327
Write-Host "Success. " -ForeGroundColor Green -NoNewLine;
1305-
Write-Host "'$title' took $($msec.ToString("n0")) ms"
1328+
Write-Host "'$title'" -ForeGroundColor Cyan -NoNewLine;
1329+
Write-Host " took $($msec.ToString("n0")) ms"
13061330
} else {
13071331
# Write-Host $err.GetType()
1308-
Write-Host "Fail. $($err.Message)" -ForeGroundColor Red -NoNewLine;
1309-
Write-Host " '$title' took $($msec.ToString("n0")) ms"
1332+
Write-Host "Fail. $($err.Message) " -ForeGroundColor Red -NoNewLine;
1333+
Write-Host "'$title'" -ForeGroundColor Magenta -NoNewLine;
1334+
Write-Host " took $($msec.ToString("n0")) ms"
13101335
}
13111336
$ErrorActionPreference=$ea
13121337
}
13131338

1339+
# Measure-Action "Test OK" { }; Measure-Action "Test Error" { $x = 5 / 0 }
1340+
13141341
# Include File: [\Includes\Out-String-And-TrimEnd.ps1]
13151342
Function Out-String-And-TrimEnd
13161343
{

0 commit comments

Comments
 (0)