/// <summary>
        /// Flow to create a new environment group
        /// </summary>
        /// <returns></returns>
        private static async Task CreateEnvironmentGroup()
        {
            Console.WriteLine("Creating new Environment Group");

            //Get GroupName
            Console.WriteLine("Enter new group name:");
            var groupName = Console.ReadLine();

            EnvironmentGroup newGroup = new EnvironmentGroup();

            newGroup.Name = groupName;

            //Get all projects
            var allProject = await _appVeyorService.GetAllAppVeyorProjects();

            Console.WriteLine("Pick a Project:");
            var menu          = new TypedMenu <AppVeyorProject>(allProject, "Choose a number", x => x.Name);
            var pickedProject = menu.Display();

            newGroup.Project = pickedProject;

            //Get all environments
            var allEnv = await _appVeyorService.GetAllAppVeyorEnvironments();

            AskForEnvironment(newGroup, allEnv);

            //Save group
            //Write JSON to file
            _groupFileService.SaveGroupToFile(newGroup);
            Console.WriteLine("Saved Environment Group {0} with {1} environments", newGroup.Name, newGroup.Environments.Count);
        }
Example #2
0
        /// <summary>
        /// Flow to create a new environment group
        /// </summary>
        /// <returns></returns>
        private static async Task CreateEnvironmentGroup()
        {
            Console.WriteLine("Creating new Environment Group");

            //Get GroupName
            Console.WriteLine("Enter new group name:");
            var groupName = Console.ReadLine();

            EnvironmentGroup newGroup = new EnvironmentGroup();

            newGroup.Name = groupName;

            Console.WriteLine("Default branch (develop):");
            var defaultBranch = Console.ReadLine();

            if (!string.IsNullOrWhiteSpace(defaultBranch))
            {
                newGroup.DefaultBranch = defaultBranch;
            }

            //Get all projects
            Console.WriteLine("Fetching projects...");
            var allProject = await _appVeyorService.GetAllAppVeyorProjects();

            Console.WriteLine("Pick a Project:");
            var menu          = new TypedMenu <AppVeyorProject>(allProject, "Choose a number", x => x.Name);
            var pickedProject = menu.Display();

            newGroup.Project = pickedProject;

            //Get all environments
            var allEnv = await _appVeyorService.GetAllAppVeyorEnvironmentsForProject(newGroup.Project.AccountName + "/" + newGroup.Project.Slug);

            AskForEnvironment(newGroup, allEnv);

            //Save group
            //Write JSON to file
            _groupFileService.SaveGroupToFile(newGroup);
            Console.WriteLine("Saved Environment Group {0} with {1} environments", newGroup.Name, newGroup.Environments.Count);
        }