-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathpullData.ps1
More file actions
62 lines (51 loc) · 2.01 KB
/
Copy pathpullData.ps1
File metadata and controls
62 lines (51 loc) · 2.01 KB
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
<#
.SYNOPSIS
Copies in the encrypted databases used by skarm into the path SkarmBot\..\skarmData\ from cloud copies accessed via Box Drive
#>
$windowTitle = "Skarmbot live"
$host.ui.RawUI.WindowTitle = $windowTitle
Push-Location
cd $PSScriptRoot
Function get-WindowsData {
$dataSource = "~\Box\skarmData\*.penguin"
$dataRemoval = "~\Box\skarmData\*(*).penguin"
$dataDestination = "$PSScriptRoot\..\skarmData\"
if (-not (Test-Path $dataSource)) {
try {
Start-Process 'C:\Program Files\Box\Box\Box.exe'
Write-Host "Starting up box drive..."
Start-Sleep 15
}
catch {
Write-Error "database files not found. Please verify that the path ~\Box\skarmData exists and that Box Drive is working properly."
Start-Sleep 1
$Host.SetShouldExit(-1)
exit
}
}
Write-Host "Copying files..."
if (-not (Test-Path $dataDestination)) {
New-Item -Path $dataDestination -ItemType Directory
}
# Purge clones
ls $dataRemoval | Remove-Item -Verbose
# Copy in data if the file size is at least 1 byte (avoids one-time case where 0-length data was pushed to the database)
ls $dataSource | where { $_.Length -gt 8 } | foreach { Write-Host "Copying in $($_.Name) of size $($_.Length)"; Copy-Item -Path $_ -Destination $dataDestination }
}
Function get-LinuxData {
# TODO
}
if ($IsLinux) {
get-LinuxData
} else {
get-WindowsData
}
#provide master branch git revision count to skarm
$version = (git rev-list --count master)
$largeNumber = 1MB # -L specifies how many return results to accept in the pipeline
# https://cli.github.com/manual/gh_pr_list
Write-Host "Version: 2.$((gh pr list -s merged -L $largeNumber).Length).$version"
$Host.SetShouldExit($version) #force the powershell exit code to be the "version" number
#exit #https://weblogs.asp.net/soever/returning-an-exit-code-from-a-powershell-script
Pop-Location
Start-Sleep 1