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;
        }
Beispiel #2
0
 public void Alter(TemplatePlan plan)
 {
     plan.AlterFile(".gitignore", delegate(List <string> list)
     {
         GenericEnumerableExtensions.Each <string>(this._entries, new Action <string>(list.Fill <string>));
     });
 }
Beispiel #3
0
        public void Alter(TemplatePlan plan)
        {
            if (!RemoteOperations.Enabled)
            {
                plan.Logger.WriteSuccess("Remote operations are disabled.");
                return;
            }

            var bundler = new ProcessStartInfo
            {
                UseShellExecute = true,
                FileName = "bundle",
                Arguments = "install",
                CreateNoWindow = true,
                WorkingDirectory = plan.Root
            };

            var process = Process.Start(bundler);
            process.WaitForExit();

            if (process.ExitCode != 0)
            {
                plan.Logger.WriteWarning("bundler install failed!");
            }
            else
            {
                plan.Logger.WriteSuccess("bundler install was successful");
            }
        }
Beispiel #4
0
        public void SetUp()
        {
            var context = TemplatePlan.CreateClean("assembly-info");

            context.Add(new CreateSolution("AssemblyInfoSolution"));

            var project = new ProjectPlan("MyProject");

            context.Add(project);

            var system = new FileSystem();

            system.CreateDirectory("assembly-info");
            system.CreateDirectory("assembly-info", "src");
            system.CreateDirectory("assembly-info", "src", "MyProject");
            system.CreateDirectory("assembly-info", "src", "MyProject", "Properties");


            var expectedPath = "assembly-info".AppendPath("src", "MyProject", "Properties", "AssemblyInfo.cs");

            system.WriteStringToFile(expectedPath, @"using System.Reflection;

[assembly: AssemblyTitle('MyProject')]
".Replace("'", "\""));

            var alteration = new AssemblyInfoAlteration("using System.Reflection;", "[assembly: AssemblyTitle(\"%ASSEMBLYNAME%\")]", "using FubuMVC.Core;", "[assembly: FubuModule]");

            project.Add(alteration);

            context.Execute();

            theProject  = CsProjFile.LoadFrom("assembly-info".AppendPath("src", "MyProject", "MyProject.csproj"));
            theContents =
                new FileSystem().ReadStringFromFile(expectedPath);
        }
Beispiel #5
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()));
     });
 }
Beispiel #6
0
        public void Alter(TemplatePlan plan)
        {
            if (!RemoteOperations.Enabled)
            {
                plan.Logger.WriteSuccess("Remote operations are disabled.");
                return;
            }

            var rake = new ProcessStartInfo
            {
                UseShellExecute = true,
                FileName = "rake",
                CreateNoWindow = true,
                WorkingDirectory = plan.Root
            };

            var process = Process.Start(rake);
            process.WaitForExit();

            if (process.ExitCode != 0)
            {
                plan.Logger.WriteWarning("rake script failed!");
            }
            else
            {
                plan.Logger.WriteSuccess("rake succeeded");
            }
        }
Beispiel #7
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);
        }
Beispiel #8
0
        public void Alter(TemplatePlan plan)
        {
            if (!RemoteOperations.Enabled)
            {
                plan.Logger.WriteSuccess("Remote operations are disabled.");
                return;
            }

            var bundler = new ProcessStartInfo
            {
                UseShellExecute  = true,
                FileName         = "bundle",
                Arguments        = "install",
                CreateNoWindow   = true,
                WorkingDirectory = plan.Root
            };

            var process = Process.Start(bundler);

            process.WaitForExit();

            if (process.ExitCode != 0)
            {
                plan.Logger.WriteWarning("bundler install failed!");
            }
            else
            {
                plan.Logger.WriteSuccess("bundler install was successful");
            }
        }
Beispiel #9
0
        public void Alter(TemplatePlan plan)
        {
            if (!RemoteOperations.Enabled)
            {
                plan.Logger.WriteSuccess("Remote operations are disabled.");
                return;
            }

            var rake = new ProcessStartInfo
            {
                UseShellExecute  = true,
                FileName         = "rake",
                CreateNoWindow   = true,
                WorkingDirectory = plan.Root
            };

            var process = Process.Start(rake);

            process.WaitForExit();

            if (process.ExitCode != 0)
            {
                plan.Logger.WriteWarning("rake script failed!");
            }
            else
            {
                plan.Logger.WriteSuccess("rake succeeded");
            }
        }
