2024-10-14 12:14:01 +03:00
|
|
|
package _VisualDVM.Passes.All;
|
2024-10-16 00:40:45 +03:00
|
|
|
import Common.CommonConstants;
|
2024-10-09 22:01:19 +03:00
|
|
|
import _VisualDVM.Constants;
|
2024-10-07 00:58:29 +03:00
|
|
|
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;
|
2025-03-12 21:47:54 +03:00
|
|
|
public class DownloadDvmRepository extends ProcessPass {
|
2025-03-12 23:09:08 +03:00
|
|
|
/*
|
|
|
|
|
git clone https://dvmguest:dvmguest@dvm.keldysh.ru/dvm-system/dvm /home/testuser/Repo/DVM/
|
|
|
|
|
git clone https://dvmguest:dvmguest@dvm.keldysh.ru/dvm-system/dvm-auto-test /home/testuser/Repo/DVM_AUTO_TEST/
|
|
|
|
|
*/
|
2025-03-12 21:47:54 +03:00
|
|
|
File dvmHome;
|
2025-02-15 23:30:48 +03:00
|
|
|
@Override
|
2023-09-17 22:13:42 +03:00
|
|
|
protected boolean canStart(Object... args) throws Exception {
|
2025-03-12 21:47:54 +03:00
|
|
|
dvmHome = Paths.get(Global.RepoDirectory.getAbsolutePath(),
|
|
|
|
|
"dvm").toFile();
|
2023-09-17 22:13:42 +03:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
private void synchronize(String src, File dst) throws Exception {
|
2024-10-16 00:40:45 +03:00
|
|
|
File loadedFile = Paths.get(dst.getAbsolutePath(), CommonConstants.LOADED).toFile();
|
2023-09-17 22:13:42 +03:00
|
|
|
if (loadedFile.exists()) {
|
|
|
|
|
PerformScript("cd " +
|
|
|
|
|
dst.getAbsolutePath() +
|
2025-03-12 21:47:54 +03:00
|
|
|
"\nsvn update " + Constants.REPOSITORY_AUTHENTICATION + "\n");
|
2023-09-17 22:13:42 +03:00
|
|
|
} else {
|
|
|
|
|
Utils.CleanDirectory(dst);
|
2025-03-12 21:47:54 +03:00
|
|
|
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 {
|
2025-03-12 21:04:22 +03:00
|
|
|
ShowProgress(1, 0, true);
|
2025-03-12 21:47:54 +03:00
|
|
|
synchronize(Constants.DVM_REPOSITORY, dvmHome);
|
2025-03-12 21:04:22 +03:00
|
|
|
ShowProgress(1, 1, true);
|
2023-09-17 22:13:42 +03:00
|
|
|
}
|
|
|
|
|
}
|