示例#1
0
        private string AskUserForCloudApplicationName(ProjectDefinition project, List <CloudApplication> existingApplications)
        {
            var defaultName = "";

            try
            {
                defaultName = _cloudApplicationNameGenerator.GenerateValidName(project, existingApplications);
            }
            catch { }

            var cloudApplicationName = "";

            while (true)
            {
                _toolInteractiveService.WriteLine();

                if (!existingApplications.Any())
                {
                    var title = "Name the AWS stack to deploy your application to" + Environment.NewLine +
                                "(A stack is a collection of AWS resources that you can manage as a single unit.)" + Environment.NewLine +
                                "--------------------------------------------------------------------------------";

                    cloudApplicationName =
                        _consoleUtilities.AskUserForValue(
                            title,
                            defaultName,
                            allowEmpty: false,
                            defaultAskValuePrompt: Constants.CLI.PROMPT_NEW_STACK_NAME);
                }
                else
                {
                    var title = "Select the AWS stack to deploy your application to" + Environment.NewLine +
                                "(A stack is a collection of AWS resources that you can manage as a single unit.)";

                    var userResponse =
                        _consoleUtilities.AskUserToChooseOrCreateNew(
                            existingApplications.Select(x => x.Name),
                            title,
                            askNewName: true,
                            defaultNewName: defaultName,
                            defaultChoosePrompt: Constants.CLI.PROMPT_CHOOSE_STACK_NAME,
                            defaultCreateNewPrompt: Constants.CLI.PROMPT_NEW_STACK_NAME,
                            defaultCreateNewLabel: Constants.CLI.CREATE_NEW_STACK_LABEL);

                    cloudApplicationName = userResponse.SelectedOption ?? userResponse.NewName;
                }

                if (!string.IsNullOrEmpty(cloudApplicationName) &&
                    _cloudApplicationNameGenerator.IsValidName(cloudApplicationName))
                {
                    return(cloudApplicationName);
                }

                PrintInvalidStackNameMessage();
            }
        }
        public Task <object> Execute(Recommendation recommendation, OptionSettingItem optionSetting)
        {
            var settingValue =
                _consoleUtilities.AskUserForValue(
                    string.Empty,
                    recommendation.GetOptionSettingValue <string>(optionSetting),
                    allowEmpty: false,
                    resetValue: recommendation.GetOptionSettingDefaultValue <string>(optionSetting) ?? "");

            recommendation.DeploymentBundle.DotnetPublishBuildConfiguration = settingValue;
            return(Task.FromResult <object>(settingValue));
        }
        public Task <object> Execute(Recommendation recommendation, OptionSettingItem optionSetting)
        {
            var settingValue = _consoleUtilities
                               .AskUserForValue(
                string.Empty,
                recommendation.GetOptionSettingValue <string>(optionSetting),
                allowEmpty: true,
                resetValue: recommendation.GetOptionSettingDefaultValue <string>(optionSetting) ?? "",
                validators: executionDirectory => ValidateExecutionDirectory(executionDirectory));

            recommendation.DeploymentBundle.DockerExecutionDirectory = settingValue;
            return(Task.FromResult <object>(settingValue));
        }
示例#4
0
        public Task <object> Execute(Recommendation recommendation, OptionSettingItem optionSetting)
        {
            var settingValue = _consoleUtilities
                               .AskUserForValue(
                string.Empty,
                recommendation.GetOptionSettingValue <string>(optionSetting),
                allowEmpty: true,
                resetValue: recommendation.GetOptionSettingDefaultValue <string>(optionSetting) ?? "",
                validators: buildArgs => ValidateBuildArgs(buildArgs))
                               .ToString()
                               .Replace("\"", "\"\"");

            recommendation.DeploymentBundle.DockerBuildArgs = settingValue;
            return(Task.FromResult <object>(settingValue));
        }