Beispiel #10
0
        public void Alter(TemplatePlan plan)
        {
            Solution solution = Solution.CreateNew(plan.SourceDirectory, this._solutionName);

            solution.Version = this.Version;
            plan.Solution    = solution;
        }
Beispiel #11
0
        public static object UpdateTemplate(int code, bool use, bool data)
        {
            var user = UserSession.Current.User;

            if (user != null)
            {
                var repo     = new TemplateRepository((int)Constants.TemplateAction.Plan, code, false);
                var template = repo.List.FirstOrDefault();
                if (template != null)
                {
                    template.IsUpdate = data;
                    return(use ? repo.UpdateTemplate(template) : repo.DeleteTemplate());
                }
                else
                {
                    var plan = PlanManager.GetPlan(code);
                    if (plan == null)
                    {
                        throw new Exception();
                    }

                    template = new TemplatePlan()
                    {
                        UserCode = user.Code,
                        AllPlan  = code.ToString(),
                        IsUpdate = data,
                        PlanCode = code
                    };
                    return(repo.InsertData(template) > Constants.DEFAULT_CODE);
                }
            }
            throw new NotImplementedException();
        }
Beispiel #12
0
 public void Alter(TemplatePlan plan)
 {
     FileSystemExtensions.CreateDirectory(new FileSystem(), new string[]
     {
         plan.Root,
         this._relativePath
     });
 }
Beispiel #13
0
 public static void ConfigurePlan(TextFile textFile, TemplatePlan plan)
 {
     GenericEnumerableExtensions.Each <string>(textFile.ReadLines(), delegate(string line)
     {
         string[] parts = FubuCore.StringExtensions.ToDelimitedArray(line);
         plan.Add(new GemReference(parts.First <string>(), parts.Last <string>()));
     });
 }
Beispiel #14
0
        public void Alter(TemplatePlan plan)
        {
            var expectedFile        = plan.Root.AppendPath(_relativePath);
            var contents            = plan.FileSystem.ReadStringFromFile(_source);
            var transformedContents = plan.ApplySubstitutions(contents);

            plan.FileSystem.WriteStringToFile(expectedFile, transformedContents);
        }
Beispiel #15
0
        public void Alter(TemplatePlan plan)
        {
            var solution = Solution.CreateNew(plan.SourceDirectory, _solutionName);

            solution.Version = Version;

            plan.Solution = solution;
        }
Beispiel #16
0
        public static void ExecutePlan(TemplatePlan plan)
        {
            plan.Execute();

            new RakeStep().Alter(plan);


            plan.WriteInstructions();
        }
        public void SetUp()
        {
            thePlan = TemplatePlan.CreateClean("gitignore");

            _contents = new Lazy <string[]>(() =>
            {
                return(fileSystem.ReadStringFromFile("gitignore", ".gitignore").SplitOnNewLine().ToArray());
            });
        }
Beispiel #18
0
        public void substitutes_the_solution_path()
        {
            var plan = new TemplatePlan("root");

            plan.Solution = Solution.CreateNew("root".AppendPath("src"), "MySolution");

            plan.ApplySubstitutions("*%SOLUTION_PATH%*")
            .ShouldEqual("*src/MySolution.sln*");
        }
Beispiel #19
0
        public void substitutes_the_solution_name()
        {
            var plan = new TemplatePlan("root");

            plan.Solution = Solution.CreateNew("root", "MySolution");

            plan.ApplySubstitutions("*%SOLUTION_NAME%*")
            .ShouldEqual("*MySolution*");
        }
Beispiel #20
0
        public static void ConfigurePlan(TextFile textFile, TemplatePlan plan)
        {
            string[] ignores = (from x in textFile.ReadLines()
                                where FubuCore.StringExtensions.IsNotEmpty(x)
                                select x).ToArray <string>();
            GitIgnoreStep step = new GitIgnoreStep(ignores);

            plan.Add(step);
        }
