Created install script and updated tasks to match
This commit is contained in:
parent
8fe263901e
commit
5cf5b75be4
|
@ -1 +1,2 @@
|
|||
.env
|
||||
.env
|
||||
launch.sh
|
|
@ -4,7 +4,7 @@
|
|||
{
|
||||
"label": "Run Project",
|
||||
"type": "shell",
|
||||
"command": "source ${workspaceFolder}/.deltabotenv/bin/activate && ${workspaceFolder}/.deltabotenv/bin/python ${workspaceFolder}/src/main.py",
|
||||
"command": "launch.sh",
|
||||
"problemMatcher": [],
|
||||
"group": {
|
||||
"kind": "build",
|
||||
|
|
|
@ -1 +1,48 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Colors
|
||||
GREEN='\033[0;32m'
|
||||
RED='\033[0;31m'
|
||||
NC='\033[0m'
|
||||
|
||||
# Print commands
|
||||
print_success() {
|
||||
echo -e "${GREEN}[SUCCESS]${NC} $1"
|
||||
}
|
||||
|
||||
print_error() {
|
||||
echo -e "${RED}[ERROR]${NC} $1"
|
||||
}
|
||||
|
||||
# Creating virtualenv
|
||||
if ! python3 -m venv .deltabotenv; then
|
||||
print_error "Python3 returnded a non-zero error code during virtualenv creation"
|
||||
fi
|
||||
|
||||
# Activate python vitualenv to install librairies
|
||||
source .deltabotenv/bin/activate
|
||||
|
||||
# Install librairies
|
||||
if ! pip install discord.py; then
|
||||
print_error "Pip returned a non-zero error code during installation of discord.py"
|
||||
exit 1
|
||||
fi
|
||||
if ! pip install python-dotenv; then
|
||||
print_error "Pip returned a non-zero error code during installation of python-dotenv"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Quit python virtualenv
|
||||
deactivate
|
||||
|
||||
# Create launch file
|
||||
cat > launch.sh << 'EOF'
|
||||
# Activate python vitualenv to install librairies
|
||||
source .deltabotenv/bin/activate
|
||||
|
||||
# Launch bot
|
||||
.deltabotenv/bin/python3 src/main.py
|
||||
EOF
|
||||
chmod +x launch.sh
|
||||
|
||||
echo -e "\nPython configuration created execute launch.sh to launch discord bot."
|
||||
|
|
Loading…
Reference in New Issue