Exemplo n.º 1
0
        public static TemplateRequest BuildTemplateRequest(NewCommandInput input)
        {
            var request = new TemplateRequest
            {
                RootDirectory = input.SolutionDirectory(),
                SolutionName  = input.SolutionName
            };

            request.AddTemplate(_rippleTemplates[input.RippleFlag]);

            if (input.AppFlag)
            {
                var projectRequest = addApplicationProject(input, request);
                if (input.TestsFlag)
                {
                    var testing = new TestProjectRequest(projectRequest.Name + ".Testing", "baseline",
                                                         projectRequest.Name);

                    testing.AddAlteration("unit-testing");

                    request.AddTestingRequest(testing);
                }
            }

            request.AddTemplate("baseline");

            return(request);
        }
Exemplo n.º 2
0
        // SAMPLE: building-template-request
        private static TemplateRequest buildTemplateRequest()
        {
            var request = new TemplateRequest
            {
                RootDirectory = "root directory",
                SolutionName  = "MySolution.sln"
            };

            // Add a project named "MyProject" using a project template named "basic-new-project"
            request.AddProjectRequest("MyProject", "basic-new-project", project => {
                // Add some extra templates from the /alterations folder
                project.Alterations.Add("raven");
                project.Alterations.Add("spark");

                // Add some substitution values for the templating if desired
                // See the topic page for subsitutions and inputs
                project.Substitutions.Set("%SHORT_NAME%", "MyProj");
            });

            // Add a testing project related to our first project using the "unit-testing" project template
            // See the topic about testing projects
            request.AddTestingRequest(new ProjectRequest("MyProject.Testing", "unit-testing", "MyProject"));

            return(request);
        }
Exemplo n.º 3
0
        public static void AddMatchingTestingProject(this TemplateRequest request, ProjectRequest project)
        {
            var testing = new ProjectRequest(project.Name + ".Testing", "baseline",
                                             project.Name);

            testing.Alterations.Add("unit-testing");
            testing.OriginalProject = project.Name;
            testing.Version         = project.Version ?? DotNetVersion.V40;

            request.AddTestingRequest(testing);
        }
Exemplo n.º 4
0
        public void validate_missing_testing_template()
        {
            var request = new TemplateRequest();

            request.AddTemplate("Simple");
            request.AddProjectRequest(new ProjectRequest("foo", "MvcApp"));
            request.AddTestingRequest(new ProjectRequest("foo", "NonExistent", "original"));

            var missing = request.Validate(theTemplates).Single();

            missing.Name.ShouldEqual("NonExistent");
            missing.TemplateType.ShouldEqual(TemplateType.Project);
            missing.ValidChoices.ShouldHaveTheSameElementsAs("MvcApp", "MvcBottle");
        }
Exemplo n.º 5
0
        public void validate_when_everything_matches()
        {
            var request = new TemplateRequest();

            request.AddTemplate("Simple");

            request.Validate(theTemplates).Any().ShouldBeFalse();

            request.AddProjectRequest(new ProjectRequest("foo", "MvcApp"));

            request.Validate(theTemplates).Any().ShouldBeFalse();

            request.Projects.Single().Alterations.Add("Assets");

            request.AddTestingRequest(new ProjectRequest("foo", "MvcApp", "original"));

            request.Validate(theTemplates).Any().ShouldBeFalse();
        }
Exemplo n.º 6
0
        public static TemplateRequest BuildTemplateRequest(BottleInput input, string solutionFile)
        {
            var request = new TemplateRequest
            {
                RootDirectory = Environment.CurrentDirectory.ToFullPath(),
                SolutionName  = solutionFile
            };

            var projectRequest = new ProjectRequest(input.Name, "baseline");

            // TODO -- duplication!
            if (input.ShortNameFlag.IsNotEmpty())
            {
                projectRequest.Substitutions.Set(ProjectPlan.SHORT_NAME, input.ShortNameFlag);
            }

            request.AddProjectRequest(projectRequest);
            projectRequest.AddAlteration("fubu-bottle");

            // TODO -- some duplication here.
            if (input.TestsFlag)
            {
                var testing = new TestProjectRequest(projectRequest.Name + ".Testing", "baseline",
                                                     projectRequest.Name);

                testing.AddAlteration("unit-testing");

                request.AddTestingRequest(testing);
            }

            if (input.OptionsFlag != null)
            {
                input.OptionsFlag.Each(projectRequest.AddAlteration);
            }

            return(request);
        }