Merge "Add ui messages about updating or installing each plugin using pgm init"

This commit is contained in:
Edwin Kempin 2016-04-13 08:27:03 +00:00 committed by Gerrit Code Review
commit 92ba0dd270

View File

@ -132,9 +132,8 @@ public class InitPlugins implements InitStep {
if (upgrade) { if (upgrade) {
final String installedPluginVersion = getVersion(p); final String installedPluginVersion = getVersion(p);
if (!ui.yesno(upgrade, if (!ui.yesno(upgrade, "%s %s is already installed, overwrite it",
"version %s is already installed, overwrite it", plugin.name, installedPluginVersion)) {
installedPluginVersion)) {
Files.deleteIfExists(tmpPlugin); Files.deleteIfExists(tmpPlugin);
continue; continue;
} }
@ -147,6 +146,12 @@ public class InitPlugins implements InitStep {
} }
try { try {
Files.move(tmpPlugin, p); Files.move(tmpPlugin, p);
if (upgrade) {
// or update that is not an upgrade
ui.message("Updated %s to %s\n", plugin.name, plugin.version);
} else {
ui.message("Installed %s %s\n", plugin.name, plugin.version);
}
} catch (IOException e) { } catch (IOException e) {
throw new IOException("Failed to install plugin " + pluginName throw new IOException("Failed to install plugin " + pluginName
+ ": " + tmpPlugin.toAbsolutePath() + " -> " + ": " + tmpPlugin.toAbsolutePath() + " -> "