diff --git a/eclipse-solargraph-plugin/src/main/java/io/github/pyvesb/eclipse_solargraph/utils/GemHelper.java b/eclipse-solargraph-plugin/src/main/java/io/github/pyvesb/eclipse_solargraph/utils/GemHelper.java index 8a4a39a..360b004 100644 --- a/eclipse-solargraph-plugin/src/main/java/io/github/pyvesb/eclipse_solargraph/utils/GemHelper.java +++ b/eclipse-solargraph-plugin/src/main/java/io/github/pyvesb/eclipse_solargraph/utils/GemHelper.java @@ -26,11 +26,17 @@ public class GemHelper { + private static String buildGemCmd(String cmd, String gem) { + return String.format( + "gem %s -V -n \"%s\" %s", + cmd, getPluginStateLocation(), gem.toLowerCase() + ); + } + public static void install(String gem, StringPreferences pathPreference) { - String pluginStateLocation = getPluginStateLocation(); - String[] command = CommandHelper - .getPlatformCommand("gem install -V " + "-n " + pluginStateLocation + " " + gem.toLowerCase()); + String[] command = CommandHelper.getPlatformCommand(buildGemCmd("install", gem)); CommandJob installCommandJob = new CommandJob(gem, command, "Installation in progress"); + installCommandJob.addJobChangeListener(new JobChangeAdapter() { @Override @@ -51,8 +57,7 @@ public void done(IJobChangeEvent event) { } public static void scheduleUpdate(String gem, long delay) { - String[] command = CommandHelper - .getPlatformCommand("gem update -V " + "-n " + getPluginStateLocation() + " " + gem.toLowerCase()); + String[] command = CommandHelper.getPlatformCommand(buildGemCmd("update", gem)); new CommandJob(gem, command, "Update in progress").schedule(delay); }