From 79bc4993bf3ee2e9620e992d8f0a084a3acc72ba Mon Sep 17 00:00:00 2001 From: ssube Date: Wed, 18 Sep 2019 18:43:01 -0500 Subject: [PATCH] feat(scripts): add project create and sync scripts (fixes #7) --- scripts/project-create.sh | 17 +++++++++++++++++ scripts/project-exclude | 3 +++ scripts/project-update.sh | 10 ++++++++++ 3 files changed, 30 insertions(+) create mode 100755 scripts/project-create.sh create mode 100644 scripts/project-exclude create mode 100755 scripts/project-update.sh diff --git a/scripts/project-create.sh b/scripts/project-create.sh new file mode 100755 index 0000000..4b69e10 --- /dev/null +++ b/scripts/project-create.sh @@ -0,0 +1,17 @@ +#! /bin/bash + +PROJECT_NAME="${1}" +PROJECT_PATH="${2:-${USER}}" + +echo "Creating project ${PROJECT_NAME}..." +mkdir ../"${PROJECT_NAME}" +pushd ../"${PROJECT_NAME}" + +echo "Setting up repository..." +git init +git remote add github git@github.com:${PROJECT_PATH}/${PROJECT_NAME}.git +git remote add gitlab git@git.apextoaster.com:${PROJECT_PATH}/${PROJECT_NAME}.git + +echo "Setting up template..." +popd +./scripts/project-update.sh "../${PROJECT_NAME}" \ No newline at end of file diff --git a/scripts/project-exclude b/scripts/project-exclude new file mode 100644 index 0000000..95d0a9d --- /dev/null +++ b/scripts/project-exclude @@ -0,0 +1,3 @@ +docs/api/ +src/app.ts +test/TestApp.ts \ No newline at end of file diff --git a/scripts/project-update.sh b/scripts/project-update.sh new file mode 100755 index 0000000..49a820e --- /dev/null +++ b/scripts/project-update.sh @@ -0,0 +1,10 @@ +#! /bin/bash +set -x + +PROJECT_NAME="${1}" + +echo "Updating project: ${PROJECT_NAME}" +git ls-tree -r HEAD --name-only | rsync -avh \ + --files-from=- \ + --exclude-from=./scripts/project-exclude \ + ./ "${PROJECT_NAME}" \ No newline at end of file