forked from Jaykul/PowerLine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.ps1
37 lines (32 loc) · 1.06 KB
/
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
[CmdletBinding()]
param(
[ValidateSet("Release","Debug")]
$Configuration = "Release"
)
Push-Location $PSScriptRoot
try {
$BuildTimer = New-Object System.Diagnostics.Stopwatch
$BuildTimer.Start()
$ModuleName = Split-Path $PSScriptRoot -Leaf
$ErrorActionPreference = "Stop"
$version = Get-Metadata ".\Source\${ModuleName}.psd1"
$folder = mkdir $version -Force
Get-ChildItem Source -filter "${ModuleName}.*" |
Copy-Item -Dest $folder.FullName -PassThru |
ForEach {
Write-Host " $($_.Name) -> $($_.FullName)"
}
Get-ChildItem Source\Private, Source\Public -Filter *.ps1 -Recurse |
Sort-Object Directory, Name |
Get-Content |
Set-Content "$($folder.FullName)\${ModuleName}.psm1"
Write-Host " PowerLine -> $($folder.FullName)\${ModuleName}.psm1"
Write-Host
Write-Host "Module build finished." -ForegroundColor Green
$BuildTimer.Stop()
Write-Host "Total Elapsed $($BuildTimer.Elapsed.ToString("hh\:mm\:ss\.ff"))"
} catch {
throw $_
} finally {
Pop-Location
}