forked from kbilsted/NotepadPlusPlusPluginPack.Net
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makerelease.ps1
41 lines (30 loc) · 1.26 KB
/
makerelease.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
$version = "0.94.00"
function replaceVersionInfo($version)
{
$versionInfoRegex = new-object Text.RegularExpressions.Regex "// NPP plugin platform for .Net v(\d+\.\d+(\.\d+)?) by Kasper B. Graversen etc.", "None"
$files = get-ChildItem -Path . -Recurse -ErrorAction SilentlyContinue -Filter *.cs
ForEach ($f in $files)
{
$name = $f.Fullname
$content = [IO.File]::ReadAllText($name)
$original = $content
$content = $versionInfoRegex.Replace($content, "// NPP plugin platform for .Net v"+ $version + " by Kasper B. Graversen etc.")
If ($content -ne $original)
{
[IO.File]::WriteAllText("$name", $content, [Text.Encoding]::"UTF8")
}
}
}
cd 'Visual Studio Project Template C#'
replaceVersionInfo($version)
$filename = "NppPlugin" + $version + ".zip"
write-host "# zip the projectTemplate '$filename'" -foreground green
& 'C:\Program Files\7-Zip\7z.exe' a -tzip $filename * -xr!bin -xr!obj
$vsTemplatepath = [Environment]::GetFolderPath("MyDocuments")+'\Visual Studio 2017\Templates\ProjectTemplates\Visual C#\'
write-host "# Copy projectTemplate to VS: '$vsTemplatepath'" -foreground green
del "$($vsTemplatepath)\nppplugin*.zip"
copy $filename $($vsTemplatepath)
copy $filename c:\temp\
write-host "# remove temp files" -foreground green
rm $filename
cd ..