diff --git a/src/main/java/dev/cerus/deployhelper/Launcher.java b/src/main/java/dev/cerus/deployhelper/Launcher.java index 774a268..ea39f39 100644 --- a/src/main/java/dev/cerus/deployhelper/Launcher.java +++ b/src/main/java/dev/cerus/deployhelper/Launcher.java @@ -7,16 +7,11 @@ import com.google.gson.LongSerializationPolicy; import dev.cerus.deployhelper.configuration.Config; import dev.cerus.deployhelper.deploy.Deployer; -import dev.cerus.deployhelper.gson.ArtifactSectionAdapter; -import dev.cerus.deployhelper.gson.CommandsSectionAdapter; -import dev.cerus.deployhelper.gson.ConfigAdapter; -import dev.cerus.deployhelper.gson.DestinationAdapter; -import dev.cerus.deployhelper.gson.SSHSectionAdapter; +import dev.cerus.deployhelper.gson.*; + import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; -import java.net.URISyntaxException; -import java.util.Collections; public class Launcher { @@ -66,17 +61,6 @@ public static void main(final String[] args) { deployer.deploy(); } - private static void fail(final OptionsParser parser) { - File jar = new File("deploy-helper.jar"); - try { - jar = new File(Launcher.class.getProtectionDomain().getCodeSource().getLocation().toURI()); - } catch (final URISyntaxException ignored) { - } - - System.out.println("Usage: java -jar " + jar.getName() + " OPTIONS"); - System.out.println(parser.describeOptions(Collections.emptyMap(), OptionsParser.HelpVerbosity.LONG)); - } - public static class Options extends OptionsBase { @Option( diff --git a/src/main/java/dev/cerus/deployhelper/deploy/Deployer.java b/src/main/java/dev/cerus/deployhelper/deploy/Deployer.java index df7c043..1637373 100644 --- a/src/main/java/dev/cerus/deployhelper/deploy/Deployer.java +++ b/src/main/java/dev/cerus/deployhelper/deploy/Deployer.java @@ -3,16 +3,12 @@ import dev.cerus.deployhelper.Launcher; import dev.cerus.deployhelper.configuration.Config; import dev.cerus.deployhelper.util.TriFunction; + import java.io.File; import java.io.IOException; import java.io.OutputStream; import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Comparator; -import java.util.List; -import java.util.Map; -import java.util.Objects; +import java.util.*; import java.util.stream.Collectors; public class Deployer { @@ -46,7 +42,7 @@ public void deploy() { final File artifact = this.findArtifact(); // Check arguments - if (this.options.destination != null && this.options.destination.length() > 0) { + if (!"".equals(this.options.destination)) { // Loop through the specified destinations and run deploy tasks for (final String destName : this.options.destination.split(",")) { final Config.Destination destination = destinationMap.get(destName); @@ -187,7 +183,6 @@ private void execSsh(final Config.Destination destination) { * @param command The command array * @param destination The destination * @param artifact The artifact to deploy - * * @return A command array with replaced variables */ private String[] prepareCommand(final String[] command, final Config.Destination destination, final File artifact) {