2023-11-19 02:12:44 +03:00
|
|
|
package Visual_DVM_2021.Passes.All;
|
2023-12-24 01:36:52 +03:00
|
|
|
import Common.Constants;
|
2023-09-17 22:13:42 +03:00
|
|
|
import Common.Current;
|
|
|
|
|
import Common.Utils.Utils;
|
|
|
|
|
import GlobalData.RemoteFile.RemoteFile;
|
2023-12-20 02:47:47 +03:00
|
|
|
import Visual_DVM_2021.Passes.PassException;
|
|
|
|
|
import Visual_DVM_2021.Passes.SSH.ConnectionPass_2023;
|
2023-09-17 22:13:42 +03:00
|
|
|
|
2023-12-20 02:47:47 +03:00
|
|
|
import java.util.Vector;
|
|
|
|
|
public class RemoteInitialiseUser extends ConnectionPass_2023<RemoteFile> {
|
|
|
|
|
RemoteFile modulesDirectory;
|
2023-09-17 22:13:42 +03:00
|
|
|
@Override
|
2023-12-20 02:47:47 +03:00
|
|
|
protected boolean needsAnimation() {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
protected boolean canStart(Object... args) {
|
|
|
|
|
return Current.Check(Log, Current.User);
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
protected void Connect() throws Exception {
|
|
|
|
|
machine = Current.getMachine();
|
|
|
|
|
user = Current.getUser();
|
|
|
|
|
super.Connect();
|
|
|
|
|
}
|
2023-09-17 22:13:42 +03:00
|
|
|
@Override
|
|
|
|
|
protected void ServerAction() throws Exception {
|
|
|
|
|
String workspace_name = Utils.getDateName("visual_sapfor_workspace");
|
2023-12-20 02:47:47 +03:00
|
|
|
ShowMessage1("Создание рабочего пространства...");
|
|
|
|
|
target = new RemoteFile(user.connection.sftpChannel.getHome(), workspace_name);
|
|
|
|
|
user.connection.sftpChannel.mkdir(target.full_name);
|
|
|
|
|
Vector<RemoteFile> subdirectories = new Vector<>();
|
|
|
|
|
subdirectories.add(new RemoteFile(target, "projects"));
|
|
|
|
|
subdirectories.add(modulesDirectory = new RemoteFile(target, "modules"));
|
|
|
|
|
subdirectories.add(new RemoteFile(target, "tests"));
|
2023-09-17 22:13:42 +03:00
|
|
|
//-------------------------------------
|
2023-12-20 02:47:47 +03:00
|
|
|
for (RemoteFile remoteFile : subdirectories)
|
|
|
|
|
user.connection.sftpChannel.mkdir(remoteFile.full_name);
|
2023-09-17 22:13:42 +03:00
|
|
|
//----------------------------------
|
2023-12-20 16:56:18 +03:00
|
|
|
ShowMessage1("Закачка кода модулей...");
|
2023-12-24 01:36:52 +03:00
|
|
|
for (String resource_name : Constants.resourses_names) {
|
2023-12-20 02:47:47 +03:00
|
|
|
ShowMessage2(resource_name);
|
2023-12-24 01:36:52 +03:00
|
|
|
user.connection.putResource(modulesDirectory, resource_name);
|
2023-09-17 22:13:42 +03:00
|
|
|
}
|
|
|
|
|
//-------------------------------------
|
|
|
|
|
ShowMessage1("Сборка модулей...");
|
2023-12-24 01:36:52 +03:00
|
|
|
String modules_log = user.connection.compileModules(modulesDirectory);
|
|
|
|
|
if (!modules_log.isEmpty())
|
|
|
|
|
throw new PassException(modules_log);
|
2023-09-17 22:13:42 +03:00
|
|
|
//--------------------------------------
|
|
|
|
|
RemoteFile info = new RemoteFile(target, Current.getAccount().email);
|
2023-12-20 02:47:47 +03:00
|
|
|
user.connection.writeToFile("", info);
|
2023-09-17 22:13:42 +03:00
|
|
|
}
|
|
|
|
|
}
|