forked from Superalgos/Superalgos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.ps1
82 lines (70 loc) · 2.02 KB
/
install.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
78
79
80
81
82
Param(
[Parameter(Mandatory=$true, HelpMessage="Github username")]
[String]
$username,
[Parameter(Mandatory=$true, HelpMessage="Github API token")]
[String]
$token
)
function installGit {
Write-Host "Please go to https://git-scm.com/download/win and install git"
}
function checkGit {
if (Get-Command git -errorAction SilentlyContinue) {
Write-Host ""
Write-Host "superalgos | info | git already installed"
Write-Host ""
return $true
}
installGit
return $false
}
function installNode {
Write-Host "Please go to https://nodejs.org/en/download/ and install nodejs"
}
function checkNode {
if (Get-Command node -errorAction SilentlyContinue) {
Write-Host ""
Write-Host "superalgos | info | nodejs already installed"
Write-Host ""
return $true
}
installNode
return $false
}
function cloneSuperalgos {
Write-Host ""
Write-Host "superalgos | info | downloading application code"
Write-Host ""
git clone "https://github.com/$username/Superalgos.git"
}
function install {
# install pm2 globally
Write-Host ""
Write-Host "superalgos | info | installing pm2 globally for process management"
Write-Host ""
npm install -g pm2
Write-Host ""
Write-Host "superalgos | info | running node setup script to run prepare the app"
Write-Host ""
node setup.js
Write-Host ""
Write-Host "superalgos | info | running node setup script to run prepare the app"
Write-Host ""
node setupPlugins.js $username $token
# install the superalgos command line app
Write-Host ""
Write-Host "superalgos | info | installing 'superalgos' cli"
Write-Host ""
npm install -g . --omit=optional
# apply security fixes to local modules
Write-Host ""
Write-Host "superalgos | info | applying security patches for local dependencies"
Write-Host ""
npm audit fix --force --omit=optional
}
if( checkGit -and checkNode ) {
cloneSuperalgos
cd Superalgos
install
}