refactor(cli): 优化脚本

This commit is contained in:
2024-02-26 19:04:37 +08:00
parent 9e6e8fbc61
commit 5ecc3daac0
2 changed files with 17 additions and 10 deletions

View File

@@ -82,18 +82,22 @@ public class RunnerApplication implements ApplicationRunner {
@Override
public void run(ApplicationArguments args) throws IOException {
logger.info("Loading runtime info: {}", mapper.writeValueAsString(runtimeInfo));
generateCloud(Paths.get("cloud"));
generateCloud(Paths.get("command"));
}
private void generateCloud(Path root) throws IOException {
Files.createDirectories(root);
String absolutRootPath = root.toAbsolutePath().toString();
logger.info("Current path: {}", absolutRootPath);
Path planPath = Paths.get("deploy.plan");
Map<String, List<String>> deployPlans = new HashMap<>();
if (Files.exists(planPath) && !deployInformationProperties.getShuffler()) {
deployPlans = mapper.readValue(new String(Files.readAllBytes(planPath)), new TypeReference<Map<String, List<String>>>() {});
}
Path root = Paths.get("");
Files.createDirectories(root);
String absolutRootPath = root.toAbsolutePath().toString();
logger.info("Current path: {}", absolutRootPath);
TemplateEngine engine = TemplateUtil.createEngine(new TemplateConfig("template", TemplateConfig.ResourceMode.CLASSPATH));
Template deployTemplate = engine.getTemplate("deploy.ftl");
for (ServiceInfoWrapper serviceInfo : serviceInfoList) {
@@ -256,4 +260,7 @@ public class RunnerApplication implements ApplicationRunner {
Files.deleteIfExists(planPath);
Files.write(planPath, mapper.writeValueAsString(deployPlans).getBytes());
}
private void generateCommand(Path root) throws IOException {
}
}