@@ -46,12 +46,11 @@ public class LabCodeRepoSetupMain {
46
46
*/
47
47
public static void main (String [] args ) throws Exception {
48
48
HashSet <GHUser > allStudents = new HashSet <>();
49
- String path = FileSelectionFactory .GetFile (
50
- new File ("." )
51
- ,new ExtensionFilter ("json file" ,"*.JSON" ,"*.json" )
52
- )
53
- .getAbsolutePath ();
54
- String teamAssignmentsFile = path ;
49
+
50
+
51
+ String teamAssignmentsFile = LabCodeRepoSetupMain .getTeamAssignmentFile (args );
52
+ GitHub github = LabCodeRepoSetupMain .getGithub ();
53
+
55
54
int numberOfTeams = 0 ;
56
55
57
56
Gson gson = new GsonBuilder ().disableHtmlEscaping ().setPrettyPrinting ().create ();
@@ -115,20 +114,6 @@ public static void main(String[] args) throws Exception {
115
114
}
116
115
117
116
118
- File workspace = new File (System .getProperty ("user.home" ) + "/bowler-workspace/" );
119
- if (!workspace .exists ()) {
120
- workspace .mkdir ();
121
- }
122
- try {
123
- PasswordManager .loadLoginData (workspace );
124
- } catch (Exception e ) {
125
- // TODO Auto-generated catch block
126
- e .printStackTrace ();
127
- }
128
- PasswordManager .login ();
129
- GitHub github = PasswordManager .getGithub ();
130
-
131
-
132
117
GHOrganization dest = github .getMyOrganizations ().get (projectDestBaseName );
133
118
134
119
if (dest == null ) {
@@ -422,7 +407,38 @@ public static void main(String[] args) throws Exception {
422
407
}
423
408
}
424
409
}
410
+ System .exit (0 );
411
+ }
425
412
413
+ public static String getTeamAssignmentFile (String [] args ) {
414
+ @ SuppressWarnings ("restriction" )
415
+ String path = FileSelectionFactory .GetFile (
416
+ new File ("." )
417
+ ,new ExtensionFilter ("json file" ,"*.JSON" ,"*.json" )
418
+ )
419
+ .getAbsolutePath ();
420
+ String teamAssignmentsFile ;
421
+ if (args .length ==0 )
422
+ teamAssignmentsFile = path ;
423
+ else
424
+ teamAssignmentsFile =args [0 ];
425
+ return teamAssignmentsFile ;
426
+ }
427
+
428
+ public static GitHub getGithub () throws IOException {
429
+ File workspace = new File (System .getProperty ("user.home" ) + "/bowler-workspace/" );
430
+ if (!workspace .exists ()) {
431
+ workspace .mkdir ();
432
+ }
433
+ try {
434
+ PasswordManager .loadLoginData (workspace );
435
+ } catch (Exception e ) {
436
+ // TODO Auto-generated catch block
437
+ e .printStackTrace ();
438
+ }
439
+ PasswordManager .login ();
440
+ GitHub github = PasswordManager .getGithub ();
441
+ return github ;
426
442
}
427
443
428
444
public static void run (List <String > commands , File dir ) throws Exception {
0 commit comments