forked from JustinGrote/SecretManagement.KeePass
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PSModule.build.ps1
77 lines (68 loc) · 2.87 KB
/
PSModule.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
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
69
70
71
72
73
74
75
76
77
if (-not (Get-Module PowerConfig -ErrorAction SilentlyContinue)) {
try {
Import-Module PowerConfig -ErrorAction Stop
} catch {
Install-Module PowerConfig -AllowPrerelease -Force
Import-Module PowerConfig -ErrorAction Stop
}
}
if (-not (Get-Module Press -ErrorAction SilentlyContinue)) {
try {
Import-Module Press -ErrorAction Stop
} catch {
Install-Module Press -Force
Import-Module Press -ErrorAction Stop
}
}
if (-not (Get-Module 'Microsoft.Powershell.SecretManagement' -ErrorAction SilentlyContinue)) {
try {
Import-Module 'Microsoft.Powershell.SecretManagement' -ErrorAction Stop
} catch {
Install-Module 'Microsoft.Powershell.SecretManagement' -AllowPrerelease -RequiredVersion '1.1.0' -Force
Import-Module 'Microsoft.Powershell.SecretManagement' -ErrorAction Stop
}
}
if (-not (Get-Module 'PSFramework' -ErrorAction SilentlyContinue)) {
try {
Import-Module 'PSFramework' -ErrorAction Stop
} catch {
Install-Module 'PSFramework' -AllowPrerelease -RequiredVersion '1.6.205' -Force -AllowClobber
Import-Module 'PSFramework' -ErrorAction Stop
}
}
. Press.Tasks
Task Press.CopyModuleFiles @{
Inputs = {
Get-ChildItem -File -Recurse $PressSetting.General.SrcRootDir
$SCRIPT:IncludeFiles = (
(Get-ChildItem -File -Recurse "$($PressSetting.General.SrcRootDir)\SecretManagement.KeePass.Extension") |
Resolve-Path
)
$IncludeFiles
}
Outputs = {
$buildItems = Get-ChildItem -File -Recurse $PressSetting.Build.ModuleOutDir
if ($buildItems) { $buildItems } else { 'EmptyBuildOutputFolder' }
}
Jobs = {
Remove-BuildItem $PressSetting.Build.ModuleOutDir
$copyResult = Copy-PressModuleFiles @commonParams `
-Destination $PressSetting.Build.ModuleOutDir `
-PSModuleManifest $PressSetting.BuildEnvironment.PSModuleManifest
$PressSetting.OutputModuleManifest = $copyResult.OutputModuleManifest
}
}
Task CopyKeePassExtension -After Press.CopyModuleFiles {
#KeePass Extension Files
$KPExtensionPath = "$($PressSetting.General.SrcRootDir)\SecretManagement.KeePass.Extension"
Copy-Item $KPExtensionPath -Recurse -Force -Exclude '*.Tests.ps1' -Destination $PressSetting.Build.ModuleOutDir -Container
}
Task CopyPoshKeePass -After Press.CopyModuleFiles {
#KeePass Extension Files
$PKPExtensionPath = "$($PressSetting.General.SrcRootDir)\PoshKeePass"
Copy-Item $PKPExtensionPath -Recurse -Force -Exclude '*.Tests.ps1' -Destination $PressSetting.Build.ModuleOutDir -Container
}
Task Package Press.Package.Zip
Task Press.Test.Pester.WindowsPowershell {
Write-Warning 'Windows Powershell Tests cannot currently be run due to a bug. Run the tests manually. Remove when https://github.com/pester/Pester/issues/1974 is closed'
}