prepare for deploy
All checks were successful
/ build (push) Successful in 51s

This commit is contained in:
Minecon724 2025-01-18 21:22:42 +01:00
parent 288f6d118b
commit 93244edd0e
Signed by: Minecon724
GPG key ID: 3CCC4D267742C8E8
2 changed files with 27 additions and 7 deletions

View file

@ -5,6 +5,7 @@ import eu.m724.blog.data.Post;
import eu.m724.blog.data.Site;
import in.wilsonl.minifyhtml.Configuration;
import in.wilsonl.minifyhtml.MinifyHtml;
import org.apache.commons.cli.*;
import org.apache.commons.io.file.PathUtils;
import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.lib.RepositoryBuilder;
@ -27,18 +28,37 @@ public class Main {
public static void main(String[] args) throws IOException {
System.out.println("Hello world!");
var start = System.nanoTime();
var options = new Options()
.addOption("f", "force", false, "Overwrite current build. Default: no")
.addOption("dir", "working-dir", true, "Working directory. Default: current directory")
.addOption("t", "template-dir", true, "Template directory. Default: working directory/template")
.addOption("o", "output-dir", true, "Output directory. Default: working directory/generated_out")
.addOption("s", "server", false, "Run webserver. Default: no");
var workingDirectory = Path.of("m724");
var templateDirectory = workingDirectory.resolve("template");
var outputDirectory = workingDirectory.resolve("generated_out");
var force = true;
CommandLine commandLine;
try {
commandLine = new DefaultParser().parse(options, args);
} catch (ParseException e) {
System.out.println(e.getMessage());
new HelpFormatter().printHelp("utility-name", options);
var server = true;
System.exit(1);
return;
}
var workingDirectory = Path.of(commandLine.getOptionValue("working-dir", "."));
var templateDirectory = Path.of(commandLine.getOptionValue("output-dir", workingDirectory.resolve("template").toString()));
var outputDirectory = Path.of(commandLine.getOptionValue("output-dir", workingDirectory.resolve("generated_out").toString()));
var force = commandLine.hasOption("force");
var server = commandLine.hasOption("server");
var openBrowser = true;
//
var start = System.nanoTime();
var repository = new RepositoryBuilder()
.setGitDir(workingDirectory.resolve(".git").toFile())
.build();

View file

@ -15,7 +15,7 @@ public record Site(
Map<String, Object> custom
) {
public static Site fromConfig(Git git) throws IOException {
var content = Files.readString(git.getRepository().getDirectory().toPath().getParent().resolve("config.json"));
var content = Files.readString(git.getRepository().getDirectory().toPath().getParent().resolve("site-config.json"));
var json = new JSONObject(content);
String name = null;