Skip to content

Commit 71523ea

Browse files
author
Donna-Marie Smith
committed
Commented the Powershell script
1 parent 0ddcab9 commit 71523ea

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

createLatest.ps1

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,25 @@ $latestName = "latest"
33

44
$LatestVersion = (Select-String -Path $Path -Pattern "latest = true" -Context 3, 0) -split "`""
55

6-
#Use $LatestVersion[1] as we know that the version is the first line returned and splitting on " makes it the 2nd index
6+
# Use $LatestVersion[1] as we know that the version is the first line returned and splitting on " makes it the 2nd index
77
$Version = $LatestVersion[1]
88

9+
# Remove latest folder and contents in docs if it already exists
910
if (Test-Path ".\content\en\docs\$latestName"){
1011
Remove-Item -LiteralPath ".\content\en\docs\$latestName" -Force -Recurse
1112
}
13+
# Create new latest docs folder
1214
New-Item -ItemType Directory -Path ".\content\en\docs\$latestName\" -Force
15+
# Copy contents of latest XXXX.X version into latest folder
1316
Copy-Item -Path ".\content\en\docs\$Version\*" -Destination ".\content\en\docs\$latestName\" -Recurse -Force
17+
# Replace the title name for the folder to be latest
1418
(Get-Content .\content\en\docs\latest\_index.md) -replace $Version, "Latest" | Set-Content .\content\en\docs\latest\_index.md
1519

20+
# Remove latest folder and contents in static if it already exists
21+
if (Test-Path ".\content\static\$latestName"){
22+
Remove-Item -LiteralPath ".\content\static\$latestName" -Force -Recurse
23+
}
24+
# Create new latest static folder
1625
New-Item -ItemType Directory -Path ".\content\static\$latestName\" -Force
26+
# Copy contents of latest XXXX.X version into latest folder
1727
Copy-Item -Path ".\content\static\$Version\*" -Destination ".\content\static\$latestName\" -Recurse -Force

0 commit comments

Comments
 (0)