45 lines
1.3 KiB
Java
45 lines
1.3 KiB
Java
|
package eu.m724.blog;
|
||
|
|
||
|
import org.apache.commons.io.FileUtils;
|
||
|
import org.eclipse.jgit.api.Git;
|
||
|
import org.eclipse.jgit.lib.RepositoryBuilder;
|
||
|
|
||
|
import java.io.File;
|
||
|
import java.io.IOException;
|
||
|
import java.nio.file.FileAlreadyExistsException;
|
||
|
|
||
|
public class Main {
|
||
|
public static void main(String[] args) throws IOException {
|
||
|
System.out.println("Hello world!");
|
||
|
|
||
|
var workingDirectory = new File("m724");
|
||
|
var templateDirectory = new File(workingDirectory, "template");
|
||
|
var outputDirectory = new File(workingDirectory, "generated_out");
|
||
|
var force = true;
|
||
|
|
||
|
//
|
||
|
|
||
|
var repository = new RepositoryBuilder()
|
||
|
.setGitDir(workingDirectory)
|
||
|
.build();
|
||
|
var git = new Git(repository);
|
||
|
|
||
|
//
|
||
|
|
||
|
if (outputDirectory.exists()) {
|
||
|
if (force) {
|
||
|
outputDirectory.delete();
|
||
|
} else {
|
||
|
throw new FileAlreadyExistsException(outputDirectory.getAbsolutePath(), null, "Output directory already exists");
|
||
|
}
|
||
|
}
|
||
|
|
||
|
outputDirectory.mkdir();
|
||
|
FileUtils.copyDirectory(new File(workingDirectory, "assets"), new File(outputDirectory, "assets"));
|
||
|
FileUtils.copyDirectory(new File(templateDirectory, "static"), new File(outputDirectory, "static"));
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
}
|
||
|
}
|