コード例 #1
0
ファイル: Templating.cs プロジェクト: JackGilliam1/fubu
        public static TemplatePlan BuildPlan(TemplateRequest request)
        {
            var planner = new TemplatePlanBuilder(_templates.Value);

            var plan = planner.BuildPlan(request);

            if (plan.Steps.OfType <GemReference>().Any())
            {
                plan.Add(new BundlerStep());
            }

            return(plan);
        }
コード例 #2
0
ファイル: Samples.cs プロジェクト: see-sharply/FubuCsProjFile
        public void generate_a_simple_template()
        {
            // SAMPLE: generating-with-templates
            var library = new TemplateLibrary("path to your templates");
            var builder = new TemplatePlanBuilder(library);
            var request = buildTemplateRequest();

            // Build a TemplatePlan
            var plan = builder.BuildPlan(request);

            plan.Execute();
            // ENDSAMPLE
        }
コード例 #3
0
        public void build_with_missing_solution()
        {
            var request = new TemplateRequest
            {
                SolutionName  = "MySolution",
                RootDirectory = "root"
            };

            var plan = new TemplatePlanBuilder(new TemplateLibrary("."))
                       .BuildPlan(request);

            var create = plan.Steps.First().ShouldBeOfType <CreateSolution>();

            create.SolutionName.ShouldEqual("MySolution");
        }
コード例 #4
0
        public void respects_version_number_for_VS()
        {
            var request = new TemplateRequest
            {
                SolutionName  = "MySolution",
                RootDirectory = "root",
                Version       = Solution.VS2010
            };

            var plan = new TemplatePlanBuilder(new TemplateLibrary("."))
                       .BuildPlan(request);

            var create = plan.Steps.First().ShouldBeOfType <CreateSolution>();

            create.SolutionName.ShouldEqual("MySolution");
            create.Version.ShouldEqual(request.Version);
        }
コード例 #5
0
        public void copies_substitution_values_from_request_to_solution()
        {
            var request = new TemplateRequest
            {
                SolutionName  = "MySolution",
                RootDirectory = "root"
            };

            request.Substitutions.Set("Key", "12345");
            request.Substitutions.Set("Password", "45678");

            var plan = new TemplatePlanBuilder(new TemplateLibrary("."))
                       .BuildPlan(request);

            plan.Substitutions.ValueFor("Key").ShouldEqual("12345");
            plan.Substitutions.ValueFor("Password").ShouldEqual("45678");
        }
コード例 #6
0
        public void build_with_existing_solution_should_just_read_the_current_one()
        {
            var original = Solution.CreateNew("root".AppendPath("src"), "MySolution");

            original.Save();

            var request = new TemplateRequest
            {
                SolutionName  = "MySolution",
                RootDirectory = "root"
            };

            var plan = new TemplatePlanBuilder(new TemplateLibrary("."))
                       .BuildPlan(request);

            var readSolution = plan.Steps.First().ShouldBeOfType <ReadSolution>();

            readSolution.SolutionFile.ToFullPath()
            .ShouldEqual(original.Filename.ToFullPath());
        }