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