Browse Source

scripts to work with student repositories

master
Thomas Papendieck 2 years ago
parent
commit
94274c0b83
  1. 5
      README.md
  2. 3
      ciip-list-commits-per-author
  3. 2
      ciip-list-files--by-author
  4. 29
      ciip-rating-for
  5. 36
      ciip-run-custom-comand-random-commits-by-author
  6. 6
      ciip-run-greadle-random-commits-by-author
  7. 16
      ciip-run-maven-random-commits-by-author

5
README.md

@ -1,3 +1,6 @@
# Bewertung-Pruefungsleistungen
Scripte zur Auswertung der von den Studierenden eingereichten git repositories
Scripte zur Auswertung der von den Studierenden eingereichten git repositories
Dateirechte auf 700 setzen und nach `~/bin` kopieren

3
ciip-list-commits-per-author

@ -0,0 +1,3 @@
#!/bin/sh
git shortlog -s --all

2
ciip-list-files--by-author

@ -0,0 +1,2 @@
git log --pretty="%H" --author="$*" | while read commit_hash; do git show --oneline --name-only $commit_hash | tail -n+2; done | sort | uniq

29
ciip-rating-for

@ -0,0 +1,29 @@
#!/bin/bash
if [ $# -eq 0 ]; then
echo "creates a *.tex file for the name and matrikel number given"
echo "and fetches the folder name of the latest checked out project."
echo "usage:"
echo " $0 Student Name from List MATRIKEL_NO"
exit 1
fi
_args=( "$@" )
MATRIKEL_NR=${_args[-1]}
unset _args[${#_args[@]}-1]
PROJECT_PATH=$(ls -1t ../../ProjektArbeiten/ | head -1)
NAME="${_args[@]}"
FILE_NAME=${NAME//[ ]/_}
FILE_NAME=bewertung-${FILE_NAME//[,]/}.tex
cp -v bewertung-student.tex $FILE_NAME
sed -i -e "s/StudentsName} {}/StudentsName} {$NAME}/" $FILE_NAME
sed -i -e "s/Matrikel}\( \)* {}/Matrikel}\1 {$MATRIKEL_NR}/" $FILE_NAME
sed -i -e "s/in_der_Praxis\//in_der_Praxis\/$PROJECT_PATH/" $FILE_NAME

36
ciip-run-custom-comand-random-commits-by-author

@ -0,0 +1,36 @@
#!/bin/bash
if [ $# -eq 0 ]; then
echo "usage:"
echo " $0 'custom command' User Name as in git log"
exit 1
fi
_args=( "$@" )
COMMAND=${_args[0]}
unset _args[0]
AUTHOR="${_args[@]}"
LOG_FILE=${AUTHOR//\//}
LOG_FILE=${LOG_FILE// /}-commits.txt
BRANCH=$(git branch|grep -o ' .*')
BRANCH=${BRANCH// /}
#$COMMAND
echo $AUTHOR
git log --pretty="%H" --author="$AUTHOR" | shuf -n 5 | while read commit_hash; do git checkout $commit_hash ; $COMMAND ; echo $commit_hash ${PIPESTATUS[0]} >> $LOG_FILE ; done
git checkout $BRANCH
echo $AUTHOR
cat $LOG_FILE | sort -k 2 -k1 -u | sed -e 's/ 0/ OK/' -e 's/ [0-9]\+/ FAIL/' | tee $LOG_FILE
echo .
echo ---------------
ciip-list-commits-per-author

6
ciip-run-greadle-random-commits-by-author

@ -0,0 +1,6 @@
AUTHOR="$*"
GREADLE=/home/thomas/.gradle/wrapper/dists/gradle-6.8.1-bin/292llow5buzp6wg9rco3vjhoc/gradle-6.8.1/bin/gradle
git log --pretty="%H" --author="$AUTHOR" | shuf -n 5 > ${AUTHOR// /_}-commits.txt
cat ${AUTHOR// /_}-commits.txt
git checkout master

16
ciip-run-maven-random-commits-by-author

@ -0,0 +1,16 @@
AUTHOR="$*"
LOG_FILE=${AUTHOR//\//}
LOG_FILE=${LOG_FILE// /}-commits.txt
git log --pretty="%H" --author="$AUTHOR" | shuf -n 5 | while read commit_hash; do git checkout $commit_hash ; mvn test ; echo $commit_hash ${PIPESTATUS[0]} >> $LOG_FILE ; done
git checkout master
echo $AUTHOR
cat $LOG_FILE | sort -k 2 -k1 -u | sed -e 's/ 0/ OK/' -e 's/ [0-9]\+/ FAIL/' | tee $LOG_FILE
echo .
echo ---------------
ciip-list-commits-per-author
Loading…
Cancel
Save