From c7c5567049485efeaedffee947a2334284f66100 Mon Sep 17 00:00:00 2001 From: Conrad Date: Thu, 16 Jan 2020 12:00:51 +0100 Subject: [PATCH] Merged release and merge preparation scripts --- mergeprep.sh | 15 -------- releaseprep.sh | 97 ++++++++++++++++++++++++++++++++++---------------- 2 files changed, 67 insertions(+), 45 deletions(-) delete mode 100755 mergeprep.sh diff --git a/mergeprep.sh b/mergeprep.sh deleted file mode 100755 index efdb194..0000000 --- a/mergeprep.sh +++ /dev/null @@ -1,15 +0,0 @@ -# Run CPP Check -echo "Running CPPCheck..." -cppcheck --enable=all --output-file=cppcheck_errors.txt src/ -cppcheck --check-config --output-file=cppcheck_config.txt src/ -echo "CPPCheck finished" -# Uncrustify Files -echo "Running Uncrustify..." -find . \( -name "*.cpp" -o -name "*.c" -o -name "*.h" \) -exec uncrustify -c conf/uncrustify.cfg --no-backup {} + -echo "Uncrustify finished." -# Adding changes to git -echo "Committing Changes to Git..." -git add '*' -git commit -m "Automated Merge Preparation" -echo "Committed." -echo "Finished." diff --git a/releaseprep.sh b/releaseprep.sh index 9ab4b1f..4077b41 100755 --- a/releaseprep.sh +++ b/releaseprep.sh @@ -1,30 +1,67 @@ -# Discarding local changes -echo "\033[0;33mThis will discard all your uncommited changes and restore the last commit. Continue?\033[0m" -read -git reset --hard -# Run CPP Check -echo "Running CPPCheck..." -cppcheck --enable=all --output-file=cppcheck_errors.txt src/ -cppcheck --check-config --output-file=cppcheck_config.txt src/ -echo "\033[0;32mCPPCheck finished\033[0m" -# Uncrustify Files -echo "Running Uncrustify..." -find . \( -name "*.cpp" -o -name "*.c" -o -name "*.h" \) -exec uncrustify -c conf/uncrustify.cfg --no-backup {} + -echo "\033[0;32mUncrustify finished.\033[0m" -# Remove Overhead Folders/ Files -echo "Cleaning directory..." -rm -r src/build-* -rm -r build-*/ -rm -r Examples/ -rm src/*.pro.user -echo "\033[0;32mDirectory cleaned.\033[0m" -# Run Doxygen -echo "Running Doxygen..." -doxygen conf/intelliphoto_dox -echo "\033[0;32mDoxygen finished.\033[0m" -# Adding changes to git -echo "Committing Changes to Git..." -git add '*' -git commit -m "Automated Release Preparation" -echo "\033[0;32mCommitted.\033[0m" -echo "\033[0;32mFinished.\033[0m" +printLine(){ + echo "$2$1 \033[0m" +} + +resetGit(){ + printLine "This will discard all your uncommited changes and restore the last commit. Continue?" "\033[0;33m" + read + git reset --hard + printLine "Git resetted." "\033[0;32m" +} + +runCPPCheck(){ + printLine "Running CPPCheck..." + cppcheck --enable=all --output-file=cppcheck_errors.txt src/ + cppcheck --check-config --output-file=cppcheck_config.txt src/ + printLine "CPPCheck finished" "\033[0;32m" +} + +runUncrustify(){ + printLine "Running Uncrustify..." + find . \( -name "*.cpp" -o -name "*.c" -o -name "*.h" \) -exec uncrustify -c conf/uncrustify.cfg --no-backup {} + + printLine "Uncrustify finished." "\033[0;32m" +} + +cleanDir(){ + printLine "Cleaning directory..." + rm -r src/build-* + rm -r build-*/ + rm -r Examples/ + rm src/*.pro.user + printLine "Directory cleaned." "\033[0;32m" +} + +runDoxygen(){ + printLine "Running Doxygen..." + doxygen conf/intelliphoto_dox + printLine "Doxygen finished." "\033[0;32m" +} + +gitCommit(){ + printLine "Committing Changes to Git..." + git add '*' + git commit -m "Automated Release Preparation" + printLine "Committed." "\033[0;32m" +} + +prepareMerge(){ + printLine "Merge Preparation started..." + printLine "Finished." "\033[0;32m" + exit +} + +prepareRelease(){ + printLine "Release Preparation started..." + printLine "Finished." "\033[0;32m" + exit +} + +echo "Merge/ Release Preparation for IntelliPhoto started." +while true; do + read -p "Do you want to prepare a (m)erge or a (r)elease?" yn + case $yn in + [Mm]* ) prepareMerge;; + [Rr]* ) prepareRelease;; + * ) echo "Please answer (m)erge or (r)elease.";; + esac +done