Last active
June 13, 2017 00:04
-
-
Save arbianchi/66176123fb66f9f46509b31e30824120 to your computer and use it in GitHub Desktop.
Push All Unsolved Activities for the Week
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SETUP: | |
# 1. sudo chmod +x push_unsolved_activites.sh | |
# 2. Change 'activities' and 'classDir' paths to correspond to full path of local directories. | |
# 3. Run the script from the directory where it is located: ./push_unsolved_activities.sh 06-ajax | |
if [[ -z "$1" ]]; then | |
echo "Please pass in the week name. Ex: 10-nodejs" | |
exit 1 | |
else | |
week=$1 | |
fi | |
weekNum=${week:0:2} | |
# Set this to the appropriate local path | |
activities="/Users/adina/FullStack-Lesson-Plans/01-Class-Content/"$week"/01-Activities" | |
cd $activities | |
git reset --hard HEAD | |
git pull origin master | |
# Set this to the appropriate local path | |
classDir="/Users/adina/05-2017-Class-Repository/Class-Content/"$weekNum"-Week/Activities" | |
mkdir -p "$classDir" | |
cp -R "$activities"/* "$classDir" | |
cd $classDir | |
# Remove Solved and Solutions directories as well as "-solved" files | |
find . -type d -name 'Sol*' -exec rm -r {} + | |
find . -type f -name 'sol*' -exec rm -r {} + | |
git pull origin master | |
git add -A | |
git status | |
echo | |
read -p "Are you sure you want to add these files to the class directory? (Y/n)" -n 1 -r | |
echo | |
if [[ $REPLY =~ ^[Yy]$ ]] | |
then | |
git commit -m "Add Activities for $1" | |
git push origin master | |
echo | |
echo "$week Activities updated!" | |
else | |
echo | |
echo "Activity update canceled." | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment