Browse Source

checkout的API

pull/1/head
richie 5 years ago
parent
commit
7225a34375
  1. 7
      src/main/java/com/fanruan/api/env/EnvKit.java
  2. 9
      src/test/java/com/fanruan/api/env/EnvKitTest.java

7
src/main/java/com/fanruan/api/env/EnvKit.java vendored

@ -41,4 +41,11 @@ public class EnvKit {
throw new IllegalArgumentException("Cannot set " + path + " as work directory."); throw new IllegalArgumentException("Cannot set " + path + " as work directory.");
} }
} }
/**
* 退出当前工作目录
*/
public static void checkout() {
SimpleWork.checkOut();
}
} }

9
src/test/java/com/fanruan/api/env/EnvKitTest.java vendored

@ -32,4 +32,13 @@ public class EnvKitTest extends Prepare {
EnvKit.setCurrent(path); EnvKit.setCurrent(path);
Assert.assertEquals(EnvKit.getCurrent().getPath(), path); Assert.assertEquals(EnvKit.getCurrent().getPath(), path);
} }
@Test
public void exit() {
String path = "usr/shared/webroot/WEB-INF";
EnvKit.setCurrent(path);
EnvKit.checkout();
Assert.assertNull(EnvKit.getCurrent());
Assert.assertNull(EnvKit.getWorkResource());
}
} }
Loading…
Cancel
Save