Skip to content

Instantly share code, notes, and snippets.

@arbianchi
Created June 12, 2017 23:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arbianchi/6ceea6ec837c317fc135a98b67defc05 to your computer and use it in GitHub Desktop.
Save arbianchi/6ceea6ec837c317fc135a98b67defc05 to your computer and use it in GitHub Desktop.
Push All Unsolved Activities for the Week
# SETUP:
# 1. sudo chmod +ox push_unsolved_activites.sh
# 2. Change 'activities' and 'classDir' paths to correspond to 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/curiousloop/UNC/FullStack-Lesson-Plans/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/curiousloop/UNC/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
echo
git add -A
echo `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 cancelled."
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment