Permalink
Browse files

Added UI improvements to 'forge update' and 'forge about'

  • Loading branch information...
gastaldi committed Nov 14, 2012
1 parent 305883d commit be00c1649c684eeea1981123cd0812b391e00600
Showing with 13 additions and 7 deletions.
  1. +13 −7 shell/src/main/java/org/jboss/forge/shell/plugins/builtin/ForgePlugin.java
@@ -55,6 +55,7 @@
import org.jboss.forge.shell.ShellMessages;
import org.jboss.forge.shell.ShellPrintWriter;
import org.jboss.forge.shell.ShellPrompt;
+import org.jboss.forge.shell.Wait;
import org.jboss.forge.shell.events.PluginInstalled;
import org.jboss.forge.shell.events.PluginRemoved;
import org.jboss.forge.shell.events.ReinitializeEnvironment;
@@ -94,6 +95,9 @@
private final Shell shell;
private final Configuration configuration;
+ @Inject
+ private Wait wait;
+
@Inject
public ForgePlugin(final ForgeEnvironment environment, final Event<ReinitializeEnvironment> reinitializeEvent,
final ShellPrintWriter writer, final ShellPrompt prompt, final DependencyResolver resolver,
@@ -127,8 +131,10 @@ public void about(final PipeOut out)
out.println(" |_| \\___/|_| \\__, |\\___| ");
out.println(" |___/ ");
out.println("");
- out.println("JBoss Forge, version [ " + environment.getRuntimeVersion()
- + " ] - JBoss, by Red Hat, Inc. [ http://jboss.org/forge ]");
+ out.print(ShellColor.ITALIC, "JBoss Forge");
+ out.print(", version [ ");
+ out.print(ShellColor.BOLD, environment.getRuntimeVersion());
+ out.println(" ] - JBoss, by Red Hat, Inc. [ http://jboss.org/forge ]");
}
@Command(value = "restart", help = "Reload all plugins and default configurations")
@@ -460,6 +466,7 @@ public void update() throws IOException
}
else
{
+ shell.print(ShellColor.YELLOW, "***INFO*** ");
shell.print("This Forge installation will be updated to ");
shell.println(ShellColor.BOLD, forgeDistribution.getVersion());
if (prompt.promptBoolean("Is that ok ?", true))
@@ -483,12 +490,10 @@ private Dependency getLatestAvailableDistribution()
new NonSnapshotDependencyFilter(),
new DependencyFilter()
{
- /**
- * We are only interested in versions higher than the current version
- */
@Override
public boolean accept(Dependency dependency)
{
+ // We are only interested in versions higher than the current version
return dependency.getVersion().compareTo(runtimeVersion) > 0;
}
}
@@ -504,6 +509,7 @@ public boolean accept(Dependency dependency)
*/
private void updateForge(Dependency dependency) throws IOException
{
+ wait.start("Update in progress. Please wait");
List<DependencyResource> resolvedArtifacts = resolver.resolveArtifacts(dependency);
Assert.isTrue(resolvedArtifacts.size() == 1, "Artifact was not found");
DependencyResource resource = resolvedArtifacts.get(0);
@@ -519,8 +525,8 @@ private void updateForge(Dependency dependency) throws IOException
updateDirectory.delete(true);
}
childDirectory.renameTo(updateDirectory);
-
- ShellMessages.success(shell, "Forge will now restart to complete the update ...");
+ wait.stop();
+ ShellMessages.success(shell, "Forge will now restart to complete the update...");
System.exit(0);
}

0 comments on commit be00c16

Please sign in to comment.