public void SetUp()
        {
            thePlan = TemplatePlan.CreateClean("copy-references");

            thePlan.FileSystem.WriteStringToFile("ripple.dependencies.config", @"FubuCore
            FubuMVC.Core
            ");

            thePlan.Add(new CreateSolution("References"));
            var originalPlan = new ProjectPlan("References");
            thePlan.Add(originalPlan);
            originalPlan.Add(new SystemReference("System.Data"));
            originalPlan.Add(new SystemReference("System.Configuration"));
            originalPlan.Add(new CopyFileToProject("ripple.dependencies.config", "ripple.dependencies.config"));
            originalPlan.NugetDeclarations.Add("Bottles");
            originalPlan.NugetDeclarations.Add("FubuMVC.Core");
            originalPlan.NugetDeclarations.Add("FubuLocalization");

            testingPlan = new ProjectPlan("References.Testing");
            thePlan.Add(testingPlan);
            thePlan.Add(new CopyProjectReferences("References"));

            thePlan.Execute();

            theOriginalProject = thePlan.Solution.FindProject("References").Project;
            theTestingProject = thePlan.Solution.FindProject("References.Testing").Project;
        }
예제 #2
0
        public void project_folder_is_substituted()
        {
            thePlan = TemplatePlan.CreateClean("create-solutionProject");
            thePlan.Add(new CreateSolution("MySolution"));
            thePlan.Add(new ProjectPlan("MyProject"));

            thePlan.Execute();

            thePlan.CurrentProject.ApplySubstitutions("*%PROJECT_FOLDER%*")
                   .ShouldEqual("*src/MyProject*");
        }
예제 #3
0
        public void alter_by_creating_new_project_from_default_template()
        {
            thePlan = TemplatePlan.CreateClean("create-solutionProject");
            thePlan.Add(new CreateSolution("MySolution"));
            thePlan.Add(new ProjectPlan("MyProject"));

            thePlan.Execute();

            var file = thePlan.SourceDirectory.AppendPath("MyProject", "MyProject.csproj");
            File.Exists(file).ShouldBeTrue();

            var project = CsProjFile.LoadFrom(file);
            project.ShouldNotBeNull();  // really just a smoke test
        }
예제 #4
0
 public static void ConfigurePlan(TextFile textFile, TemplatePlan plan)
 {
     textFile.ReadLines().Each(line => {
         var parts = line.ToDelimitedArray();
         plan.Add(new GemReference(parts.First(), parts.Last()));
     });
 }
 private void applyTestingTemplates(TemplateRequest request, TemplatePlan plan)
 {
     request.TestingProjects.Each(proj => {
         buildProjectPlan(plan, proj);
         plan.Add(new CopyProjectReferences(proj.OriginalProject));
     });
 }
        public void adds_the_project_file_to_the_csproj_file_as_Content()
        {
            thePlan = TemplatePlan.CreateClean("copy-file-to-project");

            thePlan.Add(new CreateSolution("MySolution"));
            var projectPlan = new ProjectPlan("MyProject");
            thePlan.Add(projectPlan);

            thePlan.FileSystem.WriteStringToFile("foo.txt", "some text");
            projectPlan.Add(new CopyFileToProject("foo.txt", "foo.txt"));

            thePlan.Execute();

            var project = CsProjFile.LoadFrom("copy-file-to-project".AppendPath("src", "MyProject", "MyProject.csproj"));
            project.Find<Content>("foo.txt").ShouldNotBeNull();
        }
        public void copy_a_deep_path_to_the_right_spot()
        {
            thePlan = TemplatePlan.CreateClean("copy-file-to-project");

            thePlan.Add(new CreateSolution("MySolution"));
            var projectPlan = new ProjectPlan("MyProject");
            thePlan.Add(projectPlan);

            thePlan.FileSystem.WriteStringToFile("foo.txt", "some text");
            projectPlan.Add(new CopyFileToProject("bar/folder/foo.txt", "foo.txt"));

            thePlan.Execute();

            var file = FileSystem.Combine(thePlan.SourceDirectory, "MyProject", "bar", "folder", "foo.txt");
            File.Exists(file).ShouldBeTrue();
        }
예제 #8
0
 private void applyTestingTemplates(TemplateRequest request, TemplatePlan plan)
 {
     request.TestingProjects.Each(proj => {
         buildProjectPlan(plan, proj);
         plan.Add(new CopyProjectReferences(proj.OriginalProject));
     });
 }
        public void applies_substitutions()
        {
            thePlan = TemplatePlan.CreateClean("copy-file-to-project");

            thePlan.Add(new CreateSolution("MySolution"));
            var projectPlan = new ProjectPlan("MyProject");
            thePlan.Add(projectPlan);
            projectPlan.Substitutions.Set("%TEAM%", "Chiefs");

            thePlan.FileSystem.WriteStringToFile("foo.txt", "*%TEAM%*");
            projectPlan.Add(new CopyFileToProject("foo.txt", "foo.txt"));

            thePlan.Execute();

            var file = FileSystem.Combine(thePlan.SourceDirectory, "MyProject", "foo.txt");
            thePlan.FileSystem.ReadStringFromFile(file).ShouldEqual("*Chiefs*");
        }
예제 #10
0
        public void alter_by_creating_a_new_project_with_a_project_template_file()
        {
            thePlan = TemplatePlan.CreateClean("create-solutionProject");
            thePlan.Add(new CreateSolution("MySolution"));
            thePlan.Add(new ProjectPlan("MyProject")
            {
                ProjectTemplateFile = "Project.txt"
            });

            thePlan.Execute();

            var file = thePlan.SourceDirectory.AppendPath("MyProject", "MyProject.csproj");
            File.Exists(file).ShouldBeTrue();

            var project = CsProjFile.LoadFrom(file);
            project.All<AssemblyReference>().Any(x => x.Include == "System.Data")
                .ShouldBeTrue(); // the 'special' testing template has this reference, but the default template does not
        }
예제 #11
0
        private static void determineSolutionFileHandling(TemplateRequest request, TemplatePlan plan)
        {
            var sourceDirectory = plan.SourceDirectory;
            var expectedFile = sourceDirectory.AppendPath(request.SolutionName);
            if (Path.GetExtension(expectedFile) != ".sln")
            {
                expectedFile += ".sln";
            }

            if (File.Exists(expectedFile))
            {
                plan.Add(new ReadSolution(expectedFile));
            }
            else
            {
                plan.Add(new CreateSolution(request.SolutionName)
                {
                    Version = request.Version
                });
            }
        }
예제 #12
0
        private static void determineSolutionFileHandling(TemplateRequest request, TemplatePlan plan)
        {
            var sourceDirectory = plan.SourceDirectory;
            var expectedFile    = sourceDirectory.AppendPath(request.SolutionName);

            if (Path.GetExtension(expectedFile) != ".sln")
            {
                expectedFile += ".sln";
            }

            if (File.Exists(expectedFile))
            {
                plan.Add(new ReadSolution(expectedFile));
            }
            else
            {
                plan.Add(new CreateSolution(request.SolutionName)
                {
                    Version = request.Version
                });
            }
        }
예제 #13
0
        private void buildProjectPlan(TemplatePlan plan, ProjectRequest proj)
        {
            var projectPlan = new ProjectPlan(proj.Name)
            {
                DotNetVersion = proj.Version ?? DotNetVersion.V40
            };

            plan.Add(projectPlan);

            proj.Substitutions.CopyTo(projectPlan.Substitutions);

            var planner = new ProjectPlanner();

            if (proj.Template.IsNotEmpty())
            {
                planner.CreatePlan(_library.Find(TemplateType.Project, proj.Template), plan);
            }

            _library.Find(TemplateType.Alteration, proj.Alterations)
            .Each(template => planner.CreatePlan(template, plan));
        }
예제 #14
0
        private void buildProjectPlan(TemplatePlan plan, ProjectRequest proj)
        {
            var projectPlan = new ProjectPlan(proj.Name) {DotNetVersion = proj.Version ?? DotNetVersion.V40};
            plan.Add(projectPlan);

            proj.Substitutions.CopyTo(projectPlan.Substitutions);

            var planner = new ProjectPlanner();
            if (proj.Template.IsNotEmpty())
            {
                planner.CreatePlan(_library.Find(TemplateType.Project, proj.Template), plan);
            }

            _library.Find(TemplateType.Alteration, proj.Alterations)
                    .Each(template => planner.CreatePlan(template, plan));
        }
예제 #15
0
        public void project_plan_applies_the_dot_net_version_2()
        {
            thePlan = TemplatePlan.CreateClean("create-solutionProject");
            thePlan.Add(new CreateSolution("MySolution"));
            var projectPlan = new ProjectPlan("MyProject");
            projectPlan.DotNetVersion = DotNetVersion.V45;

            thePlan.Add(projectPlan);

            thePlan.Execute();

            var file = thePlan.SourceDirectory.AppendPath("MyProject", "MyProject.csproj");
            File.Exists(file).ShouldBeTrue();

            var project = CsProjFile.LoadFrom(file);
            project.DotNetVersion.ShouldEqual(DotNetVersion.V45);
        }
예제 #16
0
 public static void ConfigurePlan(TextFile textFile, TemplatePlan plan)
 {
     var ignores = textFile.ReadLines().Where(x => x.IsNotEmpty()).ToArray();
     var step = new GitIgnoreStep(ignores);
     plan.Add(step);
 }