-
Notifications
You must be signed in to change notification settings - Fork 36
/
fssnip.ps1
44 lines (36 loc) · 1.23 KB
/
fssnip.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
param($command='run')
Write-Output "Executing command: $command"
$env:PAKET_SKIP_RESTORE_TARGETS="true"
$env:IP_ADDRESS="0.0.0.0"
$env:FSSNIP_HOME_DIR="."
$env:RECAPTCHA_SECRET=<insert_value_here>
$env:fssnip_storage_key=<insert_value_here>
$env:fssnip_data_url="https://github.com/fssnippets/fssnip-data/archive/master.zip"
function Restore-GlobalJson { if (Test-Path -Path './notglobal.json') { Rename-Item './notglobal.json' -NewName './global.json' } }
function Hide-GlobalJson { if (Test-Path -Path './global.json') { Rename-Item './global.json' -NewName './notglobal.json' } }
function Build-App {
# in case another script left the global.json renamed
Restore-GlobalJson
dotnet tool restore
dotnet paket restore
dotnet fake run build.fsx
}
function Start-App {
# in case another script left the global.json renamed
Restore-GlobalJson
dotnet wwwroot/fssnip.dll
}
function Deploy-App {
Hide-GlobalJson
dotnet fsi deploy.fsx
Restore-GlobalJson
}
function Deploy-Data {
Hide-GlobalJson
dotnet fsi upload-blobs.fsx
Restore-GlobalJson
}
if ($command -eq 'run') { Start-App }
if ($command -eq 'build') { Build-App }
if ($command -eq 'deploy') { Deploy-App }
if ($command -eq 'upload') { Deploy-Data }