remove App class
This commit is contained in:
parent
37f64392da
commit
c14d5866e6
|
@ -1,8 +1,9 @@
|
||||||
import net.horizoncode.sysbackup.App;
|
import net.horizoncode.sysbackup.cli.CLIProcessor;
|
||||||
|
|
||||||
public class Bootstrapper {
|
public class Bootstrapper {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
App.getInstance().start(args);
|
CLIProcessor cliProcessor = new CLIProcessor();
|
||||||
|
cliProcessor.startCLI(args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
package net.horizoncode.sysbackup;
|
|
||||||
|
|
||||||
import net.horizoncode.sysbackup.cli.CLIProcessor;
|
|
||||||
|
|
||||||
public class App {
|
|
||||||
private static App instance;
|
|
||||||
|
|
||||||
public static App getInstance() {
|
|
||||||
if (instance != null) return instance;
|
|
||||||
return instance = new App();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void start(String[] args){
|
|
||||||
CLIProcessor cliProcessor = new CLIProcessor();
|
|
||||||
cliProcessor.startCLI(args);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,6 +1,5 @@
|
||||||
package net.horizoncode.sysbackup.cli;
|
package net.horizoncode.sysbackup.cli;
|
||||||
|
|
||||||
import net.horizoncode.sysbackup.App;
|
|
||||||
import net.horizoncode.sysbackup.config.Config;
|
import net.horizoncode.sysbackup.config.Config;
|
||||||
import net.horizoncode.sysbackup.tasks.TaskBuilder;
|
import net.horizoncode.sysbackup.tasks.TaskBuilder;
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
|
@ -73,7 +72,7 @@ public class CLIProcessor {
|
||||||
if (!tasksFolder.mkdir()) System.err.println("Failed to create tasks folder!");
|
if (!tasksFolder.mkdir()) System.err.println("Failed to create tasks folder!");
|
||||||
System.out.println("Saving task config " + fileName + ".toml...");
|
System.out.println("Saving task config " + fileName + ".toml...");
|
||||||
FileUtils.copyInputStreamToFile(
|
FileUtils.copyInputStreamToFile(
|
||||||
Objects.requireNonNull(App.class.getResourceAsStream("/" + "exampletask.toml")),
|
Objects.requireNonNull(getClass().getResourceAsStream("/" + "exampletask.toml")),
|
||||||
new File(tasksFolder, fileName + ".toml"));
|
new File(tasksFolder, fileName + ".toml"));
|
||||||
System.out.println(fileName + ".toml saved!");
|
System.out.println(fileName + ".toml saved!");
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
package net.horizoncode.sysbackup.config;
|
package net.horizoncode.sysbackup.config;
|
||||||
|
|
||||||
import lombok.AccessLevel;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import net.horizoncode.sysbackup.App;
|
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.tomlj.Toml;
|
import org.tomlj.Toml;
|
||||||
import org.tomlj.TomlArray;
|
import org.tomlj.TomlArray;
|
||||||
|
@ -26,7 +24,7 @@ public class Config {
|
||||||
if (!configFile.exists()) {
|
if (!configFile.exists()) {
|
||||||
try {
|
try {
|
||||||
FileUtils.copyInputStreamToFile(
|
FileUtils.copyInputStreamToFile(
|
||||||
Objects.requireNonNull(App.class.getResourceAsStream("/" + configFile.getName())),
|
Objects.requireNonNull(getClass().getResourceAsStream("/" + configFile.getName())),
|
||||||
configFile);
|
configFile);
|
||||||
justCreated = true;
|
justCreated = true;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
@ -36,7 +34,7 @@ public class Config {
|
||||||
if (configFile.isDirectory()) {
|
if (configFile.isDirectory()) {
|
||||||
try {
|
try {
|
||||||
FileUtils.copyInputStreamToFile(
|
FileUtils.copyInputStreamToFile(
|
||||||
Objects.requireNonNull(App.class.getResourceAsStream("/" + configFile.getName())),
|
Objects.requireNonNull(getClass().getResourceAsStream("/" + configFile.getName())),
|
||||||
configFile);
|
configFile);
|
||||||
justCreated = true;
|
justCreated = true;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user