-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathgradeRepos.sh
executable file
·90 lines (76 loc) · 3.25 KB
/
gradeRepos.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/usr/bin/env bash
testUnderBar() {
echo "in testUnderbar"
echo $1
echo 'var window = global;' >> "$1/src/underbarTestOne.js"
cat "$1/src/underbar.js" >> "$1/src/underbarTestOne.js"
cat "./graders/underbarTestOne.js" >> "$1/src/underbarTestOne.js"
mocha "$1/src/underbarTestOne.js" -R postingMochaReporter $2 UnderbarOne
echo 'var window = global;' >> "$1/src/underbarTestTwo.js"
cat "$1/src/underbar.js" >> "$1/src/underbarTestTwo.js"
cat "./graders/underbarTestTwo.js" >> "$1/src/underbarTestTwo.js"
mocha "$1/src/underbarTestTwo.js" -R postingMochaReporter $2 UnderbarTwo
}
testRecursion() {
echo "in testRecursion"
echo $1
cat "$1/src/getElementsByClassName.js" >> "$1/src/tester.js"
cat "$1/src/parseJSON.js" >> "$1/src/tester.js"
cat "$1/src/stringifyJSON.js" >> "$1/src/tester.js"
cat "./graders/recursionTest.js" >> "$1/src/tester.js"
mocha "$1/src/tester.js" -R postingMochaReporter.js $2 Recursion
}
testTestbuilder() {
echo "in testTestbuilder"
echo $1
cat "$1/detectNetwork.js" >> "$1/test.js"
cat "./graders/testbuilderTest.js" >> "$1/test.js"
cat "$1/detectNetwork.test.js" >> "$1/test.js"
mocha "$1/test.js" -R postingMochaReporter.js $2 Testbuilder
}
testKoans() {
echo "in testKoans"
echo $1
mkdir "$1/koans/test"
for filepath in $1/koans/*.js; do
filename=$(basename $filepath)
echo "Lol"
echo $filename
cat "./graders/koansTest.js" >> "$1/koans/test/test$filename"
cat "$filepath" >> "$1/koans/test/test$filename"
test="$1/koans/test/test${filename}"
echo $test
jasmine "$test" "-$1/koans/test" $2 Koans
done
node ./sendData.js "$1/koans/test/score.txt" $2 Koans
}
CLASSLISTGET="curl http://35.173.188.239:3000/api/classlist"
echo $CLASSLISTGET
CLASSLIST=`$CLASSLISTGET`
for i in $CLASSLIST; do
STUDENTLISTGET="curl http://35.173.188.239:3000/api/bashclassnames?c=$i"
echo $STUDENTLISTGET
STUDENTLIST=`$STUDENTLISTGET`
for j in $STUDENTLIST; do
echo $j
rm -rf ./server/client/ClassContainer/$i/$j
git clone --quiet https://github.com/$j/$i-recursion ./server/client/ClassContainer/$i/$j/recursion
git clone --quiet https://github.com/$j/$i-twittler ./server/client/ClassContainer/$i/$j/twittler
git clone --quiet https://github.com/$j/$i-testbuilder ./server/client/ClassContainer/$i/$j/testbuilder
git clone --quiet https://github.com/$j/$i-javascript-koans ./server/client/ClassContainer/$i/$j/javascript-koans
git clone --quiet https://github.com/$j/$i-underbar ./server/client/ClassContainer/$i/$j/underbar
if [ -e ./server/client/ClassContainer/$i/$j/underbar/src/underbar.js ]; then
testUnderBar "./server/client/ClassContainer/$i/$j/underbar" $j
fi
if [ -e ./server/client/ClassContainer/$i/$j/recursion/src/getElementsByClassName.js ]; then
testRecursion "./server/client/ClassContainer/$i/$j/recursion" $j
fi
if [ -e ./server/client/ClassContainer/$i/$j/testbuilder/detectNetwork.js ]; then
testTestbuilder "./server/client/ClassContainer/$i/$j/testbuilder" $j
fi
if [ -e ./server/client/ClassContainer/$i/$j/javascript-koans/koans/AboutApplyingWhatWeHaveLearnt.js ]; then
testKoans "./server/client/ClassContainer/$i/$j/javascript-koans" $j
fi
done
done
echo $(date) >> runtimes.txt