Пример #1
0
 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));
 }
Пример #2
0
 public void Alter(CsProjFile file, ProjectPlan plan)
 {
     TemplateLibrary.FileSystem.CreateDirectory(FubuCore.StringExtensions.AppendPath(file.ProjectDirectory, new string[]
     {
         this._relativePath
     }));
 }
Пример #3
0
 private void writeNamespace(string relativePath, StringBuilder builder)
 {
     if (FubuCore.StringExtensions.IsNotEmpty(relativePath))
     {
         string @namespace = ProjectPlan.GetNamespace(relativePath, this.ProjectName);
         builder.Replace("%NAMESPACE%", @namespace);
     }
 }
Пример #4
0
        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);
        }
Пример #5
0
 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);
     });
 }
Пример #6
0
        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));
        }
Пример #7
0
        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);
                }
            });
        }
Пример #8
0
        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);
            });
        }
Пример #9
0
        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);
        }