Files
VisualSapfor/src/_VisualDVM/Passes/All/DownloadRepository.java

42 lines
1.5 KiB
Java
Raw Normal View History

2024-10-14 12:14:01 +03:00
package _VisualDVM.Passes.All;
2024-10-09 22:01:19 +03:00
import _VisualDVM.Constants;
import _VisualDVM.Global;
2024-10-14 12:14:01 +03:00
import _VisualDVM.Passes.ProcessPass;
2024-10-14 15:19:13 +03:00
import _VisualDVM.Utils;
2023-09-17 22:13:42 +03:00
import org.apache.commons.io.FileUtils;
import java.io.File;
import java.nio.file.Paths;
public class DownloadRepository extends ProcessPass {
File dvmHome;
File sapforHome;
@Override
protected boolean canStart(Object... args) throws Exception {
dvmHome = Paths.get(Global.RepoDirectory.getAbsolutePath(),
"dvm").toFile();
sapforHome = Paths.get(Global.RepoDirectory.getAbsolutePath(),
"sapfor").toFile();
return true;
}
private void synchronize(String src, File dst) throws Exception {
File loadedFile = Paths.get(dst.getAbsolutePath(), Constants.LOADED).toFile();
2023-09-17 22:13:42 +03:00
if (loadedFile.exists()) {
PerformScript("cd " +
dst.getAbsolutePath() +
"\nsvn update " + Constants.REPOSITORY_AUTHENTICATION + "\n");
2023-09-17 22:13:42 +03:00
} else {
Utils.CleanDirectory(dst);
PerformScript("cd Repo\nsvn checkout " + Constants.REPOSITORY_AUTHENTICATION + " " + src + "\n"); //export
2024-04-26 19:16:38 +03:00
FileUtils.write(loadedFile, "");
2023-09-17 22:13:42 +03:00
}
}
@Override
protected void body() throws Exception {
ShowProgress(2, 0, true);
synchronize(Constants.DVM_REPOSITORY, dvmHome);
2023-09-17 22:13:42 +03:00
ShowProgress(2, 1, true);
synchronize(Constants.SAPFOR_REPOSITORY, sapforHome);
2023-09-17 22:13:42 +03:00
ShowProgress(2, 2, true);
}
}