mirror of
https://github.com/ethauvin/rife2.git
synced 2025-04-30 18:48:13 -07:00
Refactoring
This commit is contained in:
parent
1b0bf8a810
commit
d11c8bd324
14 changed files with 52 additions and 48 deletions
|
@ -4,7 +4,7 @@
|
|||
*/
|
||||
package rife.bld;
|
||||
|
||||
import rife.bld.commands.*;
|
||||
import rife.bld.operations.*;
|
||||
import rife.tools.ExceptionUtils;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
@ -79,14 +79,14 @@ public class BuildExecutor {
|
|||
} else {
|
||||
System.err.println("ERROR: unknown command '" + command + "'");
|
||||
System.out.println();
|
||||
new HelpCommand(this, arguments_).printFullHelp();
|
||||
new HelpOperation(this, arguments_).printFullHelp();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@BuildCommand(help = HelpCommand.Help.class)
|
||||
@BuildCommand(help = HelpOperation.Help.class)
|
||||
public void help() {
|
||||
new HelpCommand(this, arguments_).execute();
|
||||
new HelpOperation(this, arguments_).execute();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,13 +4,13 @@
|
|||
*/
|
||||
package rife.bld;
|
||||
|
||||
import rife.bld.commands.*;
|
||||
import rife.bld.operations.*;
|
||||
|
||||
public class Cli extends BuildExecutor {
|
||||
@BuildCommand(help = CreateCommand.Help.class)
|
||||
@BuildCommand(help = CreateOperation.Help.class)
|
||||
public void create()
|
||||
throws Exception {
|
||||
new CreateCommand(arguments()).execute();
|
||||
new CreateOperation(arguments()).execute();
|
||||
}
|
||||
|
||||
public static void main(String[] arguments)
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*/
|
||||
package rife.bld;
|
||||
|
||||
import rife.bld.commands.*;
|
||||
import rife.bld.operations.*;
|
||||
import rife.bld.dependencies.*;
|
||||
import rife.tools.FileUtils;
|
||||
import rife.tools.StringUtils;
|
||||
|
@ -30,38 +30,38 @@ public abstract class Project extends BuildExecutor {
|
|||
* Standard build commands
|
||||
*/
|
||||
|
||||
@BuildCommand(help = CleanCommand.Help.class)
|
||||
@BuildCommand(help = CleanOperation.Help.class)
|
||||
public void clean()
|
||||
throws Exception {
|
||||
new CleanCommand(this).execute();
|
||||
new CleanOperation(this).execute();
|
||||
}
|
||||
|
||||
@BuildCommand(help = CompileCommand.Help.class)
|
||||
@BuildCommand(help = CompileOperation.Help.class)
|
||||
public void compile()
|
||||
throws Exception {
|
||||
new CompileCommand(this).execute();
|
||||
new CompileOperation(this).execute();
|
||||
}
|
||||
|
||||
@BuildCommand(help = DownloadCommand.Help.class)
|
||||
@BuildCommand(help = DownloadOperation.Help.class)
|
||||
public void download() {
|
||||
new DownloadCommand(this).execute();
|
||||
new DownloadOperation(this).execute();
|
||||
}
|
||||
|
||||
@BuildCommand(help = PrecompileCommand.Help.class)
|
||||
@BuildCommand(help = PrecompileOperation.Help.class)
|
||||
public void precompile() {
|
||||
new PrecompileCommand(this).execute();
|
||||
new PrecompileOperation(this).execute();
|
||||
}
|
||||
|
||||
@BuildCommand(help = RunCommand.Help.class)
|
||||
@BuildCommand(help = RunOperation.Help.class)
|
||||
public void run()
|
||||
throws Exception {
|
||||
new RunCommand(this).execute();
|
||||
new RunOperation(this).execute();
|
||||
}
|
||||
|
||||
@BuildCommand(help = TestCommand.Help.class)
|
||||
@BuildCommand(help = TestOperation.Help.class)
|
||||
public void test()
|
||||
throws Exception {
|
||||
new TestCommand(this).execute();
|
||||
new TestOperation(this).execute();
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package rife.bld.commands;
|
||||
package rife.bld.operations;
|
||||
|
||||
import rife.bld.BuildHelp;
|
||||
import rife.bld.Project;
|
||||
|
@ -6,7 +6,7 @@ import rife.tools.FileUtils;
|
|||
import rife.tools.StringUtils;
|
||||
import rife.tools.exceptions.FileUtilsErrorException;
|
||||
|
||||
public class CleanCommand {
|
||||
public class CleanOperation {
|
||||
public static class Help implements BuildHelp {
|
||||
public String getDescription() {
|
||||
return "Cleans the RIFE2 build files";
|
||||
|
@ -22,7 +22,7 @@ public class CleanCommand {
|
|||
|
||||
public final Project project;
|
||||
|
||||
public CleanCommand(Project project) {
|
||||
public CleanOperation(Project project) {
|
||||
this.project = project;
|
||||
}
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
* Copyright 2001-2023 Geert Bevin (gbevin[remove] at uwyn dot com)
|
||||
* Licensed under the Apache License, Version 2.0 (the "License")
|
||||
*/
|
||||
package rife.bld.commands;
|
||||
package rife.bld.operations;
|
||||
|
||||
import rife.bld.BuildHelp;
|
||||
import rife.bld.Project;
|
||||
|
@ -13,7 +13,7 @@ import java.io.File;
|
|||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
public class CompileCommand {
|
||||
public class CompileOperation {
|
||||
public static class Help implements BuildHelp {
|
||||
public String getDescription() {
|
||||
return "Compiles a RIFE2 application";
|
||||
|
@ -29,7 +29,7 @@ public class CompileCommand {
|
|||
|
||||
public final Project project;
|
||||
|
||||
public CompileCommand(Project project) {
|
||||
public CompileOperation(Project project) {
|
||||
this.project = project;
|
||||
}
|
||||
|
|
@ -2,10 +2,10 @@
|
|||
* Copyright 2001-2023 Geert Bevin (gbevin[remove] at uwyn dot com)
|
||||
* Licensed under the Apache License, Version 2.0 (the "License")
|
||||
*/
|
||||
package rife.bld.commands;
|
||||
package rife.bld.operations;
|
||||
|
||||
import rife.bld.BuildHelp;
|
||||
import rife.bld.commands.exceptions.CommandCreationException;
|
||||
import rife.bld.operations.exceptions.CommandCreationException;
|
||||
import rife.bld.dependencies.*;
|
||||
import rife.template.TemplateFactory;
|
||||
import rife.tools.*;
|
||||
|
@ -16,7 +16,7 @@ import java.io.File;
|
|||
import java.nio.file.Path;
|
||||
import java.util.*;
|
||||
|
||||
public class CreateCommand {
|
||||
public class CreateOperation {
|
||||
public static class Help implements BuildHelp {
|
||||
public String getDescription() {
|
||||
return "Creates a new RIFE2 application";
|
||||
|
@ -59,7 +59,7 @@ public class CreateCommand {
|
|||
private final File projectPackageDir_;
|
||||
private final File testPackageDir_;
|
||||
|
||||
public CreateCommand(List<String> arguments) {
|
||||
public CreateOperation(List<String> arguments) {
|
||||
if (arguments.size() < 2) {
|
||||
throw new CommandCreationException("ERROR: Expecting the package and project names as the arguments.");
|
||||
}
|
|
@ -1,11 +1,15 @@
|
|||
package rife.bld.commands;
|
||||
/*
|
||||
* Copyright 2001-2023 Geert Bevin (gbevin[remove] at uwyn dot com)
|
||||
* Licensed under the Apache License, Version 2.0 (the "License")
|
||||
*/
|
||||
package rife.bld.operations;
|
||||
|
||||
import rife.bld.BuildHelp;
|
||||
import rife.bld.Project;
|
||||
import rife.bld.dependencies.*;
|
||||
import rife.tools.StringUtils;
|
||||
|
||||
public class DownloadCommand {
|
||||
public class DownloadOperation {
|
||||
public static class Help implements BuildHelp {
|
||||
public String getDescription() {
|
||||
return "Downloads all dependencies of a RIFE2 application";
|
||||
|
@ -21,7 +25,7 @@ public class DownloadCommand {
|
|||
|
||||
public final Project project;
|
||||
|
||||
public DownloadCommand(Project project) {
|
||||
public DownloadOperation(Project project) {
|
||||
this.project = project;
|
||||
}
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
* Copyright 2001-2023 Geert Bevin (gbevin[remove] at uwyn dot com)
|
||||
* Licensed under the Apache License, Version 2.0 (the "License")
|
||||
*/
|
||||
package rife.bld.commands;
|
||||
package rife.bld.operations;
|
||||
|
||||
import rife.Version;
|
||||
import rife.bld.*;
|
||||
|
@ -11,7 +11,7 @@ import java.util.List;
|
|||
|
||||
import static java.util.Comparator.comparingInt;
|
||||
|
||||
public class HelpCommand {
|
||||
public class HelpOperation {
|
||||
public static class Help implements BuildHelp {
|
||||
public String getDescription() {
|
||||
return "Provides help about any of the other commands";
|
||||
|
@ -21,7 +21,7 @@ public class HelpCommand {
|
|||
private final BuildExecutor executor_;
|
||||
private final List<String> arguments_;
|
||||
|
||||
public HelpCommand(BuildExecutor executor, List<String> arguments) {
|
||||
public HelpOperation(BuildExecutor executor, List<String> arguments) {
|
||||
executor_ = executor;
|
||||
arguments_ = arguments;
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
* Copyright 2001-2023 Geert Bevin (gbevin[remove] at uwyn dot com)
|
||||
* Licensed under the Apache License, Version 2.0 (the "License")
|
||||
*/
|
||||
package rife.bld.commands;
|
||||
package rife.bld.operations;
|
||||
|
||||
import rife.bld.BuildHelp;
|
||||
import rife.bld.Project;
|
||||
|
@ -13,7 +13,7 @@ import rife.tools.StringUtils;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class PrecompileCommand implements BuildHelp {
|
||||
public class PrecompileOperation {
|
||||
public static class Help implements BuildHelp {
|
||||
public String getDescription() {
|
||||
return "Compiles RIFE2 templates to class files";
|
||||
|
@ -29,7 +29,7 @@ public class PrecompileCommand implements BuildHelp {
|
|||
|
||||
public final Project project;
|
||||
|
||||
public PrecompileCommand(Project project) {
|
||||
public PrecompileOperation(Project project) {
|
||||
this.project = project;
|
||||
}
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
* Copyright 2001-2023 Geert Bevin (gbevin[remove] at uwyn dot com)
|
||||
* Licensed under the Apache License, Version 2.0 (the "License")
|
||||
*/
|
||||
package rife.bld.commands;
|
||||
package rife.bld.operations;
|
||||
|
||||
import rife.bld.BuildHelp;
|
||||
import rife.bld.Project;
|
||||
|
@ -11,7 +11,7 @@ import rife.tools.StringUtils;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class RunCommand {
|
||||
public class RunOperation {
|
||||
public static class Help implements BuildHelp {
|
||||
public String getDescription() {
|
||||
return "Runs a RIFE2 application";
|
||||
|
@ -27,7 +27,7 @@ public class RunCommand {
|
|||
|
||||
public final Project project;
|
||||
|
||||
public RunCommand(Project project) {
|
||||
public RunOperation(Project project) {
|
||||
this.project = project;
|
||||
}
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
* Copyright 2001-2023 Geert Bevin (gbevin[remove] at uwyn dot com)
|
||||
* Licensed under the Apache License, Version 2.0 (the "License")
|
||||
*/
|
||||
package rife.bld.commands;
|
||||
package rife.bld.operations;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
|
@ -2,7 +2,7 @@
|
|||
* Copyright 2001-2023 Geert Bevin (gbevin[remove] at uwyn dot com)
|
||||
* Licensed under the Apache License, Version 2.0 (the "License")
|
||||
*/
|
||||
package rife.bld.commands;
|
||||
package rife.bld.operations;
|
||||
|
||||
import rife.bld.BuildHelp;
|
||||
import rife.bld.Project;
|
||||
|
@ -11,7 +11,7 @@ import rife.tools.StringUtils;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class TestCommand {
|
||||
public class TestOperation {
|
||||
public static class Help implements BuildHelp {
|
||||
public String getDescription() {
|
||||
return "Tests a RIFE2 application";
|
||||
|
@ -27,7 +27,7 @@ public class TestCommand {
|
|||
|
||||
public final Project project;
|
||||
|
||||
public TestCommand(Project project) {
|
||||
public TestOperation(Project project) {
|
||||
this.project = project;
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package rife.bld.commands.exceptions;
|
||||
package rife.bld.operations.exceptions;
|
||||
|
||||
import java.io.Serial;
|
||||
|
|
@ -4,9 +4,9 @@ import rife.bld.Project;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import static rife.bld.commands.TemplateType.*;
|
||||
import static rife.bld.dependencies.Repository.*;
|
||||
import static rife.bld.dependencies.Scope.*;
|
||||
import static rife.bld.operations.TemplateType.*;
|
||||
|
||||
public class {{v projectBuild/}} extends Project {
|
||||
public void setup() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue