Last active
December 2, 2016 05:24
-
-
Save jchadwick/fa3919576bed6a802e0c292b45eb2299 to your computer and use it in GitHub Desktop.
Lynda.com courseware helpers
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
#!/bin/bash | |
gitRepo=$1 | |
repoName=$(echo $1 | sed '$s/.*\/\([^/]*$\)/\1/') | |
dest="$(dirname $(pwd))/$repoName-sync" | |
branch="ExerciseFiles" | |
if [ -d "$dest" ]; then | |
rm -rf $dest | |
fi | |
mkdir $dest | |
pushd $dest | |
git clone $gitRepo . | |
git tag | xargs git push --delete origin | |
git tag | xargs git tag -d | |
git branch -D $branch | |
git checkout --orphan $branch | |
git reset | |
git clean -df | |
popd | |
for chapter in * | |
do | |
pushd $chapter | |
for folder in $(ls -I artifacts) | |
do | |
echo "Syncing $chapter/$folder..." | |
pushd $folder | |
pushd $dest | |
rm -rf * | |
popd | |
cp -r . "$dest" | |
pushd $dest | |
find -iname desktop.ini -delete | |
find -iregex .*/images/.* -delete | |
git add -A . | |
git commit -am "$chapter/$folder" | |
git tag "$chapter/$folder" | |
popd | |
popd | |
done | |
popd | |
done | |
pushd $dest | |
git push -f --tags | |
popd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment