io.ebean.docker.commands.SkipShutdown Maven / Gradle / Ivy
package io.ebean.docker.commands;
import java.io.File;
/**
* Detect if we should skip container stop/stopRemove for local development.
*
* Developers put a marker file ~/.ebean/ignore-docker-shutdown
which is then
* used by
*/
public class SkipShutdown {
/**
* Return true to skip docker container stop for local development.
*
*
*/
public static boolean isSkip() {
return new SkipShutdown().ignoreDockerShutdown();
}
/**
* For local development we most frequently want to ignore docker shutdown.
*
* So we just want the shutdown mode to be used on the CI server.
*/
boolean ignoreDockerShutdown() {
String localDev = System.getProperty("ebean.test.localDevelopment", "~/.ebean/ignore-docker-shutdown");
return ignoreDockerShutdown(localDev);
}
boolean ignoreDockerShutdown(String localDev) {
if (localDev.startsWith("~/")) {
File homeDir = new File(System.getProperty("user.home"));
return new File(homeDir, localDev.substring(2)).exists();
}
return new File(localDev).exists();
}
}