diff --git a/package/Deploy-Exchange2019.ps1 b/package/Deploy-Exchange2019.ps1 index 45258e6..227481d 100644 --- a/package/Deploy-Exchange2019.ps1 +++ b/package/Deploy-Exchange2019.ps1 @@ -150,6 +150,12 @@ 14 = -FollowAfter without step 21 Console : EXM_ICONS = Emoji | Symbols | Ascii forces the icon style; NO_COLOR removes the colours. Documentation : Docs\Exchange2019Migration-Guide.html (or .md). History: CHANGELOG.md + + Disclaimer: + This Script is a Personal project. + It's provided "AS-IS". It's not an official Microsoft product so no support can be expected from Microsoft. + + As any scripts you must read carefully the documentation and test it first in a Test environment before any run in Production. #> [CmdletBinding(DefaultParameterSetName='Standard')] diff --git a/package/Manage-IISLogs.ps1 b/package/Manage-IISLogs.ps1 index 60d8509..ddddc59 100644 --- a/package/Manage-IISLogs.ps1 +++ b/package/Manage-IISLogs.ps1 @@ -80,6 +80,12 @@ No external dependency: Compress-Archive (PS5+), Get-ChildItem, Remove-Item. The script writes its own log to $LogPath\ManageIISLogs_.txt + + Disclaimer: + This Script is a Personal project. + It's provided "AS-IS". It's not an official Microsoft product so no support can be expected from Microsoft. + + As any scripts you must read carefully the documentation and test it first in a Test environment before any run in Production. #> [CmdletBinding(DefaultParameterSetName = 'Run')] diff --git a/package/README.md b/package/README.md index 380afcb..af31d4e 100644 --- a/package/README.md +++ b/package/README.md @@ -48,4 +48,11 @@ notepad .\Configs\DiskLayout.csv ; notepad .\Configs\DAGInfo.csv Project page, releases and change log: https://github.com/Nico77600/Exchange2013-2016-to-2019-Migration -License: [MIT](LICENSE). \ No newline at end of file +License: [MIT](LICENSE). + +## Disclaimer + +This Script is a Personal project. +It's provided "AS-IS". It's not an official Microsoft product so no support can be expected from Microsoft. + +As any scripts you must read carefully the documentation and test it first in a Test environment before any run in Production. \ No newline at end of file diff --git a/tests/Exchange2019Migration.Tests.ps1 b/tests/Exchange2019Migration.Tests.ps1 index 8e1debf..504b1a6 100644 --- a/tests/Exchange2019Migration.Tests.ps1 +++ b/tests/Exchange2019Migration.Tests.ps1 @@ -30,6 +30,44 @@ BeforeAll { } } +Describe 'Runtime disclaimer' { + BeforeAll { + $script:DisclaimerRepo = Split-Path $PSScriptRoot -Parent + $script:DisclaimerConfig = Get-Content (Join-Path $script:DisclaimerRepo '.github\ci.json') -Raw | ConvertFrom-Json + $script:DisclaimerRuntime = Join-Path $script:DisclaimerRepo $script:DisclaimerConfig.runtimeRoot + $script:DisclaimerPattern = '(?ms)^## Disclaimer[ \t]*\r?\n(?.*?)(?=^##[ \t]|\z)' + $rootReadme = [IO.File]::ReadAllText((Join-Path $script:DisclaimerRepo 'README.md')) + $matches = [regex]::Matches($rootReadme, $script:DisclaimerPattern) + if ($matches.Count -ne 1) { throw 'The root README must contain exactly one canonical disclaimer.' } + $script:CanonicalDisclaimer = $matches[0].Groups['Body'].Value.Trim().Replace("`r`n", "`n") + function ConvertTo-DisclaimerParagraphs([string]$Text) { + (($Text.Trim() -split '\r?\n[ \t]*\r?\n') | ForEach-Object { ($_ -replace '\s+', ' ').Trim() }) -join "`n`n" + } + } + + It 'keeps the runtime README disclaimer identical to the canonical root section' { + $readme = [IO.File]::ReadAllText((Join-Path $script:DisclaimerRuntime 'README.md')) + $matches = [regex]::Matches($readme, $script:DisclaimerPattern) + $matches.Count | Should -Be 1 + $matches[0].Groups['Body'].Value.Trim().Replace("`r`n", "`n") | Should -BeExactly $script:CanonicalDisclaimer + } + + It 'keeps both delivered public entry script disclaimers attached to their help with the same wording and paragraphs' { + foreach ($entry in $script:DisclaimerConfig.packageEntry, 'Manage-IISLogs.ps1') { + $path = Join-Path $script:DisclaimerRuntime $entry + $errors = $null + $ast = [Management.Automation.Language.Parser]::ParseFile($path, [ref]$null, [ref]$errors) + @($errors).Count | Should -Be 0 -Because $entry + $help = $ast.GetHelpContent() + $help | Should -Not -BeNullOrEmpty -Because $entry + $notes = $help.Notes + [regex]::Matches($notes, '(?m)^[ \t]*Disclaimer:[ \t]*$').Count | Should -Be 1 -Because $entry + $body = [regex]::Match($notes, '(?s)(?:^|\r?\n)[ \t]*Disclaimer:[ \t]*\r?\n(?.*)\z').Groups['Body'].Value + (ConvertTo-DisclaimerParagraphs $body) | Should -BeExactly (ConvertTo-DisclaimerParagraphs $script:CanonicalDisclaimer) -Because $entry + } + } +} + Describe 'Files' { It 'parse in Windows PowerShell 5.1, the shell of the framework' { $list = Join-Path $TestDrive 'files.txt' @@ -230,6 +268,10 @@ Describe 'Package' { $LASTEXITCODE | Should -Be 0 Test-Path (Join-Path $destination 'Deploy-Exchange2019.ps1') | Should -BeTrue Test-Path (Join-Path $destination 'Docs\Exchange2019Migration-Guide.html') | Should -BeTrue + $readme = Join-Path $destination 'README.md' + Test-Path $readme | Should -BeTrue + (Get-FileHash -LiteralPath $readme -Algorithm SHA256).Hash | + Should -BeExactly (Get-FileHash -LiteralPath (Join-Path $script:PackageRoot 'README.md') -Algorithm SHA256).Hash foreach ($name in 'Reports', 'tools', 'tests') { Test-Path (Join-Path $destination $name) | Should -BeFalse } $config = Import-PowerShellDataFile (Join-Path $destination 'Configs\Deployment.config.psd1') $config.LicenseKey | Should -BeNullOrEmpty diff --git a/tools/New-MigrationPackage.ps1 b/tools/New-MigrationPackage.ps1 index 435b705..7ca9516 100644 --- a/tools/New-MigrationPackage.ps1 +++ b/tools/New-MigrationPackage.ps1 @@ -8,7 +8,7 @@ The package contains only what Deploy-Exchange2019.ps1 needs at run time, plus the HTML guides: Deploy-Exchange2019.ps1, Manage-IISLogs.ps1, Modules\, Steps\, Configs\, Docs\Exchange2019Migration-UserGuide.html, Docs\Exchange2019Migration-Guide.html, - CHANGELOG.md, LICENSE + README.md, CHANGELOG.md, LICENSE It never copies Reports\ (run output: server, database and mailbox names), tools\ or tests\. Environment values: @@ -62,7 +62,7 @@ if (Test-Path -LiteralPath $Destination) { # ---- Files needed at run time --------------------------------------------------------------------- $files = New-Object System.Collections.Generic.List[string] -foreach ($f in 'Deploy-Exchange2019.ps1', 'Manage-IISLogs.ps1', 'CHANGELOG.md', 'LICENSE', 'Configs\HealthChecker.ps1', 'Docs\Exchange2019Migration-UserGuide.html', 'Docs\Exchange2019Migration-Guide.html') { $files.Add($f) } +foreach ($f in 'Deploy-Exchange2019.ps1', 'Manage-IISLogs.ps1', 'README.md', 'CHANGELOG.md', 'LICENSE', 'Configs\HealthChecker.ps1', 'Docs\Exchange2019Migration-UserGuide.html', 'Docs\Exchange2019Migration-Guide.html') { $files.Add($f) } foreach ($folder in 'Modules', 'Steps') { Get-ChildItem -LiteralPath (Join-Path $packageRoot $folder) -File | ForEach-Object { $files.Add($_.FullName.Substring(([IO.Path]::GetFullPath($packageRoot).TrimEnd('\') + '\').Length)) } }