forked from PowerShell/PSReadLine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakeRelease.ps1
68 lines (53 loc) · 1.52 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
param([switch]$Install)
add-type -AssemblyName System.IO.Compression.FileSystem
if (!(gcm msbuild -ea Ignore))
{
$env:path += ";${env:SystemRoot}\Microsoft.Net\Framework\v4.0.30319"
}
msbuild $PSScriptRoot\PSReadline\PSReadLine.sln /t:Rebuild /p:Configuration=Release
$targetDir = "${env:Temp}\PSReadline"
if (Test-Path $targetDir)
{
rmdir -re $targetDir
}
$null = mkdir $targetDir
$null = mkdir $targetDir\en-US
$files = @('Changes.txt',
'License.txt',
'PSReadline\PSReadline.psd1',
'PSReadline\PSReadline.psm1',
'PSReadline\PSReadline.format.ps1xml',
'PSReadline\PSReadline.format.ps1xml',
'PSReadline\bin\Release\PSReadline.dll')
foreach ($file in $files)
{
cp $PSScriptRoot\$file $targetDir
}
$files = @('PSReadline\en-US\about_PSReadline.help.txt',
'PSReadline\en-US\PSReadline.dll-help.xml')
foreach ($file in $files)
{
cp $PSScriptRoot\$file $targetDir\en-us
}
del $PSScriptRoot\PSReadline.zip -ea Ignore
[System.IO.Compression.ZipFile]::CreateFromDirectory($targetDir, "$PSScriptRoot\PSReadline.zip")
if ($Install)
{
$InstallDir = "${env:HOME}\Documents\WIndowsPowerShell\Modules"
if (!(Test-Path $InstallDir))
{
mkdir -force $InstallDir
}
try
{
if (Test-Path $InstallDir\PSReadline)
{
rm -Recurse -force $InstallDir\PSReadline -ea Stop
}
cp -Recurse $targetDir $InstallDir
}
catch
{
Write-Error "Can't install, module is probably in use."
}
}