Ejemplo n.º 1
0
        static void AddProfile()
        {
            ProfileConfig profile = new ProfileConfig();

            ModifyProfile(profile);

            configFile.Profiles.Add(profile);
            SaveConfig();
        }
Ejemplo n.º 2
0
        static void ModifyProfile(ProfileConfig profile)
        {
            PromptWithDefault("Please give this profile a name", ref profile.Name);
            PromptWithDefault("Enter the output path", ref profile.OutputFolder);
            profile.EnvironmentName = PromptWithList("Select the environment this profile should use", configFile.Environments).Name;

            var availableProviders = FindProviders();

            profile.DataProviders = SelectMultipleFromList <string>("Select which data providers you would like", availableProviders);

            /* TODO: Builder support for RawData entries */

            ModifyFilters(profile.Filters, profile.DataProviders.Contains(new MessageCatalogProcessor().ProcessorID));

            if (profile.DataProviders.Contains(new RawDataProcessor().ProcessorID))
            {
                ConfigureRawData(profile.Filters.RawData);
            }

            var commitByOprid = "y";

            PromptWithDefault("Would you like commits done by OPRID where possible? (y/n)", ref commitByOprid);
            profile.Repository.CommitByOprid = (commitByOprid == "y");

            var configRemoteRepo = "n";

            PromptWithDefault("Would you like to configure a remote repository? (y/n)", ref configRemoteRepo);
            if (configRemoteRepo == "y")
            {
                var repoConfig = profile.Repository;

                var repoUrl = repoConfig.Url;
                PromptWithDefault("Please enter the URL for the remote repository", ref repoUrl);
                repoConfig.Url = repoUrl;

                var username = repoConfig.User;
                PromptWithDefault("Please enter the username for pushing changes", ref username);
                repoConfig.User = username;

                var password = "******";
                PromptWithDefault("Please enter the password for pushing changes", ref password);
                if (password != "***")
                {
                    repoConfig.Password = password;
                }
            }

            SaveConfig();
        }
Ejemplo n.º 3
0
        static void ProcessConfigQuestions()
        {
            /* Check for environments, if none we need to add one before moving on to profiles */
            if (configFile.Environments.Count == 0)
            {
                Console.WriteLine("There are currently no environments defined. Making a new one.");
                AddEnvironment();
            }

            var modifyEnv = "n";

            do
            {
                PromptWithDefault("Would you like to modify an existing environment? (y/n)", ref modifyEnv);

                if (modifyEnv == "y")
                {
                    EnvironmentConfig toModify = PromptWithList("Select the environment you wish to modify", configFile.Environments);
                    ModifyEnvironment(toModify);
                }
            } while (modifyEnv == "y");

            var addEnv = "n";

            do
            {
                PromptWithDefault("Would you like to create a new environment? (y/n)", ref addEnv);

                if (addEnv == "y")
                {
                    AddEnvironment();
                }
            } while (addEnv == "y");


            /* Check for profiles, if none we need to add one */
            if (configFile.Profiles.Count == 0)
            {
                Console.WriteLine("There are currently no profiles defined. Making a new one.");
                AddProfile();
            }

            var modifyProfile = "n";

            do
            {
                PromptWithDefault("Would you like to modify an existing profile? (y/n)", ref modifyProfile);

                if (modifyProfile == "y")
                {
                    ProfileConfig toModify = PromptWithList("Select the profile you wish to modify", configFile.Profiles);
                    ModifyProfile(toModify);
                }
            } while (modifyEnv == "y");


            var addProfile = "n";

            do
            {
                PromptWithDefault("Would you like to create a new profile? (y/n)", ref addProfile);

                if (addProfile == "y")
                {
                    AddProfile();
                }
            } while (addProfile == "y");
        }