From 7225a34375e494ac5371eff8deff6ff3ba697ae3 Mon Sep 17 00:00:00 2001 From: richie Date: Fri, 9 Aug 2019 17:36:23 +0800 Subject: [PATCH] =?UTF-8?q?checkout=E7=9A=84API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/fanruan/api/env/EnvKit.java | 7 +++++++ src/test/java/com/fanruan/api/env/EnvKitTest.java | 9 +++++++++ 2 files changed, 16 insertions(+) diff --git a/src/main/java/com/fanruan/api/env/EnvKit.java b/src/main/java/com/fanruan/api/env/EnvKit.java index c745880..bf24b3e 100644 --- a/src/main/java/com/fanruan/api/env/EnvKit.java +++ b/src/main/java/com/fanruan/api/env/EnvKit.java @@ -41,4 +41,11 @@ public class EnvKit { throw new IllegalArgumentException("Cannot set " + path + " as work directory."); } } + + /** + * 退出当前工作目录 + */ + public static void checkout() { + SimpleWork.checkOut(); + } } diff --git a/src/test/java/com/fanruan/api/env/EnvKitTest.java b/src/test/java/com/fanruan/api/env/EnvKitTest.java index a8ee617..1894b28 100644 --- a/src/test/java/com/fanruan/api/env/EnvKitTest.java +++ b/src/test/java/com/fanruan/api/env/EnvKitTest.java @@ -32,4 +32,13 @@ public class EnvKitTest extends Prepare { EnvKit.setCurrent(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()); + } } \ No newline at end of file