-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgrade.sh
executable file
·68 lines (64 loc) · 1.84 KB
/
grade.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#! /bin/bash
#
# Usage: grade.sh lastname
#
# Looks for lastnamefirstname_*_client_secrets.py in 'credentials' directory,
# which should be a collection of files downloaded from Canvas.
#
# Expects to find repository url and author name in that file, along with
# other information required to run the program.
#
# Clones the git repository and attempts to install and test it
# Also creates MongoDB database user for application;
# May destroy old user before proceeding
#
# Cleanup before starting next project
#
echo "Cleaning up ... "
rm -rf to_grade
rm -f credentials.py
# if [[ -f to_grade/secrets/client_secrets.py ]]; then
# echo "Attempting to destroy database from prior student"
# python3 scripts/destroy_database.py
# fi;
#
# Find the files and links we need
#
prefix="$1"
credentials=`scripts/glob.sh ${prefix}`
if [[ ! -f ${credentials} ]] ; then
echo "Didn't match ${prefix} to a credentials file"
exit 1
else
echo "Using credentials file ${credentials}"
fi
cp ${credentials} scripts/credentials.py
author="`python3 scripts/extract_author.py`"
echo "Author: ${author}"
repo="`python3 scripts/extract_repo.py`"
echo "Repo: ${repo}"
if [[ "${repo}" == "" ]] ; then
echo "Missing repository URL; can't go on"
exit 1
fi
git clone -q ${repo} to_grade
if [[ ! -d to_grade/secrets ]]; then
mkdir to_grade/secrets
fi
cp ${credentials} to_grade/secrets/client_secrets.py
cp admin_secrets.py to_grade/secrets
cp google_client_key.json to_grade/secrets
pushd to_grade
echo "Last push to repo:"
git log | head -n 8 | grep Date
echo "Configuring"
bash ./configure
echo "Configuration complete"
. env/bin/activate
echo "Testing ... they should have some test cases"
nosetests
echo "**********************************"
echo "* ${author} "
echo "**********************************"
echo "Starting server with 'make run'"
make run