- Timestamp:
- 07/08/16 19:43:21 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/actions/Misc.java
r996 r1076 28 28 import java.io.FileNotFoundException; 29 29 import java.io.IOException; 30 import java.io.InputStream; 30 31 import java.io.InputStreamReader; 31 32 import java.lang.reflect.Method; … … 48 49 import org.expeditee.gui.AttributeUtils; 49 50 import org.expeditee.gui.Browser; 51 import org.expeditee.io.Conversion; 50 52 import org.expeditee.gui.DisplayIO; 53 import org.expeditee.io.ExpReader; 51 54 import org.expeditee.gui.Frame; 52 55 import org.expeditee.gui.FrameGraphics; … … 1446 1449 MessageBay.displayMessage("Re-extracted resources, Expeditee may need to be restarted for certain resources to be reloaded"); 1447 1450 } 1451 1452 // Some experimental actions to do with keeping framesets stored within a Git repository 1453 protected static String gitexe = "git"; 1454 1455 protected static void runGitCommand(Frame frame, List<String> cmd_array) { 1456 1457 String framePath = frame.getPath(); 1458 String frameName = frame.getName(); 1459 1460 String frameDir = framePath + Conversion.getFramesetName(frameName) 1461 + File.separator; 1462 String localFname = Conversion.getFrameNumber(frameName) 1463 + ExpReader.EXTENTION; 1464 1465 ProcessBuilder process_builder = new ProcessBuilder(cmd_array); 1466 1467 process_builder.directory(new File(frameDir)); 1468 1469 /* 1470 System.err.println("\nPATH:"); 1471 1472 Map<String, String> env_map = process_builder.environment(); 1473 1474 for (Entry<String, String> entry: env_map.entrySet()) { 1475 String key = entry.getKey(); 1476 String value = entry.getValue(); 1477 System.err.println(key + " = " + value); 1478 } 1479 */ 1480 1481 1482 try { 1483 final Process process = process_builder.start(); 1484 InputStream is = process.getInputStream(); 1485 InputStreamReader isr = new InputStreamReader(is); 1486 BufferedReader br = new BufferedReader(isr); 1487 String line; 1488 while ((line = br.readLine()) != null) { 1489 System.out.println(line); 1490 } 1491 System.out.println("Program terminated!"); 1492 } 1493 catch (Exception e) { 1494 e.printStackTrace(); 1495 } 1496 1497 } 1498 1499 public static void GitPushFrame() { 1500 1501 FrameKeyboardActions.Save(); 1502 1503 Frame current = DisplayIO.getCurrentFrame(); 1504 String userName = UserSettings.ProfileName.get(); 1505 1506 String frameName = current.getName(); 1507 String localFname = Conversion.getFrameNumber(frameName)+ ExpReader.EXTENTION; 1508 1509 List<String> status_cmd_array = new ArrayList<String>(); 1510 status_cmd_array.add(gitexe); 1511 status_cmd_array.add("status"); 1512 status_cmd_array.add("."); 1513 1514 List<String> add_cmd_array = new ArrayList<String>(); 1515 add_cmd_array.add(gitexe); 1516 add_cmd_array.add("add"); 1517 add_cmd_array.add(localFname); 1518 add_cmd_array.add("frame.inf"); 1519 1520 runGitCommand(current,add_cmd_array); 1521 1522 List<String> commit_cmd_array = new ArrayList<String>(); 1523 commit_cmd_array.add(gitexe); 1524 commit_cmd_array.add("commit"); 1525 commit_cmd_array.add("-m"); 1526 commit_cmd_array.add("expeditee-edit-"+userName); 1527 1528 runGitCommand(current,commit_cmd_array); 1529 1530 List<String> push_cmd_array = new ArrayList<String>(); 1531 push_cmd_array.add(gitexe); 1532 push_cmd_array.add("push"); 1533 push_cmd_array.add("origin"); 1534 push_cmd_array.add("master"); 1535 1536 runGitCommand(current,push_cmd_array); 1537 } 1538 1539 public static void GitPullFrame() { 1540 Frame current = DisplayIO.getCurrentFrame(); 1541 1542 List<String> cmd_array = new ArrayList<String>(); 1543 cmd_array.add(gitexe); 1544 cmd_array.add("pull"); 1545 cmd_array.add("origin"); 1546 cmd_array.add("master"); 1547 runGitCommand(current,cmd_array); 1548 1549 FrameIO.Reload(); 1550 FrameKeyboardActions.Refresh(); 1551 } 1552 1448 1553 }
Note:
See TracChangeset
for help on using the changeset viewer.