Permalink
Browse files

shorter output for downloading jars and poms

  • Loading branch information...
1 parent 8948874 commit f985775e4cd430c3ab7050cca52e28b7ae5ce993 @graemerocher graemerocher committed Jun 3, 2011
@@ -25,8 +25,9 @@ import org.apache.ivy.util.Message
import org.codehaus.groovy.grails.resolve.IvyDependencyManager
import org.codehaus.groovy.grails.resolve.GrailsCoreDependencies
import org.codehaus.groovy.runtime.StackTraceUtils
+import org.codehaus.groovy.grails.cli.logging.GrailsConsole
- /**
+/**
* <p>Represents the project paths and other build settings
* that the user can change when running the Grails commands. Defaults
* are provided for all settings, but the user can override those by
@@ -899,13 +900,13 @@ class BuildSettings extends AbstractBuildSettings {
dependencyManager = new IvyDependencyManager(appName,
appVersion, this, metadata)
+ def console = GrailsConsole.instance
dependencyManager.transferListener = { TransferEvent e ->
switch(e.eventType) {
case TransferEvent.TRANSFER_STARTED:
- println "Downloading: ${e.resource.name} ..."
- break
- case TransferEvent.TRANSFER_COMPLETED:
- println "Download complete."
+ def resourceName = e.resource.name
+ resourceName = resourceName[resourceName.lastIndexOf('/')+1..-1]
+ console.updateStatus "Downloading: ${resourceName}"
break
}
} as TransferListener
@@ -19,6 +19,7 @@
import jline.ConsoleReader;
import jline.Terminal;
import org.codehaus.groovy.runtime.DefaultGroovyMethods;
+import org.codehaus.groovy.runtime.typehandling.NumberMath;
import org.fusesource.jansi.Ansi;
import org.fusesource.jansi.Ansi.Color;
import org.fusesource.jansi.AnsiConsole;
@@ -160,10 +161,12 @@ public void indicateProgress(int number, int total) {
* @param number The number
* @param total The total
*/
- public void indicateProgressPercentage(int number, int total) {
+ public void indicateProgressPercentage(long number, long total) {
String currMsg = lastMessage;
try {
- updateStatus(new StringBuilder(currMsg).append(' ').append(Math.round((number/total)*100)).toString());
+ int percentage = Math.round(NumberMath.multiply(NumberMath.divide(number, total), 100).floatValue());
+ String message = new StringBuilder(currMsg).append(' ').append(percentage).append('%').toString();
+ updateStatus(message);
}
finally {
lastMessage = currMsg;
@@ -52,6 +52,8 @@ target(installPlugin:"Installs a plug-in for the given URL or name and version")
// (if provided) is the plugin version.
doInstallPlugin(pluginArgs[0], pluginArgs[1])
}
+
+ event("StatusFinal", ["Plugin installed."])
}
else {
event("StatusError", [ ERROR_MESSAGE])

0 comments on commit f985775

Please sign in to comment.