ENH: add repository automation scripts

This commit is contained in:
Timothy Helton 2018-01-03 15:55:08 -07:00
parent 9143e3808e
commit f53eb3a5f3
2 changed files with 53 additions and 0 deletions

33
create_project.sh Normal file
View File

@ -0,0 +1,33 @@
#!/usr/bin/env bash
# Exit if name argument is not given
if [ -z "$*" ]; then
echo "A project name argument must be provided."
exit 0
fi
NAME=$1
################################################################################
# Clone template repository
git clone https://github.com/TimothyHelton/cpp_project_template
# Create bare repository
git --bare init ${NAME}
# Push template master branch to bare repository
cd cpp_project_template
git push ../${NAME} +master:master
# Convert bare repository into a normal repository
cd ../${NAME}
mkdir .git
mv * .git
git config --local --bool core.bare false
git reset --hard
# Clean Up
rm -rf ../cpp_project_template ../create_project.sh

20
new_cpp_project.sh Normal file
View File

@ -0,0 +1,20 @@
#!/usr/bin/env bash
# Exit if name argument is not given
if [ -z "$*" ]; then
echo "A project name argument must be provided."
exit 0
fi
NAME=$1
################################################################################
# Download latest version of the build file
curl -O https://raw.githubusercontent.com/TimothyHelton/cpp_project_template/master/create_project.sh
chmod u+x create_project.sh
# Create Project
./create_project.sh ${NAME}