Skip to content

Commit 2e3bbf4

Browse files
Update scripts & examples.
1 parent fca95d5 commit 2e3bbf4

File tree

2 files changed

+67
-1
lines changed

2 files changed

+67
-1
lines changed

example/requirements/prod.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
https://github.com/cheese-drawer/lib-python-db-wrapper/releases/download/2.3.0/db_wrapper-2.3.0-py3-none-any.whl
1+
-e ../

scripts/install

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
#!/usr/bin/env bash
2+
3+
#
4+
# NAVIGATE TO CORRECT DIRECTORY
5+
#
6+
7+
# start by going to script dir so all movements
8+
# from here are relative
9+
SCRIPT_DIR=`dirname $(realpath "$0")`
10+
cd $SCRIPT_DIR
11+
# go up to root
12+
cd ..
13+
14+
15+
#
16+
# INSTALL FROM LISTS
17+
#
18+
19+
function dev {
20+
echo ""
21+
echo "Installing dev requirements..."
22+
echo ""
23+
dev_result=0
24+
25+
# install from dev list
26+
pip install -r requirements/dev.txt
27+
}
28+
29+
function prod {
30+
echo ""
31+
echo "Installing prod requirements..."
32+
echo ""
33+
prod_result=0
34+
35+
# install from dev list
36+
pip install -r requirements/prod.txt
37+
}
38+
39+
# Install dev, prod, or all requirements depending on argument given
40+
if [ $# -eq 0 ]; then
41+
dev
42+
prod
43+
44+
if [[ $dev_result != 0 && $prod_result != 0 ]]; then
45+
echo "Errors found in both dev & prod installation. See output above."
46+
exit $dev_result
47+
elif [[ $dev_result != 0 && $prod_result == 0 ]]; then
48+
echo "Errors found in dev installation. See output above."
49+
exit $dev_result
50+
elif [[ $dev_result == 0 && $prod_result != 0 ]]; then
51+
echo "Errors found in prod installation. See output above."
52+
exit $prod_result
53+
else
54+
exit 0
55+
fi
56+
57+
elif [[ $1 == 'dev' || $1 == 'development' ]]; then
58+
dev ${@:2}
59+
exit $dev_result
60+
elif [[ $1 == 'prod' || $1 == 'production' ]]; then
61+
prod ${@:2}
62+
exit $prod_result
63+
else
64+
echo "Bad argument given, either specify \`dev\` or \`prod\` requirements by giving either word as your first argument to this script, or run both by giving no arguments."
65+
exit 1
66+
fi

0 commit comments

Comments
 (0)