-
Notifications
You must be signed in to change notification settings - Fork 3
/
module_manager.sh
executable file
·77 lines (69 loc) · 2.6 KB
/
module_manager.sh
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
#!/bin/bash
: '
# @author: Prathyush SP
# @Created on: 31/12/1
# Command: ./build.sh --install <env name{dev, prod}>
#
# execute python in bash:
# var_name = $(python -c "" 2>&1)
#
# execute bash in python
# import os
# os.system("")
'
############################################################################################################################################################
# Constants
############################################################################################################################################################
DEBUG=true
PYTHON_COMMAND=python3
PYTHON_PIP=pip3
PROJECT_NAME=module
PACKAGE_NAME=module
MODULE_DOCS_PATH=`pwd`/../module-docs/
SCRIPT_PATH=`pwd`
python_exec_val=''
MODULE_LOG=${SCRIPT_PATH}/module.log
SCRIPT_NAME=$(basename "$0")
export PYTHONPATH=$PWD
CURRENT_DATE=`date +%d/%m/%Y`
MODULE_VERSION=`grep -o '"__version__": *"[^"]*"' ${PACKAGE_NAME}/metadata.json | grep -o '"[^"]*"$' | cut -d '"' -f 2`
function init_scripts(){
: '
# @author: Prathyush SP
# @Created on: 21/05/17
# Description: Initialize all the scripts [Note: Do not change the source order]
'
source ${SCRIPT_PATH}/scripts/strings.sh
source ${SCRIPT_PATH}/scripts/python_snippets.sh
source ${SCRIPT_PATH}/scripts/usage.sh
source ${SCRIPT_PATH}/scripts/commons.sh
source ${SCRIPT_PATH}/scripts/utils.sh
source ${SCRIPT_PATH}/scripts/docs.sh
source ${SCRIPT_PATH}/scripts/install.sh
source ${SCRIPT_PATH}/scripts/uninstall.sh
source ${SCRIPT_PATH}/scripts/build.sh
source ${SCRIPT_PATH}/scripts/tests.sh
}
############################################################################################################################################################
############################################################################################################################################################
# Main
############################################################################################################################################################
echo "Initializing scripts . . ." && init_scripts
echo "Checking script dependencies . . ." && check_dependencies
case $1 in
"--install" | "-i") install $2 ;;
"--uninstall" | "-u") uninstall ;;
"--docs" | "-d") generate_docs $@ ;;
"--help" | "-h") usage ;;
"--version"| "-v") echo ${MODULE_VERSION} ;;
"--py") exec_python $2 ;;
"--tests" | "-t") run_tests ;;
"--coverage") run_coverage $2 ;;
"--clean") clean_module ;;
"--stats") run_stats ;;
"--wheel") generate_wheel_dist ;;
"--cython") generate_cython_dist ;;
"--mem") test_memory $2 ;;
"--check-dep") check_dependencies;;
*) script_error ;;
esac