Example #1
0
        protected override StepResult HandleResult(string result, Queue <ConfigInitWizardStep> steps, Config config, string workingDirectory)
        {
            int parsed;

            if (int.TryParse(result, out parsed))
            {
                if (parsed == 0)
                {
                    steps.Enqueue(new EditConfigStep(Console, FileSystem));
                    return(StepResult.Ok());
                }

                try
                {
                    var foundBranch  = OrderedBranches(config).ElementAt(parsed - 1);
                    var branchConfig = foundBranch.Value;
                    if (branchConfig == null)
                    {
                        branchConfig = new BranchConfig();
                        config.Branches.Add(foundBranch.Key, branchConfig);
                    }
                    steps.Enqueue(new ConfigureBranch(foundBranch.Key, branchConfig, Console, FileSystem));
                    return(StepResult.Ok());
                }
                catch (ArgumentOutOfRangeException)
                { }
            }

            return(StepResult.InvalidResponseSelected());
        }
Example #2
0
    protected override StepResult HandleResult(string?result, Queue <ConfigInitWizardStep> steps, Config config, string workingDirectory)
    {
        switch (result)
        {
        case "1":
            config.VersioningMode = VersioningMode.ContinuousDelivery;
            steps.Enqueue(this.returnToStep !);
            return(StepResult.Ok());

        case "2":
            config.VersioningMode = VersioningMode.ContinuousDeployment;
            steps.Enqueue(this.returnToStep !);
            return(StepResult.Ok());

        case "3":
            config.VersioningMode = VersioningMode.Mainline;
            steps.Enqueue(this.returnToStep !);
            return(StepResult.Ok());

        case "0":
        case "4":
            steps.Enqueue(this.returnToStep !);
            return(StepResult.Ok());
        }

        return(StepResult.InvalidResponseSelected());
    }
Example #3
0
        protected override StepResult HandleResult(string result, Queue <ConfigInitWizardStep> steps, Config config, string workingDirectory)
        {
            if (string.IsNullOrWhiteSpace(result))
            {
                return(StepResult.InvalidResponseSelected());
            }

            var configureBranchStep = StepFactory.CreateStep <ConfigureBranch>();

            switch (result)
            {
            case "0":
                steps.Enqueue(configureBranchStep.WithData(name, branchConfig));
                return(StepResult.Ok());

            case "1":
                branchConfig.Tag = string.Empty;
                steps.Enqueue(configureBranchStep.WithData(name, branchConfig));
                return(StepResult.Ok());

            default:
                branchConfig.Tag = result;
                steps.Enqueue(configureBranchStep.WithData(name, branchConfig));
                return(StepResult.Ok());
            }
        }
Example #4
0
        protected override StepResult HandleResult(string result, Queue <ConfigInitWizardStep> steps, Config config, string workingDirectory)
        {
            if (int.TryParse(result, out var parsed))
            {
                if (parsed == 0)
                {
                    steps.Enqueue(StepFactory.CreateStep <EditConfigStep>());
                    return(StepResult.Ok());
                }

                try
                {
                    var foundBranch  = OrderedBranches(config).ElementAt(parsed - 1);
                    var branchConfig = foundBranch.Value;
                    if (branchConfig == null)
                    {
                        branchConfig = new BranchConfig {
                            Name = foundBranch.Key
                        };
                        config.Branches.Add(foundBranch.Key, branchConfig);
                    }
                    steps.Enqueue(StepFactory.CreateStep <ConfigureBranch>().WithData(foundBranch.Key, branchConfig));
                    return(StepResult.Ok());
                }
                catch (ArgumentOutOfRangeException)
                { }
            }

            return(StepResult.InvalidResponseSelected());
        }
