-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.ps1
28 lines (22 loc) · 1.12 KB
/
build.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
$root = "t"
mkdir "../$root" -Force | Out-Null
$indexHtml = "../$root/index.html"
"<!-- auto generated -->" | Out-File -FilePath $indexHtml -Encoding utf8BOM
"<a href='/$root/wtp'>WTP</a><br />" | Out-File -FilePath $indexHtml -Encoding utf8BOM -Append
Get-ChildItem -Directory
| ForEach-Object {
$name = $_.Name
Write-Host "Generating for $name"
"<a href='/$root/$name'>$name</a><br />" | Out-File -FilePath $indexHtml -Encoding utf8BOM -Append
$thisIndexHtml = "../$root/$name/index.html"
mkdir "../$root/$name" -Force | Out-Null
"<!-- auto generated -->" | Out-File -FilePath $thisIndexHtml -Encoding utf8BOM
"<ul>" | Out-File -FilePath $thisIndexHtml -Encoding utf8BOM -Append
Get-ChildItem $name
| ForEach-Object {
$fileName = $_.Name
"<li><a href='/$root/$name/$fileName'>$fileName</a></li>" | Out-File -FilePath $thisIndexHtml -Encoding utf8BOM -Append
Get-Content $_.FullName | Out-File -FilePath "../$root/$name/$($_.Name)" -Encoding utf8BOM
}
"</ul>" | Out-File -FilePath $thisIndexHtml -Encoding utf8BOM -Append
}