public void Alter(List <string> contents, ProjectPlan plan) { GenericEnumerableExtensions.Each <string>(from x in this._additions select plan.ApplySubstitutionsRaw(x, null) into x where !contents.Contains(x) select x, new Action <string>(contents.Add)); }
public void Alter(CsProjFile file, ProjectPlan plan) { TemplateLibrary.FileSystem.CreateDirectory(FubuCore.StringExtensions.AppendPath(file.ProjectDirectory, new string[] { this._relativePath })); }
private void writeNamespace(string relativePath, StringBuilder builder) { if (FubuCore.StringExtensions.IsNotEmpty(relativePath)) { string @namespace = ProjectPlan.GetNamespace(relativePath, this.ProjectName); builder.Replace("%NAMESPACE%", @namespace); } }
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); }
private static void copyNugetDeclarations(ProjectPlan originalPlan, ProjectPlan testPlan, CsProjFile original, CsProjFile testProject) { GenericEnumerableExtensions.Each <string>(originalPlan.NugetDeclarations, delegate(string x) { GenericEnumerableExtensions.Fill <string>(testPlan.NugetDeclarations, x); }); GenericEnumerableExtensions.Each <AssemblyReference>(from x in original.All <AssemblyReference>() where FubuCore.StringExtensions.IsEmpty(x.HintPath) select x, delegate(AssemblyReference x) { testProject.Add <AssemblyReference>(x.Include); }); }
public void Alter(CsProjFile file, ProjectPlan plan) { FileSystem fileSystem = new FileSystem(); string rawText = fileSystem.ReadStringFromFile(this._source); string templatedText = plan.ApplySubstitutionsRaw(rawText, this._relativePath); string expectedPath = FubuCore.StringExtensions.AppendPath(file.ProjectDirectory, new string[] { this._relativePath }); fileSystem.WriteStringToFile(expectedPath, templatedText); file.Add <Content>(new Content(this._relativePath)); }
private void findNugetsInOriginalRippleDeclarations(TemplatePlan plan, ProjectPlan testPlan) { string configFile = FubuCore.StringExtensions.AppendPath(FubuCore.StringExtensions.ParentDirectory(this._originalProject), new string[] { "ripple.dependencies.config" }); plan.FileSystem.ReadTextFile(configFile, delegate(string line) { if (FubuCore.StringExtensions.IsNotEmpty(line)) { GenericEnumerableExtensions.Fill <string>(testPlan.NugetDeclarations, line); } }); }
public void Alter(CsProjFile file, ProjectPlan plan) { string assemblyInfoPath = Path.Combine(this.AssemblyInfoPath); CodeFile codeFile = file.Find <CodeFile>(assemblyInfoPath) ?? file.Add <CodeFile>(assemblyInfoPath); string path = file.PathTo(codeFile); string parentDirectory = FubuCore.StringExtensions.ParentDirectory(path); if (!Directory.Exists(parentDirectory)) { Directory.CreateDirectory(parentDirectory); } new FileSystem().AlterFlatFile(path, delegate(List <string> contents) { this.Alter(contents, plan); }); }
public void Alter(CsProjFile file, ProjectPlan plan) { string includePath = plan.ApplySubstitutionsRaw(this._relativePath, null); string filename = FubuCore.StringExtensions.AppendPath(FubuCore.StringExtensions.ParentDirectory(file.FileName), new string[] { includePath }); if (!filename.EndsWith(".cs")) { filename += ".cs"; } string text = plan.ApplySubstitutionsRaw(this._rawText, this._relativePath); new FileSystem().WriteStringToFile(filename, text); file.Add <CodeFile>(includePath); }