/** * @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a> * @author Mike Brock . */ @Alias("git") @Topic("Version Control") public class GitShellPlugin implements Plugin { private final Shell shell; @Inject public GitShellPlugin(final Shell shell) { this.shell = shell; } @DefaultCommand public void run(final PipeOut out, final String... parms) throws IOException { NativeSystemCall.execFromPath("git", parms, out, shell.getCurrentDirectory()); } }
/** * An aliasing wrapper for {@link MorePlugin} * * @author Mike Brock . */ @Alias("less") @Topic("Shell Environment") public class LessPlugin implements Plugin { private final MorePlugin morePlugin; @Inject public LessPlugin(@Alias("more") MorePlugin morePlugin) { this.morePlugin = morePlugin; } @DefaultCommand public void run(@PipeIn InputStream pipeIn, final Resource<?> file, final PipeOut pipeOut) throws IOException { morePlugin.run(pipeIn, file, true, pipeOut); } }
@Topic("Shell Environment") public class RunPlugin implements Plugin
/** * @author <a href="mailto:rdruss@gmail.com">Rodney Russ</a> */ @Alias("pwr") @Topic("File & Resources") @Help("Prints the current working resource.") public class PwrPlugin implements org.jboss.forge.shell.plugins.Plugin { @Inject private Shell shell; @DefaultCommand public void run() { shell.println(shell.getCurrentResource().getFullyQualifiedName()); } }
/** * @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a> */ @Alias("clear") @Topic("Shell Environment") @Help("Clears the console output.") public class ClearPlugin implements Plugin { @Inject Shell shell; @DefaultCommand public void run() { shell.clear(); } }
/** * @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a> */ @Alias("pwd") @Topic("File & Resources") @Help("Prints the current directory.") public class PwdPlugin implements Plugin { @Inject Shell shell; @DefaultCommand public void run() { shell.println(shell.getCurrentDirectory().getFullyQualifiedName()); } }
/** * @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a> */ @Alias("version") @Topic("Shell Environment") @Help("Displays the current Forge version.") public class VersionPlugin implements Plugin { @Inject private ForgeEnvironment environment; @DefaultCommand public void show(final PipeOut out) { String version = environment.getRuntimeVersion(); out.println("JBoss Forge, version [ " + version + " ] - JBoss, by Red Hat, Inc. [ http://jboss.org/forge ]"); } }
/** * Implements a {@link Plugin} that fires the forge {@link ShutdownStatus#NORMAL} event. * * * * @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a> */ @Alias("exit") @Topic("Shell Environment") @Help("Exits the forge.") public class ExitShellPlugin implements Plugin { @Inject private Event<Shutdown> shutdown; @DefaultCommand public void exit() { shutdown.fire(new Shutdown(Shutdown.Status.NORMAL)); } }
@Alias("execute-java") @Topic("Project") @Help("Execute a main method on a project class") public class JavaExecutionPlugin implements Plugin { @Inject Project project; @DefaultCommand public void executeJavaClass( @Option(name = "class", type = PromptType.JAVA_CLASS, required = true) final JavaResource classToExecute, @Option(name = "arguments") final String arguments) throws Exception { String qualifiedName = classToExecute.getJavaSource().getQualifiedName(); JavaExecutionFacet facet = project.getFacet(JavaExecutionFacet.class); if (arguments != null) { facet.executeProjectClass(qualifiedName, arguments.split(" ")); } else { facet.executeProjectClass(qualifiedName); } } }
@Alias("about") @Topic("Shell Environment") @Help("Display information about this forge.") public class AboutPlugin implements Plugin { @Inject @Alias("forge") private ForgePlugin forge; @DefaultCommand public void run(PipeOut out) { forge.about(out); } }
/** * @author Mike Brock . */ @Alias("wait") @Topic("Shell Environment") @Help("Wait for ENTER.") public class WaitPlugin implements Plugin { private final Shell shell; @Inject public WaitPlugin(final Shell shell) { this.shell = shell; } @DefaultCommand public void waitCommand() { shell.prompt("Press <ENTER> to continue..."); } }
/** * @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a> */ @Alias("reset") @Topic("Shell Environment") @Help("Reset the shell and reload default configs.") public class ResetPlugin implements Plugin { private final Event<ReinitializeEnvironment> reinitializeEvent; @Inject public ResetPlugin(final Event<ReinitializeEnvironment> reinitializeEvent) { this.reinitializeEvent = reinitializeEvent; } @DefaultCommand public void reset() { reinitializeEvent.fire(new ReinitializeEnvironment()); } }
/** * A simple port of the Unix touch command. * * @author Jose Donizetti. */ @Alias("touch") @Topic("File & Resources") @Help("change file access and modification times") public class TouchPlugin implements Plugin { @DefaultCommand public void run(@Option(help = "name of file to be touched", required = true) final Resource<?> resource) { FileResource<?> fileResource = (FileResource<?>) resource; if (fileResource.exists()) { File file = fileResource.getUnderlyingResourceObject(); file.setLastModified(System.currentTimeMillis()); } else { fileResource.createNewFile(); } } }
@Topic("File & Resources") @Help("Lists all resources recursively from the given resource.") public class FindPlugin implements Plugin
@Topic("Shell Environment") @Help("Lists all current forge properties") public class ListPropertiesPlugin implements Plugin
@Topic("Shell Environment") @Help("Executes an expression") public class ScriptExecPlugin implements Plugin
/** * @author Mike Brock . * @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a> */ @Alias("mvn") @Topic("Project") @RequiresProject @RequiresFacet(MavenCoreFacet.class) public class MvnShellPlugin implements Plugin { private final Project project; @Inject public MvnShellPlugin(final Project project) { this.project = project; } @DefaultCommand public void run(final PipeOut out, final String... parms) { project.getFacet(MavenCoreFacet.class).executeMaven(out, parms); } }
@Topic("File & Resources") @RequiresResource(DirectoryResource.class) @Help("Create a new directory")
@Topic("File & Resources") @RequiresProject @RequiresFacet(ServletFacet.class)
@Topic("Project") @RequiresProject @RequiresFacet({ DependencyFacet.class, PackagingFacet.class })