K so I want the setup steps more specific.

Let's see if this can help.
This commit is contained in:
Daniel Dayley 2021-11-02 21:26:44 -06:00
parent ddeb6a4a45
commit 6357a60200
2 changed files with 18 additions and 2 deletions

View File

@ -5,7 +5,8 @@ import sys
import yaml
import logging
import argparse
import python-tool
# Import your custom libraries here
if __name__ == '__main__':

View File

@ -29,6 +29,12 @@ __missing_sed() {
__no_req "sed" && __no_req "gsed" && echo "sed or gsed is required to perform this function." && return 0
}
__require_bash() {
__no_req "sort" && return 1;
[[ $(printf "$1\n$BASH_VERSION" | sort -V | head -n 1) != "$1" ]] && return 1;
return 0
}
sed_i() {
__missing_sed && return 1;
if [[ "$OS" == "macOS" ]]; then
@ -44,7 +50,8 @@ sed_i() {
# Project creation
new_python_tool() {
# Download and rename the template repo
# Check that we can run this tool
if ! $(__require_bash "4.3"); then echo "Bash 4.3 or greater is required to run this script." && return 1; fi
__missing_reqs 'sed git find grep sort mv' && return 1
if [[ $(pwd) == *"python-tool"* ]]; then
echo "This script should not be run within the python-tool directory. Please move it to a neutral location to run." && return 1
@ -54,6 +61,8 @@ new_python_tool() {
if [[ $(echo "$1" | sed 's#^[a-z0-9\-]*$##' ) == "$NAME" ]]; then
echo "Tool name '""$NAME""' is invalid." && return 1
fi
# Download and rename the template repo
if [ ! -d ./python-tool ]; then
echo "Downloading template..."
git clone 'https://github.com/Cronocide/python-tool.git'
@ -68,6 +77,9 @@ new_python_tool() {
mv ./"$NAME"/com.cronocide."$NAME".plist ./"$NAME"/com."$USER"."$NAME".plist
echo "Configuring project..."
# Record setup instructions
declare -a PYTHON_TOOL_SETUP_INSTRUCTIONS
# Describe the project
echo "Describe the project: "
read DESCRIPTION
@ -84,6 +96,9 @@ new_python_tool() {
mkdir ./"$NAME"/"$NAME"
touch ./"$NAME"/"$NAME"/__init__.py
touch ./"$NAME"/"$NAME"/"$NAME".py
PYTHON_TOOL_SETUP_INSTRUCTIONS+="Put your main classes and functionality in $NAME/$NAME.py and import/use that functionality in bin/$NAME"
else
sed_i 's#import python-tool##g' ./"$NAME"/bin/"$NAME"
fi
# Configure package to install as a persistent service?