-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.ps1
67 lines (56 loc) · 2.04 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
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
# Just copy files, because I do not want to
# Leszek Pomianowski CC0
# DATA
#$directories = @('code', 'languages', 'assets')
#$files = @('wc-poczta.php', 'readme.txt', 'LICENSE')
$directories = @('code', 'languages', 'assets')
$files = @('wc-poczta.php', 'readme.txt', 'LICENSE')
$exclude = @('*.scss', '*.po')
# INFO
Write-Host "============================" -ForegroundColor White
Write-Host "RDEV" -ForegroundColor Red -NoNewline
Write-Host " | " -ForegroundColor White -NoNewline
Write-Host "Poweshell Quick Build"
Write-Host "============================" -ForegroundColor White
# Do what you need to do
$ROOT_PATH = '.\'
$DIST_PATH = '.\dist\'
if (Test-Path -Path $DIST_PATH) {
Remove-Item -path $DIST_PATH -Recurse -Force
Write-Host "[OK] " -ForegroundColor Green -NoNewline
Write-Host "Directory $DIST_PATH removed!" -ForegroundColor White
}
foreach ($directory in $directories) {
if (Test-Path -Path $ROOT_PATH$directory) {
Copy-Item "$ROOT_PATH$directory" -Destination "$DIST_PATH$directory" -Recurse -Force -Exclude $exclude
Write-Host "[OK] " -ForegroundColor Green -NoNewline
} else {
Write-Host "[ER] " -ForegroundColor Red -NoNewline
}
Write-Host "Copying a directory: " -ForegroundColor White -NoNewline
Write-Host $ROOT_PATH$directory -NoNewline
Write-Host ", to: " -ForegroundColor White -NoNewline
Write-Host $DIST_PATH$directory
}
foreach ($file in $files) {
if (-not(Test-Path -Path $file -PathType Leaf)) {
Write-Host "[ER] " -ForegroundColor Red -NoNewline
} else {
Copy-Item "$ROOT_PATH$file" -Destination "$DIST_PATH$file" -Force
Write-Host "[OK] " -ForegroundColor Green -NoNewline
}
Write-Host "Copying a file: " -ForegroundColor White -NoNewline
Write-Host $ROOT_PATH$file -NoNewline
Write-Host ", to: " -ForegroundColor White -NoNewline
Write-Host $DIST_PATH$file
}
Write-Host ""
Write-Host "Excluded: " -ForegroundColor White
foreach ($excluded in $exclude) {
Write-Host " - "$excluded
}
# Write-Host ""
# git branch -a
# git remote -v
Write-Host ""
Write-Host "DONE." -ForegroundColor Green