Skip to content

Instantly share code, notes, and snippets.

@brhoades
Created March 2, 2017 15:30
Show Gist options
  • Save brhoades/cdec193fc61d41a9d76df08235b4529f to your computer and use it in GitHub Desktop.
Save brhoades/cdec193fc61d41a9d76df08235b4529f to your computer and use it in GitHub Desktop.
Build example assignments for grader import (use the default gradesheet).
#!/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