Beispiel #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");
            }
        }
Beispiel #2
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;
                }
            }
        }