This commit is contained in:
Phillip Webb
2013-05-31 12:26:30 -07:00
parent 969c7d6fa1
commit 7e3c158f3a
175 changed files with 1040 additions and 286 deletions

View File

@@ -16,7 +16,6 @@
package org.springframework.bootstrap.cli;
/**
* A single command that can be run from the CLI.
*

View File

@@ -13,16 +13,24 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.bootstrap.cli;
import java.util.Collection;
import java.util.ServiceLoader;
/**
* @author Dave Syer
* Factory used to create CLI {@link Command}s. Intended for use with a Java
* {@link ServiceLoader}.
*
* @author Dave Syer
*/
public interface CommandFactory {
/**
* Returns the CLI {@link Command}s.
* @return The commands
*/
Collection<Command> getCommands();
}

View File

@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.bootstrap.cli.command;
import java.io.File;
@@ -30,7 +31,6 @@ import org.springframework.bootstrap.cli.Command;
* download on the next attempt to resolve.
*
* @author Dave Syer
*
*/
public class CleanCommand extends OptionParsingCommand {

View File

@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.bootstrap.cli.command;
import java.util.Arrays;
@@ -23,8 +24,9 @@ import org.springframework.bootstrap.cli.Command;
import org.springframework.bootstrap.cli.CommandFactory;
/**
* @author Dave Syer
* Default implementation of {@link CommandFactory}.
*
* @author Dave Syer
*/
public class DefaultCommandFactory implements CommandFactory {

View File

@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.bootstrap.cli.command;
import groovy.lang.Closure;
@@ -27,12 +28,15 @@ import joptsimple.OptionSet;
import joptsimple.OptionSpecBuilder;
/**
* @author Dave Syer
* A handler that parses and handles options.
*
* @author Dave Syer
* @see OptionParsingCommand
*/
public class OptionHandler {
private OptionParser parser;
private Closure<Void> closure;
public OptionSpecBuilder option(String name, String description) {

View File

@@ -19,7 +19,7 @@ package org.springframework.bootstrap.cli.command;
import org.springframework.bootstrap.cli.Command;
/**
* Base class for a {@link Command} that uses an {@link OptionHandler}.
* Base class for a {@link Command} that pare options using an {@link OptionHandler}.
*
* @author Phillip Webb
* @author Dave Syer

View File

@@ -36,7 +36,6 @@ import static java.util.Arrays.asList;
*
* @author Phillip Webb
* @author Dave Syer
*
* @see BootstrapRunner
*/
public class RunCommand extends OptionParsingCommand {

View File

@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.bootstrap.cli.command;
import groovy.lang.Closure;
@@ -37,7 +38,6 @@ import org.springframework.bootstrap.cli.compiler.GroovyCompilerConfiguration;
* {@link Command} to run a Groovy script.
*
* @author Dave Syer
*
*/
public class ScriptCommand implements Command {

View File

@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.bootstrap.cli.command;
import groovy.lang.Mixin;
@@ -50,7 +51,6 @@ import org.springframework.bootstrap.cli.Command;
* Customizer for the compilation of CLI commands.
*
* @author Dave Syer
*
*/
public class ScriptCompilationCustomizer extends CompilationCustomizer {

View File

@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.bootstrap.cli.template;
import groovy.text.GStringTemplateEngine;
@@ -28,10 +29,11 @@ import org.codehaus.groovy.control.CompilationFailedException;
/**
* @author Dave Syer
*
*/
public class GroovyTemplate {
// FIXME is this used?
public static String template(String name) throws IOException,
CompilationFailedException, ClassNotFoundException {
return template(name, Collections.<String, Object> emptyMap());

View File

@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.bootstrap.cli;
import java.io.ByteArrayOutputStream;
@@ -27,6 +28,7 @@ import org.apache.ivy.util.FileUtil;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.springframework.bootstrap.cli.command.RunCommand;
@@ -35,7 +37,6 @@ import static org.junit.Assert.assertTrue;
/**
* @author Dave Syer
*
*/
public class SampleIntegrationTests {
@@ -128,7 +129,11 @@ public class SampleIntegrationTests {
}
@Test
@Ignore
public void uiSample() throws Exception {
// FIXME Failing on OSX
// To run this one from the command line you need to add target/test-classes to
// CLASSPATH
start("samples/ui.groovy");