Update readme and add more defaults

This commit is contained in:
Antonio J. Delgado 2022-06-14 09:52:01 +03:00
parent 72c2ac2d9f
commit c84237c384
3 changed files with 29 additions and 8 deletions

View file

@ -1 +1,21 @@
# Python skeleton
## Usage
Run:
deploy_new_python_project.sh --project-name "My Project" --project-codename my_project --deployment-path /path/to/my/repos/
This will create the folder /path/to/my/repos/my_project with the skeleton inside and the text replaced for each option passed to the script. Check deploy_new_python_project.sh --help to see more options.
deploy_new_python_project [--help|-h|-?] [--author|-a 'Author name'] [--authoring-date|-d 'date of creation'] [--project-name|-n 'Name of the project'] [--project-codename|-p short_project_name] [--version|-v 'version number'] [--deployment-path|-r 'path/to/copy/skeleton'] [--author-email|-e 'email@example.org'] [--url|-u 'https://domain.com'] [--license|-l 'LICENSEv1']
--help Show this help.
--author Author name, between quotes for spaces.
--authoring-date Date when the script was created.
--project-name Long name of the project.
--project-codename Short name without spaces for command line script.
--version Initial version 0.0.1?
--deployment-path Path to deploy the skeleton.
--author-email Email address of the author.
--url URL of the project.
--license License name.
--license-url License URL to fetch in plain text and save in your project folder.
--description Description.

View file

@ -5,8 +5,9 @@ export AUTHORING_DATE=$(date +%Y)
export PROJECT_NAME="Project Name"
export PROJECT_CODENAME="project-codename"
export VERSION=0.0.1
export DEPLOYMENT_PATH="${HOME}/repos/"
export DEPLOYMENT_PATH="${HOME}/src/"
export DESCRIPTION=""
export AUTHOR_EMAIL=""
export URL=""
export LICENSE="GPLv3"
export LICENSE="GPLv3"
export LICENSE_URL="https://www.gnu.org/licenses/gpl-3.0.txt"

View file

@ -24,7 +24,7 @@ function usage() {
# shellcheck disable=SC1090
if [ -e "$(dirname "${0}")/defaults" ]
then
. "$(dirname "${0}")/defaults"
source "$(dirname "${0}")/defaults"
fi
while [ $# -gt 0 ]
do
@ -80,7 +80,7 @@ do
;;
"--license-url"|"-U")
shift
license_url="${1}"
LICENSE_URL="${1}"
shift
;;
"--description")
@ -102,13 +102,13 @@ destination_path="${DEPLOYMENT_PATH}/${PROJECT_CODENAME}"
mkdir -p "${DEPLOYMENT_PATH}"
script_path=$(dirname "${0}")
cp "${script_path}/skeleton" "${destination_path}" -rfp
if [ -z "${license_url}" ]; then
if [ -z "${LICENSE_URL}" ]; then
case "${license}" in
"GPLv3")
license_url="https://www.gnu.org/licenses/gpl-3.0.txt"
LICENSE_URL="https://www.gnu.org/licenses/gpl-3.0.txt"
;;
"GPLv2")
license_url="https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt"
LICENSE_URL="https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt"
;;
"GPLv1"|"GPL")
licence_url="https://www.gnu.org/licenses/old-licenses/gpl-1.0.txt"
@ -119,7 +119,7 @@ if [ -z "${license_url}" ]; then
esac
fi
if [ -n "${licence_url}" ]; then
curl -s "${license_url}" > "${destination_path}/LICENSE"
curl -s "${LICENSE_URL}" > "${destination_path}/LICENSE"
fi
mv "${destination_path}/project_codename" "${destination_path}/${PROJECT_CODENAME}"
mv "${destination_path}/${PROJECT_CODENAME}/project_codename.py" "${destination_path}/${PROJECT_CODENAME}/${PROJECT_CODENAME}.py"