Skip to content
This repository was archived by the owner on Aug 18, 2020. It is now read-only.

Commit 8e3da71

Browse files
authored
Merge pull request #3 from gerd2002/feature/unix-script
[*nix] Add initial version of script
2 parents cc4cc72 + 1ededba commit 8e3da71

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed

Diff for: install.sh

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#!/bin/sh
2+
3+
function error() {
4+
echo " ! $@"
5+
exit 1
6+
}
7+
8+
function clone() {
9+
git clone https://github.com/$1 $2 \
10+
|| error "Failed to clone $2"
11+
}
12+
13+
function checkdep() {
14+
command -v $1 >/dev/null 2>&1 \
15+
|| error "$1 not found! $2"
16+
}
17+
18+
echo " * Testing for dependencies..."
19+
20+
21+
command -v npm >/dev/null 2>&1 || command -v yarn >/dev/null 2>&1 || error "NPM or yarn is needed to set up webui"
22+
checkdep git "Git is required to clone individual subrepos"
23+
24+
echo " * Cloning repositories..."
25+
26+
test -e chatoverflow || clone codeoverflow-org/chatoverflow chatoverflow
27+
# todo: make the clones parallel?
28+
test -e chatoverflow/api || clone codeoverflow-org/chatoverflow-api chatoverflow/api
29+
test -e chatoverflow/gui || clone codeoverflow-org/chatoverflow-gui chatoverflow/gui
30+
test -e chatoverflow/plugins-public || clone codeoverflow-org/chatoverflow-plugins chatoverflow/plugins-public
31+
32+
# switching to chatoverflow dir
33+
cd chatoverflow
34+
35+
36+
echo " * Refreshing using sbt..."
37+
38+
function sbterr() {
39+
echo " ! We would love to set the project up for you, but it seems like you don't have sbt installed."
40+
echo " ! Please install sbt and execute $ sbt ';update;fetch;update'"
41+
echo " ! Or follow the guide at https://github.com/codeoverflow-org/chatoverflow/wiki/Installation"
42+
}
43+
44+
command -v sbt >/dev/null 2>&1 \
45+
&& sbt ";update;fetch;update" \
46+
|| sbterr
47+
48+
# update project first, then fetch plugins; then update the whole thing again
49+
# (including plugins this time)
50+
51+
echo " * Setting up GUI..."
52+
53+
cd gui
54+
55+
function finished() {
56+
# done?
57+
echo " * Success! You can now open the project in IntelliJ (or whatever IDE you prefer)"
58+
exit
59+
}
60+
61+
# don't install the project twice, lol
62+
# prefer yarn cause yarn is better, lol
63+
command -v yarn >/dev/null 2>&1 && yarn && finished
64+
command -v npm >/dev/null 2>&1 && npm install && finished

0 commit comments

Comments
 (0)