Fix CLI script

This commit is contained in:
Dave Syer
2013-07-21 08:11:08 +01:00
parent 5d4f075011
commit 01ebd6da08
8 changed files with 25 additions and 14 deletions

View File

@@ -39,7 +39,7 @@ import java.util.Set;
*/
public class SpringCli {
public static final String CLI_APP = "spr";
public static final String CLI_APP = "spring";
private static final Set<SpringCliException.Option> NO_EXCEPTION_OPTIONS = EnumSet
.noneOf(SpringCliException.Option.class);

View File

@@ -33,6 +33,10 @@ import org.springframework.cli.compiler.GroovyCompiler;
*/
public class SpringApplicationRunner {
private static int watcherCounter = 0;
private static int runnerCounter = 0;
// FIXME logging
private SpringApplicationRunnerConfiguration configuration;
@@ -118,6 +122,7 @@ public class SpringApplicationRunner {
* @param sources the sources to launch
*/
public RunThread(Object... sources) {
super("runner-" + (runnerCounter++));
this.sources = sources;
if (sources.length != 0 && sources[0] instanceof Class) {
setContextClassLoader(((Class<?>) sources[0]).getClassLoader());
@@ -171,6 +176,7 @@ public class SpringApplicationRunner {
private long previous;
public FileWatchThread() {
super("filewatcher-" + (watcherCounter++));
this.previous = 0;
for (File file : SpringApplicationRunner.this.files) {
long current = file.lastModified();

View File

@@ -63,7 +63,7 @@ if [ -f build.gradle ]; then
TARGETDIR=build/classes/main
fi
for f in "${TARGETDIR}" "${SPRING_HOME}"/classes "${SPRING_BIN}" "${SPRING_HOME}"/*.jar "${SPRING_HOME}"/lib/*.jar; do
for f in . "${TARGETDIR}" "${SPRING_HOME}"/classes "${SPRING_BIN}" "${SPRING_HOME}"/*.jar "${SPRING_HOME}"/lib/*.jar; do
if [ -f $f -o -d $f ]; then
if [ "${CLASSPATH}" == "" ]; then
CLASSPATH="${f}"
@@ -77,4 +77,4 @@ if $cygwin; then
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
fi
${JAVA_HOME}/bin/java ${JAVA_OPTS} -cp "$CLASSPATH" org.springframework.bootstrap.cli.SpringBootstrapCli $*
${JAVA_HOME}/bin/java ${JAVA_OPTS} -cp "$CLASSPATH" org.springframework.cli.SpringCli $*

View File

@@ -133,7 +133,8 @@ public class SpringCliTests {
@Test
public void exceptionMessages() throws Exception {
assertThat(new NoSuchCommandException("name").getMessage(),
equalTo("spr: 'name' is not a valid command. See 'spr help'."));
equalTo(SpringCli.CLI_APP + ": 'name' is not a valid command. See '"
+ SpringCli.CLI_APP + " help'."));
}
@Test