Example #5
0
        protected override StepResult HandleResult(string result, Queue <ConfigInitWizardStep> steps, Config config, string workingDirectory, IFileSystem fileSystem)
        {
            switch (result)
            {
            case "0":
                steps.Enqueue(new EditConfigStep());
                return(StepResult.Ok());

            case "1":
                config.AssemblyVersioningScheme = AssemblyVersioningScheme.Major;
                steps.Enqueue(new EditConfigStep());
                return(StepResult.Ok());

            case "2":
                config.AssemblyVersioningScheme = AssemblyVersioningScheme.MajorMinor;
                steps.Enqueue(new EditConfigStep());
                return(StepResult.Ok());

            case "3":
                config.AssemblyVersioningScheme = AssemblyVersioningScheme.MajorMinorPatch;
                steps.Enqueue(new EditConfigStep());
                return(StepResult.Ok());

            case "4":
                config.AssemblyVersioningScheme = AssemblyVersioningScheme.MajorMinorPatchTag;
                steps.Enqueue(new EditConfigStep());
                return(StepResult.Ok());
            }

            return(StepResult.InvalidResponseSelected());
        }
    protected override StepResult HandleResult(string?result, Queue <ConfigInitWizardStep> steps, Config config, string workingDirectory)
    {
        switch (result?.ToLower())
        {
        case "y":
            this.Console.Write(@"Because you need to maintain multiple versions of your product in production at the same time, GitFlow is likely a good fit.

GitFlow allows you to have new development happening on the 'develop' branch, patch issues in old minor versions with 'hotfix/' branches and support old major versions with 'support/' branches");
            steps.Enqueue(this.StepFactory.CreateStep <PickBranchingStrategyStep>() !);
            return(StepResult.Ok());

        case "n":
            steps.Enqueue(this.StepFactory.CreateStep <PickBranchingStrategy2Step>() !);
            return(StepResult.Ok());
        }

        return(StepResult.InvalidResponseSelected());
    }
Example #7
0
    protected override StepResult HandleResult(string?result, Queue <ConfigInitWizardStep> steps, Config config, string workingDirectory)
    {
        var editConfigStep = this.StepFactory.CreateStep <EditConfigStep>();

        if (result.IsNullOrEmpty())
        {
            steps.Enqueue(editConfigStep);
            return(StepResult.Ok());
        }

        if (!SemanticVersion.TryParse(result, string.Empty, out var semVer))
        {
            return(StepResult.InvalidResponseSelected());
        }

        config.NextVersion = semVer.ToString("t");
        steps.Enqueue(editConfigStep);
        return(StepResult.Ok());
    }
Example #8
0
        protected override StepResult HandleResult(string result, Queue <ConfigInitWizardStep> steps, Config config, string workingDirectory)
        {
            switch (result)
            {
            case "0":
                steps.Enqueue(new ConfigureBranches(Console, FileSystem));
                return(StepResult.Ok());

            case "1":
                steps.Enqueue(new SetBranchTag(name, branchConfig, Console, FileSystem));
                return(StepResult.Ok());

            case "2":
                steps.Enqueue(new SetBranchIncrementMode(name, branchConfig, Console, FileSystem));
                return(StepResult.Ok());
            }

            return(StepResult.InvalidResponseSelected());
        }
Example #9
0
    protected override StepResult HandleResult(string?result, Queue <ConfigInitWizardStep> steps, Config config, string workingDirectory)
    {
        switch (result)
        {
        case "0":
            steps.Enqueue(this.StepFactory.CreateStep <ConfigureBranches>() !);
            return(StepResult.Ok());

        case "1":
            steps.Enqueue(this.StepFactory.CreateStep <SetBranchTag>() !.WithData(name, branchConfig));
            return(StepResult.Ok());

        case "2":
            steps.Enqueue(this.StepFactory.CreateStep <SetBranchIncrementMode>() !.WithData(name !, branchConfig !));
            return(StepResult.Ok());
        }

        return(StepResult.InvalidResponseSelected());
    }
Example #10
0
        protected override StepResult HandleResult(string result, Queue <ConfigInitWizardStep> steps, Config config, string workingDirectory)
        {
            switch (result)
            {
            case "0":
                steps.Enqueue(new EditConfigStep(Console, FileSystem));
                return(StepResult.Ok());

            case "1":
                GenerateBasicConfig(workingDirectory);
                steps.Enqueue(new EditConfigStep(Console, FileSystem));
                return(StepResult.Ok());

            case "2":
                GenerateNuGetConfig(workingDirectory);
                steps.Enqueue(new EditConfigStep(Console, FileSystem));
                return(StepResult.Ok());
            }
            return(StepResult.InvalidResponseSelected());
        }
Example #11
0
        protected override StepResult HandleResult(string result, Queue <ConfigInitWizardStep> steps, Config config, string workingDirectory)
        {
            switch (result)
            {
            case "0":
                steps.Enqueue(new EditConfigStep(Console, FileSystem));
                return(StepResult.Ok());

            case "1":
                config.AssemblyInformationalVersioningScheme = AssemblyInformationalVersioningScheme.FullInformationalVersion;
                steps.Enqueue(new EditConfigStep(Console, FileSystem));
                return(StepResult.Ok());

            case "2":
                config.AssemblyInformationalVersioningScheme = AssemblyInformationalVersioningScheme.NugetVersion;
                steps.Enqueue(new EditConfigStep(Console, FileSystem));
                return(StepResult.Ok());
            }

            return(StepResult.InvalidResponseSelected());
        }
        protected override StepResult HandleResult(string result, Queue <ConfigInitWizardStep> steps, Config config, string workingDirectory)
        {
            switch (result)
            {
            case "0":
                steps.Enqueue(new ConfigureBranch(name, branchConfig, Console, FileSystem));
                return(StepResult.Ok());

            case "1":
                branchConfig.VersioningMode = VersioningMode.ContinuousDelivery;
                steps.Enqueue(new ConfigureBranch(name, branchConfig, Console, FileSystem));
                return(StepResult.Ok());

            case "2":
                branchConfig.VersioningMode = VersioningMode.ContinuousDeployment;
                steps.Enqueue(new ConfigureBranch(name, branchConfig, Console, FileSystem));
                return(StepResult.Ok());
            }

            return(StepResult.InvalidResponseSelected());
        }
        protected override StepResult HandleResult(string result, Queue <ConfigInitWizardStep> steps, Config config, string workingDirectory, IFileSystem fileSystem)
        {
            switch (result.ToLower())
            {
            case "y":
                Console.WriteLine("GitFlow is likely a good fit, the 'develop' branch can be used " +
                                  "for active development while stabilising the next release.");
                Console.WriteLine();
                Console.WriteLine("GitHubFlow is designed for a lightweight workflow where master is always " +
                                  "good to deploy to production and feature branches are used to stabilise " +
                                  "features, once stable they are merged to master and made available in the next release");
                steps.Enqueue(new PickBranchingStrategyStep());
                return(StepResult.Ok());

            case "n":
                steps.Enqueue(new PickBranchingStrategy3Step());
                return(StepResult.Ok());
            }

            return(StepResult.InvalidResponseSelected());
        }
Example #14
0
    protected override StepResult HandleResult(string?result, Queue <ConfigInitWizardStep> steps, Config config, string workingDirectory)
    {
        var editConfigStep = this.StepFactory.CreateStep <EditConfigStep>() !;

        switch (result)
        {
        case "0":
            steps.Enqueue(editConfigStep);
            return(StepResult.Ok());

        case "1":
            GenerateBasicConfig(workingDirectory);
            steps.Enqueue(editConfigStep);
            return(StepResult.Ok());

        case "2":
            GenerateNuGetConfig(workingDirectory);
            steps.Enqueue(editConfigStep);
            return(StepResult.Ok());
        }
        return(StepResult.InvalidResponseSelected());
    }
        protected override StepResult HandleResult(string result, Queue <ConfigInitWizardStep> steps, Config config, string workingDirectory)
        {
            switch (result)
            {
            case "1":
                steps.Enqueue(new GitFlowSetupStep(Console, FileSystem));
                break;

            case "2":
                steps.Enqueue(new GitHubFlowStep(Console, FileSystem));
                break;

            case "3":
                steps.Enqueue(new PickBranchingStrategy1Step(Console, FileSystem));
                break;

            default:
                return(StepResult.InvalidResponseSelected());
            }

            return(StepResult.Ok());
        }
    protected override StepResult HandleResult(string?result, Queue <ConfigInitWizardStep> steps, Config config, string workingDirectory)
    {
        var editConfigStep = this.StepFactory.CreateStep <EditConfigStep>() !;

        switch (result)
        {
        case "0":
            steps.Enqueue(editConfigStep);
            return(StepResult.Ok());

        case "1":
            config.AssemblyVersioningScheme = AssemblyVersioningScheme.Major;
            steps.Enqueue(editConfigStep);
            return(StepResult.Ok());

        case "2":
            config.AssemblyVersioningScheme = AssemblyVersioningScheme.MajorMinor;
            steps.Enqueue(editConfigStep);
            return(StepResult.Ok());

        case "3":
            config.AssemblyVersioningScheme = AssemblyVersioningScheme.MajorMinorPatch;
            steps.Enqueue(editConfigStep);
            return(StepResult.Ok());

        case "4":
            config.AssemblyVersioningScheme = AssemblyVersioningScheme.MajorMinorPatchTag;
            steps.Enqueue(editConfigStep);
            return(StepResult.Ok());

        case "5":
            config.AssemblyVersioningScheme = AssemblyVersioningScheme.None;
            steps.Enqueue(editConfigStep);
            return(StepResult.Ok());
        }

        return(StepResult.InvalidResponseSelected());
    }
        protected override StepResult HandleResult(string result, Queue <ConfigInitWizardStep> steps, Config config, string workingDirectory, IFileSystem fileSystem)
        {
            switch (result.ToLower())
            {
            case "y":
                Console.WriteLine("GitFlow could be a better fit than GitHubFlow for you.");
                Console.WriteLine();
                Console.WriteLine("GitVersion increments the SemVer for each commit on the develop branch by default, " +
                                  "this means all packages built from develop can be published to a single NuGet feed.");
                break;

            case "n":
                Console.WriteLine("We recommend the GitHubFlow branching strategy, it sounds like you will " +
                                  "not benefit from the additional complexity that GitFlow introduces");
                break;

            default:
                return(StepResult.InvalidResponseSelected());
            }

            steps.Enqueue(new PickBranchingStrategyStep());
            return(StepResult.Ok());
        }
Example #18
0
        protected override StepResult HandleResult(string result, Queue <ConfigInitWizardStep> steps, Config config, string workingDirectory)
        {
            var configureBranchStep = StepFactory.CreateStep <ConfigureBranch>();

            switch (result)
            {
            case "0":
                steps.Enqueue(configureBranchStep.WithData(name, branchConfig));
                return(StepResult.Ok());

            case "1":
                branchConfig.VersioningMode = VersioningMode.ContinuousDelivery;
                steps.Enqueue(configureBranchStep.WithData(name, branchConfig));
                return(StepResult.Ok());

            case "2":
                branchConfig.VersioningMode = VersioningMode.ContinuousDeployment;
                steps.Enqueue(configureBranchStep.WithData(name, branchConfig));
                return(StepResult.Ok());
            }

            return(StepResult.InvalidResponseSelected());
        }
Example #19
0
    protected override StepResult HandleResult(string?result, Queue <ConfigInitWizardStep> steps, Config config, string workingDirectory)
    {
        switch (result)
        {
        case "0":
            return(StepResult.SaveAndExit());

        case "1":
            return(StepResult.ExitWithoutSaving());

        case "2":
            steps.Enqueue(this.StepFactory.CreateStep <PickBranchingStrategyStep>());
            return(StepResult.Ok());

        case "3":
            steps.Enqueue(this.StepFactory.CreateStep <SetNextVersion>());
            return(StepResult.Ok());

        case "4":
            steps.Enqueue(this.StepFactory.CreateStep <ConfigureBranches>());
            return(StepResult.Ok());

        case "5":
            var editConfigStep = this.StepFactory.CreateStep <EditConfigStep>();
            steps.Enqueue(this.StepFactory.CreateStep <GlobalModeSetting>().WithData(editConfigStep, false));
            return(StepResult.Ok());

        case "6":
            steps.Enqueue(this.StepFactory.CreateStep <AssemblyVersioningSchemeSetting>());
            return(StepResult.Ok());

        case "7":
            steps.Enqueue(this.StepFactory.CreateStep <SetupBuildScripts>());
            return(StepResult.Ok());
        }
        return(StepResult.InvalidResponseSelected());
    }
Example #20
0
        protected override StepResult HandleResult(string result, Queue <ConfigInitWizardStep> steps, Config config, string workingDirectory)
        {
            var returnToStep = StepFactory.CreateStep <FinishedSetupStep>();

            switch (result)
            {
            case "1":
                steps.Enqueue(StepFactory.CreateStep <GitFlowSetupStep>().WithData(returnToStep, true));
                break;

            case "2":
                steps.Enqueue(StepFactory.CreateStep <GitHubFlowStep>().WithData(returnToStep, true));
                break;

            case "3":
                steps.Enqueue(StepFactory.CreateStep <PickBranchingStrategy1Step>());
                break;

            default:
                return(StepResult.InvalidResponseSelected());
            }

            return(StepResult.Ok());
        }
Example #21
0
        protected override StepResult HandleResult(string result, Queue <ConfigInitWizardStep> steps, Config config, string workingDirectory)
        {
            if (string.IsNullOrWhiteSpace(result))
            {
                return(StepResult.InvalidResponseSelected());
            }

            switch (result)
            {
            case "0":
                steps.Enqueue(new ConfigureBranch(name, branchConfig, Console, FileSystem));
                return(StepResult.Ok());

            case "1":
                branchConfig.Tag = string.Empty;
                steps.Enqueue(new ConfigureBranch(name, branchConfig, Console, FileSystem));
                return(StepResult.Ok());

            default:
                branchConfig.Tag = result;
                steps.Enqueue(new ConfigureBranch(name, branchConfig, Console, FileSystem));
                return(StepResult.Ok());
            }
        }