Beispiel #1
0
 private static void copyNugetDeclarations(ProjectPlan originalPlan, ProjectPlan testPlan, CsProjFile original,
                                           CsProjFile testProject)
 {
     originalPlan.NugetDeclarations.Each(x => testPlan.NugetDeclarations.Fill(x));
     original.All <AssemblyReference>()
     .Where(x => x.HintPath.IsEmpty())
     .Each(x => testProject.Add <AssemblyReference>(x.Include));
 }
        public Solution Create()
        {
            var solution = Solution.CreateNew(Environment.CurrentDirectory, "SolutionWithProjectReferences");

            var projectCore = new CsProjFile("project.core");
            var projectTest = new CsProjFile("project.core.tests");

            projectTest.Add <ProjectReference>(new ProjectReference());

            return(solution);
        }
        public void Alter(CsProjFile file, ProjectPlan plan)
        {
            var codeFile = file.Find<CodeFile>(AssemblyInfoPath) ?? file.Add<CodeFile>(AssemblyInfoPath);

            var path = file.PathTo(codeFile);
            var parentDirectory = path.ParentDirectory();
            if (!Directory.Exists(parentDirectory))
            {
                Directory.CreateDirectory(parentDirectory);
            }

            new FileSystem().AlterFlatFile(path, contents => Alter(contents, plan));
        }
 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));
        }
        public void Alter(CsProjFile file, ProjectPlan plan)
        {
            var fileSystem = new FileSystem();
            var rawText    = fileSystem.ReadStringFromFile(_source);

            var templatedText = plan.
                                ApplySubstitutions(rawText, _relativePath);

            var expectedPath = file.ProjectDirectory.AppendPath(_relativePath);

            fileSystem.WriteStringToFile(expectedPath, templatedText);

            file.Add(new Content(_relativePath));
        }
        public void Alter(CsProjFile file, ProjectPlan plan)
        {
            var fileSystem = new FileSystem();
            var rawText = fileSystem.ReadStringFromFile(_source);

            var templatedText = plan.
                ApplySubstitutions(rawText, _relativePath);

            var expectedPath = file.ProjectDirectory.AppendPath(_relativePath);

            fileSystem.WriteStringToFile(expectedPath, templatedText);

            file.Add(new Content(_relativePath));
        }
        public void Alter(CsProjFile file, ProjectPlan plan)
        {
            var includePath = plan.ApplySubstitutions(_relativePath);
            var filename = file.FileName.ParentDirectory().AppendPath(includePath);
            if (!filename.EndsWith(".cs"))
            {
                filename = filename + ".cs";
            }

            var text = plan.ApplySubstitutions(_rawText, _relativePath);

            new FileSystem().WriteStringToFile(filename, text);

            file.Add<CodeFile>(includePath);
        }
Beispiel #9
0
        public void Alter(CsProjFile file, ProjectPlan plan)
        {
            var assemblyInfoPath = Path.Combine(AssemblyInfoPath);
            var codeFile         = file.Find <CodeFile>(assemblyInfoPath) ?? file.Add <CodeFile>(assemblyInfoPath);

            var path            = file.PathTo(codeFile);
            var parentDirectory = path.ParentDirectory();

            if (!Directory.Exists(parentDirectory))
            {
                Directory.CreateDirectory(parentDirectory);
            }

            new FileSystem().AlterFlatFile(path, contents => Alter(contents, plan));
        }
Beispiel #10
0
        public void Alter(CsProjFile file, ProjectPlan plan)
        {
            var includePath = plan.ApplySubstitutions(_relativePath);
            var filename    = file.FileName.ParentDirectory().AppendPath(includePath);

            if (!filename.EndsWith(".cs"))
            {
                filename = filename + ".cs";
            }

            var text = plan.ApplySubstitutions(_rawText, _relativePath);

            new FileSystem().WriteStringToFile(filename, text);

            file.Add <CodeFile>(includePath);
        }
        private static void buildProjectReference(CsProjFile original, CsProjFile testProject)
        {
            string relativePathToTheOriginal = FubuCore.StringExtensions.PathRelativeTo(original.FileName, testProject.FileName);

            if (FubuCore.StringExtensions.ParentDirectory(FubuCore.StringExtensions.ParentDirectory(original.FileName)) == FubuCore.StringExtensions.ParentDirectory(FubuCore.StringExtensions.ParentDirectory(testProject.FileName)))
            {
                relativePathToTheOriginal = Path.Combine("..", Path.GetFileName(FubuCore.StringExtensions.ParentDirectory(original.FileName)), Path.GetFileName(original.FileName));
            }
            ProjectReference reference = new ProjectReference(relativePathToTheOriginal)
            {
                ProjectGuid = original.ProjectGuid,
                ProjectName = original.ProjectName
            };

            testProject.Add <ProjectReference>(reference);
        }
Beispiel #12
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);
            });
        }
Beispiel #13
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);
        }
Beispiel #14
0
        private static void buildProjectReference(CsProjFile original, CsProjFile testProject)
        {
            var relativePathToTheOriginal = original.FileName.PathRelativeTo(testProject.FileName);

            if (original.FileName.ParentDirectory().ParentDirectory() ==
                testProject.FileName.ParentDirectory().ParentDirectory())
            {
                relativePathToTheOriginal = Path.Combine("..", Path.GetFileName(original.FileName.ParentDirectory()),
                                                         Path.GetFileName(original.FileName));
            }


            var reference = new ProjectReference(relativePathToTheOriginal)
            {
                ProjectGuid = original.ProjectGuid,
                ProjectName = original.ProjectName
            };

            testProject.Add(reference);
        }
 public void Alter(CsProjFile file, ProjectPlan plan)
 {
     file.Add <AssemblyReference>(_assemblyName);
 }
 public void Alter(CsProjFile file, ProjectPlan plan)
 {
     file.Add<AssemblyReference>(_assemblyName);
 }