-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
08b56ed
commit afa3da1
Showing
1 changed file
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
#!/bin/sh | ||
p='\033[0;35m' | ||
app_path="/Users/$USER/Desktop/" | ||
app_folder=$app_path'crowd' | ||
app_file=$app_folder'/app.py' | ||
|
||
echo "${p}Hello there! let's have a look at what we need to install" | ||
|
||
# check the path exists, else throw error | ||
if [ -d $app_path ]; then | ||
# if python is not installed, install it | ||
if ! hash python; then | ||
echo "${p}python is not installed, let me install it first!" | ||
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" | ||
brew update | ||
brew install python | ||
brew install git | ||
pip install --user pipenv | ||
exit 1 | ||
else | ||
echo "${p}Ok, python is installed" | ||
fi | ||
|
||
# if an older version of python exists, create a venv and install it | ||
ver=$(python3 -V 3>&1 | sed 's/.* \([0-9]\).\([0-9]\).*/\1\2/') | ||
if [ "$ver" -lt "36" ]; then | ||
echo "${p} Python 3.6 or greater is required, let me istall it" | ||
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" | ||
brew update | ||
brew upgrade python3 | ||
brew install git | ||
pip3 install --user pipenv | ||
exit 1 | ||
else | ||
echo "${p}...and it is updated" | ||
fi | ||
else | ||
echo 'Where should we install the application? Provide a full path (e.g. /Users/YOURNAME/Desktop/)' | ||
read $app_path | ||
fi | ||
|
||
# create the folder | ||
if [ ! -d $app_folder ]; then | ||
mkdir -p $app_folder; | ||
echo "$app_folder created" | ||
fi | ||
|
||
cd $app_folder | ||
|
||
if [ ! -f $app_file ]; then | ||
# download repo | ||
echo "downloading github repo" | ||
git clone https://github.com/marilenadaquino/crowdsourcing $app_folder | ||
echo "cloned repo" | ||
fi | ||
|
||
# create venv | ||
virtualenv . | ||
source bin/activate | ||
# install requirements | ||
pip3 install -r $app_folder'/requirements.txt' | ||
|
||
if [ ! -f $app_folder'/blazegraph.jar' ]; then | ||
# download blazegraph | ||
echo "no blazegraph" | ||
curl -L "https://github.com/blazegraph/database/releases/download/BLAZEGRAPH_2_1_6_RC/blazegraph.jar" --output $app_folder"blazegraph.jar" | ||
echo "downloaded blazegraph" | ||
fi | ||
|
||
deactivate | ||
|
||
echo "done!" | ||
|
||
exit 1 |