-
Notifications
You must be signed in to change notification settings - Fork 0
/
makecents-setup
executable file
·59 lines (49 loc) · 1.65 KB
/
makecents-setup
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
#!/bin/bash
# This script sets up MakeCents by:
# 1. making sure the user has the latest pcgs_scraper tarball
# 2. installing requirements with pip
# 3. changing dir to makecents subdir
# 3. making makecents-test executable
#########
# COLOR #
#########
GREEN='\033[0;32m'
RED='\033[0;31m'
CYAN='\033[0;36m'
NC='\033[0m' # No Color
###############################
# latest pcgs_scraper tarball #
###############################
printf "${GREEN}Fetching latest pcgs_scraper version..."
URL=$(curl -s "https://api.github.com/repos/ryanamannion/pcgs_scraper/releases/latest" | \
python3 -c "import sys, json; print(json.load(sys.stdin)['tarball_url'])")
VERSION=$(echo $URL | awk -F'/' '{print $NF}')
SAVE_DIR="pcgs_scraper-releases"
FILE="pcgs_scraper-${VERSION}.tar.gz"
FULL="${SAVE_DIR}/${FILE}"
printf " Latest: ${VERSION}${NC}\n"
if [ ! -d "./${SAVE_DIR}" ]; then
printf "${GREEN}First time, creating ${SAVE_DIR}... "
mkdir "$SAVE_DIR"
printf "Done${NC}\n"
fi
if [ ! -f "$FULL" ]; then
printf "${GREEN}Saving ${VERSION} to ${FULL}... "
cd $SAVE_DIR
wget --quiet --output-document=$FILE $URL
printf "Done${NC}\n"
cd ..
else
printf "${CYAN}${FULL} already exists, continuing...${NC}\n"
fi
printf "${GREEN}Installing pcgs_scraper from ${FULL}...\n${NC}"
pip install $FULL
printf "${GREEN}Installing other requirements from requirements.txt...\n${NC}"
sleep 2
pip install -r requirements.txt
printf "${GREEN}Changing dir to ./makecents\n${NC}"
cd makecents
printf "${GREEN}Making makecents-test executable\n${NC}"
chmod +x "makecents-test"
printf "${GREEN}Setup complete you can now run MakeCents from this directory with:\n\n${NC}"
printf "${CYAN}./makecents-test${NC}\n\n"