Example #1
0
        /// <summary>
        /// Should be called to extract the database info from the current environnement
        /// </summary>
        public static void FetchCurrentDbInfo(Action onExtractionDone)
        {
            try {
                // dont extract 2 db at once
                if (_isExtracting)
                {
                    UserCommunication.Notify("Already fetching info for another environment, please wait the end of the previous execution!", MessageImg.MsgWarning, "Database info", "Extracting database structure", 5);
                    return;
                }

                // save the filename of the output database info file for this environment
                UserCommunication.Notify("Now fetching info on all the connected databases for the current environment<br>You will be warned when the process is over", MessageImg.MsgInfo, "Database info", "Extracting database structure", 5);

                var exec = new ProExecution {
                    OnExecutionEnd         = execution => _isExtracting = false,
                    OnExecutionOk          = ExtractionDoneOk,
                    NeedDatabaseConnection = true,
                    ExtractDbOutputPath    = GetOutputName
                };
                _onExtractionDone = onExtractionDone;
                _isExtracting     = exec.Do(ExecutionType.Database);
            } catch (Exception e) {
                ErrorHandler.ShowErrors(e, "FetchCurrentDbInfo");
            }
        }
Example #2
0
 /// <summary>
 /// Called when a process has finished
 /// </summary>
 private void OnExecutionOk(ProExecution lastExecution)
 {
     DoInLock(() => {
         _processesRunning--;
         EndOfCompilation();
     });
 }
Example #3
0
 /// <summary>
 /// Called when a process has finished UNsuccessfully
 /// </summary>
 private void OnExecutionFailed(ProExecution lastExecution)
 {
     DoInLock(() => {
         KillProcesses();
         EndOfCompilation();
     });
 }
Example #4
0
        private void ExecuteDeploymentHook()
        {
            // launch the compile process for the current file
            if (File.Exists(Config.FileDeploymentHook))
            {
                _executingHook = true;

                try {
                    var hookExec = new ProExecution {
                        DeploymentStep       = _currentStep,
                        DeploymentSourcePath = _currentProfile.SourceDirectory
                    };
                    if (hookExec.Do(ExecutionType.DeploymentHook))
                    {
                        hookExec.Process.WaitForExit();

                        var fileInfo = new FileInfo(hookExec.LogPath);
                        if (fileInfo.Length > 0)
                        {
                            // the .log is not empty, maybe something went wrong in the runner, display errors
                            UserCommunication.Notify(
                                "Something went wrong while executing the deployment hook procedure:<br>" + Config.FileDeploymentHook.ToHtmlLink() + "<br>The following problems were logged :" +
                                Utils.ReadAndFormatLogToHtml(hookExec.LogPath), MessageImg.MsgError,
                                "Deployment hook procedure", "Execution failed");
                            _hookProcedureErrors.Append("The execution for step " + _currentStep + " returned the following errors :" + Utils.ReadAndFormatLogToHtml(hookExec.LogPath));
                        }
                    }
                } finally {
                    _executingHook = false;
                }
            }
        }
Example #5
0
 /// <summary>
 /// Method called after the execution of the program extracting the db info
 /// </summary>
 private static void ExtractionDoneOk(ProExecution lastExec)
 {
     // copy the dump to the folder database
     if (Utils.CopyFile(lastExec.ExtractDbOutputPath, Path.Combine(Config.FolderDatabase, Path.GetFileName(lastExec.ExtractDbOutputPath) ?? "")))
     {
         // update info
         UpdateDatabaseInfo();
         UserCommunication.Notify("Database structure extracted with success!<br>The auto-completion has been updated with the latest info, enjoy!", MessageImg.MsgOk, "Database info", "Extracting database structure", 10);
         if (_onExtractionDone != null)
         {
             _onExtractionDone();
             _onExtractionDone = null;
         }
     }
 }