-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathinstall.ps1
55 lines (40 loc) · 1.42 KB
/
install.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
param(
[ValidateSet('Debug', 'Release')]
[string]$Configuration = 'Release'
,
[switch] $Rebuild
)
$man = Import-PowerShellDataFile $PSScriptRoot/PSEverything/PSEverything.psd1
$name = 'PSEverything'
[string]$version = $man.ModuleVersion
[string] $sln = Resolve-Path "$PSScriptRoot\$Name.sln"
$msbuildArgs = @("/p:Configuration=$Configuration")
if ($Rebuild) {
$msbuildArgs += '/target:rebuild'
}
else {
$msbuildArgs += '/target:build'
}
$msbuildArgs += $sln
"$msbuildArgs"
dotnet build -c $Configuration $msbuildArgs
dotnet test
$moduleSourceDir = "$PSScriptRoot/PSEverything/bin/$Configuration/netstandard2.0/"
$moduleDir = "~/documents/PowerShell/Modules/$name/$version/"
$newLine = [Environment]::NewLine
Set-StrictMode -Version Latest
$ofs = $newLine
[string]$about_content = Get-Content $PSScriptRoot/README.md | ForEach-Object {
$_ -replace '```.*', ''
}
if (-not (Test-Path $moduleDir)) {
$null = mkdir $moduleDir
}
Get-ChildItem $moduleSourceDir | Copy-Item -Destination $moduleDir -ErrorAction:Continue
Set-Content -Path $moduleDir/about_${name}.help.txt -value $about_content
$man = Test-ModuleManifest $moduleDir/PSEverything.psd1
$cert = Get-ChildItem cert:\CurrentUser\My -CodeSigningCert
if ($cert) {
Get-ChildItem $moduleDir/*.ps?1, $moduleDir/*.dll | Set-AuthenticodeSignature -Certificate $cert -TimestampServer http://timestamp.verisign.com/scripts/timstamp.dll
}
Get-Item $ModuleDir