# This module defines metadata to be used by the batchSVN.py script. # # Copy this module as /class/csse//scripts/batchSVNData.py and # edit it to define the course metadata for . The sample data # in the original file can be used by invoking the batchSVN.py script using # "testing" as the course name argument, e.g.: ./batchSVN.py testing # ---------------------------------------------------------------- import os import sys # ----------------------------------------------------------------- # Quick helper method # Used for getting a single numeric response from user at keyboard # ----------------------------------------------------------------- def getChoice(fromVal, toVal): outputString = "Please enter your choice (" + \ str(fromVal) + "-" + str(toVal-1) + "): " done = False while not done: num = raw_input(outputString) if not num.isdigit() or int(num) < fromVal or int(num) >= toVal: print "Incorrect input value choice of " + str(num) + ", try again!" else: done = True #end while return num #end def # ---------------------------------------------------------------- # Hacks the system path so the import of batchSVNTypes works for testing # individual course meta-data on the the server. serverPathToBatchSVN = "/class/csse/resources/Grading" # Change the following line to point to your local checkout of the CSSE # resources trunk if you want to test this file on your local machine: #localMachinePathToBatchSVN = "/Users/cclifton/Documents/Rose/Administrative/resources/Grading" sys.path.append(serverPathToBatchSVN) #sys.path.append(localMachinePathToBatchSVN) from batchSVNTypes import * # ---------------------------------------------------------------- # ---------------------------------------------------------------- # Find out which term we want to use by displaying all the current # folders, each named a different year/term as in 201520. # ---------------------------------------------------------------- pathToStart = "/class/csse/csse220/scripts/" fileToNum = {} termsCount = 1 for each in os.listdir(pathToStart): inPath = os.path.join(pathToStart, each) if os.path.isdir(inPath) and each.startswith("2") and \ len(each.strip()) == 6: fileToNum[termsCount] = each termsCount += 1 if termsCount > 1: #This means that there is at least one folder to use... print "For the following, choose the number corresponding to the " +\ "term you wish to use: " for k in fileToNum.iterkeys(): print k, " for ", fileToNum[k] num = getChoice(1,termsCount) userChoice = fileToNum[int(num)] print "You chose " + userChoice repoNamePrefix = 'csse220-' + userChoice + '-' #used toward bottom else: repoNamePrefix = 'csse220-201520-' #end else/if """ ************************************************************************ * * * AT THIS POINT, repoNamePrefix has the corret class and term prefix * * needed to access the corret files for grading. * * * ************************************************************************ """ # replace the following with a description of the course, like 'CSSE 120' courseDescription = 'CSSE 220 - Object-Oriented Software Dev.' # ---------------------------------------------------------------- # Defines repositories sets for this course. Used by main script. # ---------------------------------------------------------------- if termsCount > 1: fileToNum = {} fileCount = 1 found = False preferredName = "userlist.txt" curTempPath = '/class/csse/csse220/scripts/' + userChoice + '/' for each in os.listdir(curTempPath): inPath = os.path.join(curTempPath, each) if os.path.isfile(inPath) and str(each) == preferredName: found = True if os.path.isfile(inPath) and str(each).endswith(".txt"): fileToNum[fileCount] = each fileCount += 1 #end for #Determine the type of project... localProject = {} i = 1 print "What is the project type you are needing?" for line in open("/class/csse/csse220/scripts/projects.txt"): print str(i) + " for " + line.strip() localProject[i] = line.strip() i += 1 projectChoice = getChoice(1,i) ###localProject[projectChoice] contains #either individual, or particular group projectType = localProject[int(projectChoice)] if not found or str(projectChoice) != "1": #Determine the file name print "Of the files listed below, which one contains the list of " +\ "all the repository names of each project? (this will " +\ "typically be choice (1)" for k in fileToNum.iterkeys(): print k, " for ", fileToNum[k] num = getChoice(1, fileCount) ###fileToNum[num] contains the correct file #to use if str(num) == "0": print "Since you're exiting without effectively doing anything, " +\ "please note that someone should set up the proper " +\ "folder and user list text file as described in the README.txt " +\ " in this directory and/or /class/csse/csse220/scripts/README.txt" sys.exit(1) #non standard exit code #endif preferredName = fileToNum[int(num)] print "You chose " + preferredName #end else curTempPath += preferredName else: #else, there's no folder for any term... maybe just guess or exit?? print "No directory structure found, just attempting to find the file " +\ "named 'userlist.txt'" curTempPath = '/class/csse/csse220/scripts/userlist.txt' userChoice = "201510" #just give a default #end else ################################# NOTES ################################### # 1) curTempPath is the full diretory path to the text file to scan # the repository names # 2) preferredName is just the name of that file # 3) projectType contains the type of project, i.e., Individual, # GameOfLife, BallWorlds or ArcadeGame. Perhaps more to come... ########################################################################### """ ************************************************************************* * * * Depending on the project type, and file above, now is the time to * * populate the corret data structures for later use in checking out * * student projects. * * * ************************************************************************* """ allRepos = [] reposSets = [] repoDesc = "" allSectionsFile = open(curTempPath, 'r') for line in allSectionsFile: allRepos.append(line.strip()) allSectionsFile.close() if str(projectType).lower().startswith("individual"): repoDesc = "All Students" else: repoDesc = projectType reposSets.append(RepositorySet("All Students", repoNamePrefix, allRepos)) # ---------------------------------------------------------------- # Defines project names and unit tests for this course. # Used by main script. # ---------------------------------------------------------------- projects = [] projects.append(Project("HW1")) projects.append(Project("TwelveProblems")) # Program from week 1 projects.append(Project("ObjectsAndMethods")) #HW2 projects.append(Project("MapAnd2DArrayHomework")) #HW projects.append(Project("TeamGradebook")) #HW4 and HW5 projects.append(Project("UnitTesting", "StringMethodsPracticeTest", "JUnitMoveTester")) #HW3 projects.append(Project("IntroToJavaGraphics")) #not graded, part of HW6 projects.append(Project("Scene")) #HW6 projects.append(Project("Decisions")) #HW6 projects.append(Project("FundamentalDataTypes")) #HW7 for Boutell projects.append(Project("Iteration", "AnnualInvestmentTest", "InvestmentTest")) #HW7 projects.append(Project("ArraysAndLists", "QuizScoresTest")) #HW8 projects.append(Project("TwoDArrays", "TicTacToeTest", "TicTacToeTestFromInstructors")) #HW10, individual projects.append(Project("Basketball")) #HW10, team0's projects.append(Project("MoreBasketball")) projects.append(Project("ImplementingDesign1")) projects.append(Project("ImplementingDesign2")) # projects.append(Project("TwoVsTwo")) #bonus project projects.append(Project("EncapsulationExamples")) # contains TwoVsTwo project #Show exam of choice term projects.append(Project(str("Exam1-" + userChoice))) #defaults to 201510 projects.append(Project(str("Exam1-" + userChoice + "-makeup"))) #defaults to 201510 projects.append(Project(str("Exam2-" + userChoice))) #same projects.append(Project(str("Final-" + userChoice))) #same projects.append(Project(str("Exam1"))) # in case generic names are used. projects.append(Project(str("Exam2"))) projects.append(Project(str("Final"))) projects.append(Project("Recursion","examples.SentenceTest")) #HW12 projects.append(Project("SierpinskiTriangle")) #HW12 projects.append(Project("Recursion2")) #HW13 projects.append(Project("RecursionPractice")) projects.append(Project("LinearLightsOut")) projects.append(Project("SortingAndSearching")) #HW14 projects.append(Project("FunctionObjects")) #HW?? projects.append(Project("ForkJoinIntro")) #HW15 projects.append(Project("DesigningClasses")) #HW16 projects.append(Project("OnToInterfaces", "bigRational.BasicBigRationalTest", "bigRational.LargeBigRationalTest")) #HW17 projects.append(Project("EventBasedProgramming")) #HW18 projects.append(Project("Inheritance")) #HW19, LinearLightsOut #projects.append(Project("Inheritance2")) #HW20, but nothing to grade #projects.append(Project("SwingDemo2")) #HW16 projects.append(Project("BallWorlds")) #HW20 projects.append(Project("OODesign")) #HW21 #projects.append(Project("Exam2", "problem1.CompareProblemTest", "problem2.MultiplierTest")) projects.append(Project("VectorGraphics")) projects.append(Project("TextTwisterMIDlet")) projects.append(Project("StrategyPattern")) projects.append(Project("LinkedLists")) #HW24 projects.append(Project("SinglyLinkedList")) projects.append(Project("DataStructures")) #HW25 #projects.append(Project("Exam2MakeUp")) projects.append(Project("FixedLengthQueue")) #HW25 projects.append(Project("AnimatedShapes")) #Exam 3 optional projects.append(Project("LodeRunner")) #HW25 projects.append(Project("Digger")) projects.append(Project("ArcadeGameProject")) projects.append(Project("Markov", "Milestone1Tests", "Milestone2Tests")) #projects.append(Project("FinalExam")) # ---------------------------------------------------------------- # Defines any additional main menu commands for this course. # Used by main script. # ---------------------------------------------------------------- menuItems = [] # ---------------------------------------------------------------- # A couple of extra menu items that are useful in a pinch, but aren't yet # sufficiently abstracted for general use. # def copyInExtras(data): # forEachRepo("cp ${scriptDir}/*.java ${shortName}/src/btwp/", data) # return False # menuItems.append(MenuItem('Copy in Exam2 test files',copyInExtras)) # # def runTestsExtraMem(data): # forEachRepo("cd ${shortName} && java -Xmx2000m -cp '${scriptDir}/junit-4.5.jar:bin' org.junit.runner.JUnitCore ${testClasses}", data) # return False # menuItems.append(MenuItem('Run JUnit tests with extra memory',runTestsExtraMem)) # ---------------------------------------------------------------- ###OLD COMMENTED CODE # section1File = open('/class/csse/csse220/scripts/csse220-201510-users01.txt', 'r') # section1Students = [] # for line in section1File: # section1Students.append(line.strip()) # section1File.close() # section2File = open('/class/csse/csse220/scripts/csse220-201510-users02.txt', 'r') # section2Students = [] # for line in section2File: # section2Students.append(line.strip()) # section2File.close() # section3File = open('/class/csse/csse220/scripts/csse220-201510-users03.txt', 'r') # section3Students = [] # for line in section3File: # section3Students.append(line.strip()) # section3File.close() #allStudents = [] #for line in section1File: # allStudents.append(line.strip()) #section1File.close() # allStudents = section1Students + section2Students + section3Students # reposSets.append(RepositorySet("Section 1&2 - Hewner", repoNamePrefix, section1Students + section2Students)) # reposSets.append(RepositorySet("Section 3 - Defoe", repoNamePrefix, section3Students)) reposSets.append(RepositorySet("crazyeights", repoNamePrefix, [ "crazyeights10", "crazyeights11", "crazyeights12", "crazyeights13", "crazyeights14", "crazyeights15", "crazyeights16", "crazyeights17", "crazyeights18", "crazyeights19", "crazyeights20", "crazyeights21", "crazyeights22", "crazyeights23", "crazyeights24", "crazyeights25", "crazyeights26", "crazyeights27", "crazyeights28", "crazyeights29", "crazyeights30", "crazyeights31", "crazyeights32", "crazyeights33", "crazyeights34", "crazyeights35", "crazyeights36", "crazyeights37", "crazyeights38", "crazyeights39", "crazyeights40", "crazyeights41", "crazyeights42", "crazyeights43", "crazyeights44", "crazyeights45", "crazyeights46", "crazyeights47", "crazyeights48", "crazyeights49", "crazyeights50", "crazyeights51", "crazyeights52", "crazyeights53", "crazyeights54", "crazyeights55", "crazyeights56", "crazyeights57", "crazyeights58", "crazyeights59", "crazyeights60" ])) """ ####This was done because the two teams were combined reposSets.append(RepositorySet("BallWorlds", repoNamePrefix, [ "gameoflife01", "gameoflife02", "gameoflife03", "gameoflife04", "gameoflife05", "gameoflife06", "gameoflife07", "gameoflife08", "gameoflife09", "gameoflife10", "gameoflife11", "gameoflife12", "gameoflife13", "gameoflife14", "gameoflife15", "gameoflife16", "gameoflife17", "gameoflife18", "gameoflife19", "gameoflife20", "gameoflife21", "gameoflife22", "gameoflife23", "gameoflife24", "gameoflife25", "gameoflife26", "gameoflife27", "gameoflife28", "gameoflife29", "gameoflife30", "gameoflife31", "gameoflife32", "gameoflife33", "gameoflife34", "gameoflife35", "gameoflife36", "gameoflife37", "gameoflife38", "gameoflife39", "gameoflife40", "gameoflife41" ])) #reposSets.append(RepositorySet("Ballworlds", repoNamePrefix, [ # "BW01", # "BW02", # "BW03", # "BW04", # "BW05", # "BW06", # "BW07", # "BW08", # "BW09", # "BW10", # "BW11", # "BW12", # "BW13", # "BW14", # "BW15", # "BW16", # "BW17", # "BW18", # "BW19", # "BW20", # "BW21", # "BW22", # "BW23", # "BW24", # "BW25", # "BW26", # "BW27", # "BW28", # "BW29", # "BW30", # "BW31", # "BW32", # "BW33", # "BW34", # "BW35", # "BW36" #])) reposSets.append(RepositorySet("Loderunner", repoNamePrefix, [ "LR01", "LR02", "LR03", "LR04", "LR05", "LR06", "LR07", # "LR08", "LR09", "LR10", "LR11", "LR12", "LR13", "LR14", "LR15", "LR16" ])) reposSets.append(RepositorySet("Digger", repoNamePrefix, [ "digger01", "digger02", "digger03", "digger04", "digger05", "digger06", "digger07", "digger08", "digger09", "digger10", "digger11", "digger12", "digger13", "digger14", "digger15", "digger16", "digger17", "digger18", "digger19", "digger20", "digger21", "digger22", "digger23", "digger24", "digger25", "digger26" ])) """ reposSets.append(RepositorySet("Arcade Game", repoNamePrefix, [ "arcadegame11", "arcadegame12", "arcadegame13", "arcadegame14", "arcadegame15", "arcadegame16", "arcadegame17", "arcadegame21", "arcadegame22", "arcadegame23", "arcadegame24", "arcadegame25", "arcadegame26", "arcadegame30", "arcadegame32", "arcadegame33", "arcadegame34", "arcadegame35" ])) # *************************************************************************** # ---------------------------------------------------------------- # Some test code, executed if this file is imported directly into # a python shell. Shouldn't need to change this when specifying # course-specific data above. # ---------------------------------------------------------------- if __name__ == '__main__': print "reposSets ==", reposSets print "Repositories from reposSets[0]:" for r in reposSets[0].repos(): print " ", r print "repository names: ", [r.name for r in reposSets] print print projects print "Test classes:" for p in projects: print " %s: %s" % (p.name, p.testClasses) print "Additional Menu Items' Text:" for mi in menuItems: print " ", mi.text