Skip to content

Commit

Permalink
Release v2.3 - Add verify-turnin
Browse files Browse the repository at this point in the history
  • Loading branch information
daknob committed Oct 7, 2014
1 parent c38c6db commit df26450
Show file tree
Hide file tree
Showing 7 changed files with 107 additions and 2 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ dep/
obj/
*.o
*.d
*~
*~
*.swp
*.DS_Store
5 changes: 5 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
CHANGELOG:

2014-10-07 Antonios A. Chariton <[email protected]>
- Added verify-turnin to verify a turnin
- Renamed the scripts for extraction
- Release v2.3

2014-09-27 Foivos S. Zakkak <[email protected]>
- Change the directory structure of the project (getting ready to slice
turnin.c)
Expand Down
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ install: check turnin uninstall
cp -p turnin $(DESTDIR)/bin/
chmod ug+s $(DESTDIR)/bin/turnin
cp -p man/turnin.1 $(DESTDIR)/share/man/man1/
cp -p scripts/verify-turnin $(DESTDIR)/bin
chmod 755 $(DESTDIR)/bin/verify-turnin

uninstall: check
-rm -f \
Expand Down
File renamed without changes.
File renamed without changes.
96 changes: 96 additions & 0 deletions scripts/verify-turnin
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
#!/usr/bin/python

##########################################################################
# The MIT License (MIT) #
# #
# Copyright (c) 2014 Antonios A. Chariton <[email protected]> #
# #
# Permission is hereby granted, free of charge, to any person obtaining #
# a copy of this software and associated documentation files (the #
# "Software"), to deal in the Software without restriction, including #
# without limitation the rights to use, copy, modify, merge, publish, #
# distribute, sublicense, and/or sell copies of the Software, and to #
# permit persons to whom the Software is furnished to do so, subject to #
# the following conditions: #
# #
# The above copyright notice and this permission notice shall be #
# included in all copies or substantial portions of the Software. #
# #
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, #
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF #
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND #
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE #
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION #
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION #
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #
##########################################################################

##########################################################################
# #
# Verifies if the current user has successfully turned in an #
# assignment for assignment in class. #
# #
##########################################################################

import sys,os

ver = "1.0"

def usage():
print (" verify-turnin v" + ver)
print " Usage: "
print " verify-turnin assignment@course "
print " \tVerify the turnin has been successful "
print " verify-turnin -V "
print " \tShow Copyright and Version information "

def versionstuff():
print (" verify-turnin v" + ver)
print " Copyright: "
print " Copyright (c) 2014 \tAntonios A. Chariton \t<[email protected]> "
print " License: "
print " The current file is under the MIT License. "
print " You can obtain a copy of the license here: <http://opensource.org/licenses/MIT> "
print " Development: "
print " Source Code available on GitHub: <https://github.com/zakkak/turnin> "

def isDir(path):
return (os.path.exists(path) and os.path.isdir(path))

if(len(sys.argv) != 2): # On improper calls, return usage information
usage()
exit(1) # Improper Call

if(sys.argv[1] == "-V" or sys.argv[1] == "-v"): # Handle version and copyright
versionstuff()
exit(0)

if(not("@" in sys.argv[1])): # Check if the argument supplied is indeed "properly" formatted
usage()
exit(1)

argz = sys.argv[1].split("@") # Split the argument supplied by using @ as a delimiter
assignment = argz[0] # The first field is the assignment
course = argz[1] # The second field is the course
# For the others we don't *really* care that much :P

classDir = os.path.expanduser("~" + course)

if (not(isDir(classDir))): # Check if the user has a home directory
print " Could not find specified course "
exit(2) # Could not find course
if (not(isDir(classDir + "/TURNIN/" + assignment))): # Check if the assignment exists
print " Could not find assignment directory "
exit(3) # Could not find assignment

grep = os.system("ls '" + classDir + "/TURNIN/" + assignment + "' | grep `whoami` | grep -v '#' > /dev/null 2> /dev/null")
if( grep == 0 ):
print (" You have successfully turned in " + assignment + " for " + course + " ")
else:
grep = os.system("ls '" + classDir + "/TURNIN/" + assignment + "' | grep `whoami` > /dev/null 2> /dev/null")
if ( grep == 0 ):
print (" You have attempted to turn in " + assignment + " for " + course + " but it is not valid.")
else:
print (" You have not turned in " + assignment + " for " + course + "! ")


2 changes: 1 addition & 1 deletion src/turnin.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
/*
* Global variables
*/
char *turninversion = "v2.2.3";
char *turninversion = "v2.3";

char *user_name;

Expand Down

0 comments on commit df26450

Please sign in to comment.