Created
March 2, 2017 15:30
-
-
Save brhoades/cdec193fc61d41a9d76df08235b4529f to your computer and use it in GitHub Desktop.
Build example assignments for grader import (use the default gradesheet).
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 | |
# Builds example submissions / assignment.yml for use with: | |
# grader import --kind multiple | |
if [ -z "$1" ]; then | |
echo "./build-test-assignments.sh [number of assignments]" | |
echo " Builds mock assignments for local testing." | |
exit 0 | |
fi | |
if [ ! -d "./assignments" ]; then | |
mkdir "./assignments" | |
fi | |
users=() | |
for i in $(seq 1 $1); do | |
users=("${users[@]}" $(openssl rand -hex 6)) | |
done | |
echo "roster:" > assignment.yml | |
for user in "${users[@]}"; do | |
folder="$user" | |
mkdir "$folder" | |
touch "$folder/file" | |
tar -cf "assignments/$user.tar.gz" "$folder" | |
echo " - id: $user" >> assignment.yml | |
echo " name: $user" >> assignment.yml | |
rm -rf "$folder" | |
done | |
rm -f some_file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment