public override bool Execute(GitIgnoreInput input) { var fileSystem = new FileSystem(); var gitIgnoreFile = input.CurrentFolder().AppendPath(".gitignore"); if (input.Line.IsNotEmpty()) { ConsoleWriter.Write("Writing \"{0}\" to {1}", input.Line, gitIgnoreFile); fileSystem.AlterFlatFile(gitIgnoreFile, list => list.Fill(input.Line)); ConsoleWriter.Line(); ConsoleWriter.Line(); } ConsoleWriter.PrintHorizontalLine(); ConsoleWriter.Write(gitIgnoreFile); ConsoleWriter.PrintHorizontalLine(); var text = fileSystem.ReadStringFromFile(gitIgnoreFile); ConsoleWriter.Write(text); ConsoleWriter.PrintHorizontalLine(); return(true); }
protected override void execute(HistoryInput input, IRippleStepRunner runner) { var list = new List <string>(); var local = Solution.LocalDependencies(); local.All().Each(x => list.Add("{0}/{1}".ToFormat(x.Name, x.Version))); var historyFile = Solution.Directory.AppendPath(input.ArtifactsFlag, "dependency-history.txt"); Console.WriteLine("Writing nuget dependency history to " + historyFile); list.Each(x => Console.WriteLine(x)); var system = new FileSystem(); if (!system.DirectoryExists(Solution.Directory, input.ArtifactsFlag)) { system.CreateDirectory(Solution.Directory, input.ArtifactsFlag); } system.AlterFlatFile(historyFile, record => { record.Clear(); record.AddRange(list); }); }
private void flushContents() { _contents.Each((file, contents) => { var fileInPackage = _packageDirectory.AppendPath(file); _fileSystem.CreateDirectory(fileInPackage.ParentDirectory()); _fileSystem.AlterFlatFile(fileInPackage, list => list.AddRange(contents)); }); _contents.ClearAll(); }
private static IEnumerable <ProjectDependency> readRippleDependencies(string directory) { var fileSystem = new FileSystem(); var projectFiles = fileSystem.FindFiles(directory, FileSet.Deep("*.csproj")); return(projectFiles.SelectMany(file => { var projectName = Path.GetFileNameWithoutExtension(file); IList <string> names = null; fileSystem.AlterFlatFile(file.ParentDirectory().AppendPath(RippleDependenciesConfig), list => names = list.Where(x => x.IsNotEmpty()).ToList()); return names.Select(x => new ProjectDependency { Nuget = x, Project = projectName }); })); }
private static void writeFubuDocModuleAttributeIfNecessary(string directory, FileSystem fileSystem) { var assemblyInfoFile = directory.AppendPath("Properties").AppendPath("AssemblyInfo.cs"); if (File.Exists(assemblyInfoFile)) { fileSystem.AlterFlatFile(assemblyInfoFile, list => { var @using = "using {0};".ToFormat(typeof(FubuDocModuleAttribute).Namespace); if (!list.Contains(@using)) { list.Insert(0, @using); } if (!list.Any(x => x.Contains("FubuDocModule"))) { list.Add("[assembly: FubuDocModule(\"CHANGEME\")]"); } }); } }
public void WriteInstructions() { if (_instructions.ToString().IsEmpty()) { return; } var instructionText = GetInstructions(); var contents = instructionText.SplitOnNewLine(); FileSystem.AlterFlatFile(Root.AppendPath(InstructionsFile), list => list.AddRange(contents)); Console.WriteLine(); Console.WriteLine(); Console.ForegroundColor = ConsoleColor.Cyan; contents.Each(x => Console.WriteLine(x)); Console.ResetColor(); }
public void SetUp() { theFolder = "Jasmine/TestPackage1"; theFileSystem = new FileSystem(); var port = PortFinder.FindPort(5501); theInput = new JasmineInput { BrowserFlag = BrowserType.Firefox, SerenityFile = "jasmine-serenity.txt", Mode = JasmineMode.run, PortFlag = port }; theFileSystem.AlterFlatFile(theInput.SerenityFile, list => { list.Fill("include:" + theFolder); }); theFileSystem.CreateDirectory(theFolder, "bin"); }