Beispiel #21
0
        private void findNugetsInOriginalRippleDeclarations(TemplatePlan plan, ProjectPlan testPlan)
        {
            var configFile = _originalProject.ParentDirectory().AppendPath("ripple.dependencies.config");

            plan.FileSystem.ReadTextFile(configFile, line => { if (line.IsNotEmpty())
                                                               {
                                                                   testPlan.NugetDeclarations.Fill(line);
                                                               }
                                         });
        }
Beispiel #22
0
 private static void initializeTheBottle(BottleInput input, TemplatePlan plan)
 {
     new InitCommand().Execute(
         new InitInput
     {
         Name = input.Name,
         Path = plan.Solution.FindProject(input.Name).Project.ProjectDirectory
     }
         );
 }
Beispiel #23
0
        public DataMother(string directory, bool withProject = true)
        {
            _directory = directory;

            _plan = TemplatePlan.CreateClean(_directory);
            if (withProject)
            {
                _plan.Add(new ProjectPlan("SomeProject"));
            }
        }
        public void creates_a_new_directory_if_it_does_not_already_exist()
        {
            var solutionDirectory = new SolutionDirectory("foo");

            var plan = TemplatePlan.CreateClean("solution");

            solutionDirectory.Alter(plan);

            Directory.Exists("solution".AppendPath("foo")).ShouldBeTrue();
        }
        public void Alter(TemplatePlan plan)
        {
            string expectedFile = FubuCore.StringExtensions.AppendPath(plan.Root, new string[]
            {
                this._relativePath
            });
            string contents            = plan.FileSystem.ReadStringFromFile(this._source);
            string transformedContents = plan.ApplySubstitutions(contents);

            plan.FileSystem.WriteStringToFile(expectedFile, transformedContents);
        }
        public void create_a_deep_directory()
        {
            var solutionDirectory = new SolutionDirectory("foo/bar");

            var plan = TemplatePlan.CreateClean("solution");

            solutionDirectory.Alter(plan);

            Directory.Exists("solution".AppendPath("foo")).ShouldBeTrue();
            Directory.Exists("solution".AppendPath("foo", "bar")).ShouldBeTrue();
        }
Beispiel #27
0
        private void executePlan(Action <TemplateRequest> configure = null)
        {
            if (configure != null)
            {
                configure(theRequest);
            }

            thePlan = new TemplatePlanBuilder(library).BuildPlan(theRequest);

            thePlan.Execute();
        }
        public void Alter(TemplatePlan plan)
        {
            CsProjFile  original     = plan.Solution.FindProject(this._originalProject).Project;
            ProjectPlan originalPlan = plan.FindProjectPlan(this._originalProject);
            ProjectPlan testPlan     = plan.CurrentProject;
            CsProjFile  testProject  = plan.Solution.FindProject(testPlan.ProjectName).Project;

            CopyProjectReferences.copyNugetDeclarations(originalPlan, testPlan, original, testProject);
            this.findNugetsInOriginalRippleDeclarations(plan, testPlan);
            CopyProjectReferences.buildProjectReference(original, testProject);
        }
Beispiel #29
0
        public void add_instructions_simple()
        {
            var plan = new TemplatePlan("root");

            plan.AddInstructions("some foo");

            plan.WriteInstructions();

            new FileSystem().ReadStringFromFile("root".AppendPath(TemplatePlan.InstructionsFile))
            .ShouldContain("some foo");
        }
        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*");
        }
Beispiel #31
0
        public void execute_blows_up_if_there_are_any_missing_inputs()
        {
            var plan = TemplatePlan.CreateClean("missing-inputs");

            plan.MissingInputs.Add("Foo");
            plan.MissingInputs.Add("Bar");

            Exception <MissingInputException> .ShouldBeThrownBy(() => {
                plan.Execute();
            }).InputNames.ShouldHaveTheSameElementsAs("Foo", "Bar");
        }
        protected override void beforeEach()
        {
            _plan  = new TemplatePlan();
            _input = new NewCommandInput {
                ProjectName = "Test"
            };

            MockFor <IFileSystem>()
            .Expect(f => f.DirectoryExists(Arg <string> .Is.NotNull))
            .Return(false);
        }