-
Notifications
You must be signed in to change notification settings - Fork 2
/
generate-tds.ps1
51 lines (40 loc) · 1.48 KB
/
generate-tds.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#
# Generate a TDS compliant zip.
# Note: this is experimental on Windows.
#
param(
[Switch]$RemoveOut = $false
)
$out = "tdsout"
$in = "latex"
$latex = "$out/tex/latex/ugent2016"
$doc = "$out/doc/latex/ugent2016"
$source = "$out/source/latex/ugent2016"
# First, create the output directory
New-Item -ItemType Directory -Force -Path $latex
New-Item -ItemType Directory -Force -Path $doc
New-Item -ItemType Directory -Force -Path $source
# Copy all latex files
Get-ChildItem -Path "$in/*" -File -Include *.cls,*.sty | ForEach-Object {
$filename = "$($_.BaseName)$($_.Extension)"
((Get-Content $_) -join "`n") + "`n" | Set-Content -NoNewline "$latex/$filename"
}
# Copy all doc files
Get-ChildItem -Path "$in/*" -File -Include *.md | ForEach-Object {
$filename = "$($_.BaseName)$($_.Extension)"
((Get-Content $_) -join "`n") + "`n" | Set-Content -NoNewline "$doc/$filename"
}
# Copy all source files
Get-ChildItem -Path "$in/*" -File -Include *.tex | ForEach-Object {
$filename = "$($_.BaseName)$($_.Extension)"
((Get-Content $_) -join "`n") + "`n" | Set-Content -NoNewline "$source/$filename"
}
# Copy the logos to the output folder
Copy-Item "$in/ugent2016-logo-*.pdf" -Destination "$latex" -Recurse
# Copy the documentation pdfs to the folder
Copy-Item "$in/ugent2016-nl.pdf" -Destination "$doc"
Copy-Item "$in/ugent2016-en.pdf" -Destination "$doc"
Compress-Archive -Path $out/* -DestinationPath ugent2016.tds.zip -Force
if ($RemoveOut) {
Remove-Item $out -Recurse -Force
}