public override Command Create()
        {
            Command command = new Command("environment")
            {
                _idOption,
                _devEnvironmentOption,
            };

            command.Description = CLITextResources.EnvironmentCommandDescription;

            command.Handler = CommandHandler
                              .Create <string, bool>((id, dev) =>
            {
                _consoleProcessMessages.StartProcessMessage("environment", id);

                ProjectConfigItem existProjectConfig = _projectConfigsAPI.GetProjectConfigById(id);

                if (existProjectConfig == null)
                {
                    _consoleProcessMessages.SetErrorInstruction(CLITextResources.IdNotExistCommandError.Replace("[Id]", id), NotificationErrorType.Error);
                }
                else
                {
                    existProjectConfig.DevEnvironment = dev;

                    _consoleProcessMessages.StartSpiiner();
                    ProcessResults processResults = _projectConfigsAPI.UpdateProjectConfig(existProjectConfig, _consoleProcessMessages.OnNotificationStateChanged);
                    _consoleProcessMessages.StopSpinner();

                    _consoleProcessMessages.ProcessComplete(processResults);
                }
            });

            return(command);
        }
        public override Command Create()
        {
            Command command = new Command("config")
            {
                _idOption,
                _descriptionOption,
                _dbTypeOption,
                _serverInstanceOption,
                _dataBaseNameOption,
                _dbUsernameOption,
                _dbPasswordOption,
                _backupFolderPathOption,
                _scriptsBaseFolderPathOption,
                _deployArtifactFolderPathOption,
                _deliveryArtifactFolderPathOption,
            };

            command.Description = CLITextResources.ConfigCommandDescription;

            command.Handler = CommandHandler
                              .Create((ProjectConfigItem projectConfig) =>
            {
                _consoleProcessMessages.StartProcessMessage("config", projectConfig.Id);

                ProjectConfigItem existProjectConfig = _projectConfigsAPI.GetProjectConfigById(projectConfig.Id);

                if (existProjectConfig == null)
                {
                    _consoleProcessMessages.SetErrorInstruction(CLITextResources.IdNotExistCommandError.Replace("[Id]", projectConfig.Id), NotificationErrorType.Error);
                }
                else
                {
                    OverrideProjectConfigProperties(existProjectConfig, projectConfig);

                    _consoleProcessMessages.StartSpiiner();
                    ProcessResults processResults = _projectConfigsAPI.UpdateProjectConfig(existProjectConfig, _consoleProcessMessages.OnNotificationStateChanged);
                    _consoleProcessMessages.StopSpinner();

                    _consoleProcessMessages.ProcessComplete(processResults);
                }
            });

            Command changeIdCommand = _changeIdCommandFactory.Create();

            command.Add(changeIdCommand);

            Command environmentCommand = _environmentCommandFactory.Create();

            command.Add(environmentCommand);

            return(command);
        }
示例#3
0
        public override Command Create()
        {
            Command command = new Command("info")
            {
                _idOption,
            };

            command.Description = "Show project details";

            command.Handler = CommandHandler
                              .Create <string>((id) =>
            {
                _consoleProcessMessages.StartProcessMessage("info", id);

                ProjectConfigItem projectConfig = _projectConfigsAPI.GetProjectConfigById(id);

                if (projectConfig == null)
                {
                    _consoleProcessMessages.SetErrorInstruction(CLITextResources.IdNotExistCommandError.Replace("[Id]", id), NotificationErrorType.Error);
                }
                else
                {
                    string message = $"{"Id",-c_paddingRightForCaprions}: {projectConfig.Id}";
                    _consoleProcessMessages.SetInfoMessage(message);

                    message = $"{"Description",-c_paddingRightForCaprions}: {projectConfig.Description}";
                    _consoleProcessMessages.SetInfoMessage(message);

                    message = $"{"DBType",-c_paddingRightForCaprions}: {projectConfig.DBType}";
                    _consoleProcessMessages.SetInfoMessage(message);

                    message = $"{"ServerInstance",-c_paddingRightForCaprions}: {projectConfig.Server}";
                    _consoleProcessMessages.SetInfoMessage(message);

                    message = $"{"DataBaseName",-c_paddingRightForCaprions}: {projectConfig.DBName}";
                    _consoleProcessMessages.SetInfoMessage(message);

                    message = $"{"DBUsername",-c_paddingRightForCaprions}: {projectConfig.Username}";
                    _consoleProcessMessages.SetInfoMessage(message);

                    message = $"{"DBPassword",-c_paddingRightForCaprions}: {projectConfig.Password}";
                    _consoleProcessMessages.SetInfoMessage(message);

                    message = $"{"ConncetionTimeout",-c_paddingRightForCaprions}: {projectConfig.ConncetionTimeout}";
                    _consoleProcessMessages.SetInfoMessage(message);

                    message = $"{"Backup Folder Path",-c_paddingRightForCaprions}: {projectConfig.BackupFolderPath}";
                    _consoleProcessMessages.SetInfoMessage(message);

                    message = $"{"Dev Environment",-c_paddingRightForCaprions}: {projectConfig.DevEnvironment}";
                    _consoleProcessMessages.SetInfoMessage(message);

                    if (projectConfig.DevEnvironment)
                    {
                        message = $"{"Scripts Base Folder",-c_paddingRightForCaprions}: {projectConfig.DevScriptsBaseFolderPath}";
                        _consoleProcessMessages.SetInfoMessage(message);

                        message = $"{" Incremental Scripts Folder",-c_paddingRightForCaprions}: {projectConfig.IncrementalScriptsFolderPath}";
                        _consoleProcessMessages.SetInfoMessage(message);
                        message = $"{" Repeatable Scripts Folder",-c_paddingRightForCaprions}: {projectConfig.RepeatableScriptsFolderPath}";
                        _consoleProcessMessages.SetInfoMessage(message);
                        message = $"{" Dev Dummy Data Scripts Folder",-c_paddingRightForCaprions}: {projectConfig.DevDummyDataScriptsFolderPath}";
                        _consoleProcessMessages.SetInfoMessage(message);


                        message = $"{"Deploy Artifact Folder",-c_paddingRightForCaprions}: {projectConfig.DeployArtifactFolderPath}";
                        _consoleProcessMessages.SetInfoMessage(message);
                    }
                    else
                    {
                        message = $"{"Delivery Artifact Folder Path",-c_paddingRightForCaprions}: {projectConfig.DeliveryArtifactFolderPath}";
                        _consoleProcessMessages.SetInfoMessage(message);
                    }
                }
            });

            return(command);
        }