public FluentFileSample() { var file = new FluentFs.Core.File(@"c:\temp\test.txt"); file.Copy.To(@"c:\temp\test2.txt"); file.Move.To(@"c:\NewDirectory"); file.Move.ContinueOnError.To(@"c:\DirectoryThatMayNotExist"); file.Rename.To("test41.txt"); file.Delete(OnError.Continue); var directory = new FluentFs.Core.Directory(@"c:\temp\sample"); directory.Delete(OnError.Continue).Create(OnError.Fail); directory.Files(); //returns all files in the folder directory.Files("*.txt"); //returns all files ending in .txt var childFolder = directory.SubFolder("childFolder"); //creates a new Directory object with a path of c:\temp\sample\childFolder directory.ToString(); //returns the path of the folder directory.File("test.txt"); // returns back a FluentFilesystem.File object with a path of c:\temp\sample\test.txt var fileset = new FluentFs.Core.FileSet(); fileset.Include(@"c:\Project\GUI\*.cs").RecurseAllSubDirectories .Exclude("assemblyInfo.cs") .Include(@"c:\Project\globalconfig.xml"); ReadOnlyCollection <string> files = fileset.Files; fileset.Copy.To(@"c:\temp"); }
public void OutputDirectory_ShouldSetDir() { string path = "c:\\temp"; var folder = new Directory(path); _subject.OutputDirectory(folder); Assert.That(_subject.Outdir, Is.EqualTo(path)); }
public void InitialSetup() { FluentFs.Core.Directory sourceFolder = new FluentFs.Core.Directory(Settings.PathToSamplesFolder).SubFolder("run").SubFolder("StdOutStdError"); FileSet fs = new FileSet().Include(sourceFolder).Filter("*.cs"); _outputFileLocation = rootFolder + "\\stdoutstderror.exe"; Task.Build.Csc.Target.Executable(x => x.AddSources(fs).OutputFileTo(_outputFileLocation)); }
public Default() { directory_base = new Directory(System.IO.Directory.GetCurrentDirectory()); directory_compile = directory_base.SubFolder("compile"); AssemblyFluentFsRelease = directory_compile.File("FluentFs.dll"); AddTask(Clean); AddTask(CompileCoreWithoutTests); }
public MultiTargetingSample() { _baseDirectory = new Directory(Properties.CurrentDirectory); _compileDirectory = _baseDirectory.SubFolder("compile"); _outputAssembly = _compileDirectory.File("output.dll"); AddTask(Clean); AddTask("Compile .NET 2.0", Compile_20); AddTask(Clean); AddTask("Compile .NET 3.0", Compile_30); }
public void DirectoryExamples() { var dir = new Directory(@"c:\temp"); dir.Create(OnError.Continue); dir.Delete(OnError.Continue); var stuffDir = dir.SubFolder("stuff"); var allFiles = dir.Files(); var dllFiles = dir.Files("*.dll"); var file = dir.File("web.config"); }
public DebugBuild() { _baseDirectory = new Directory(Properties.CurrentDirectory); _compileDirectory = _baseDirectory.SubFolder("compile"); _toolsDirectory = _baseDirectory.SubFolder("tools"); _outputAssembly = _compileDirectory.File("output.dll"); _creditCardProcessor = _toolsDirectory.File("CreditCardDevelopment.dll"); AddTask(Clean); AddTask(Compile); }
public static FileSet GetProjectReferences(File projectFile, Directory libFolder) { var references = XDocUtil.LoadIgnoreingNamespace( projectFile.ToString() ) .XPathSelectElements( "//HintPath" ) .Select( h => System.IO.Path.GetFileNameWithoutExtension( h.Value ) ) .ToList(); return references.Aggregate( new FileSet(), ( set, assembly ) => { Folders.Lib.Files( "*{0}*".With( assembly ) ) .Files.ToList() .ForEach( f => set.Include( f ) ); return set; }, set => set ); }
public DefaultSample() { directory_base = new Directory(Properties.CurrentDirectory); directory_compile = directory_base.SubFolder("compile"); directory_release = directory_base.SubFolder("release"); directory_tools = directory_base.SubFolder("tools"); assembly_FluentBuild = directory_compile.File("FluentBuild.dll"); assembly_FluentBuild_Tests = directory_compile.File("FluentBuild.Tests.dll"); thirdparty_nunit = directory_tools.File("nunit.framework.dll"); thirdparty_rhino = directory_tools.File("rhino.mocks.dll"); AddTask(Clean); AddTask(CompileSources); AddTask(CompileTests); AddTask(RunTests); AddTask(Package); //set the verbosity. Can also be set via command line Defaults.Logger.Verbosity = VerbosityLevel.TaskNamesOnly; }
public Default() { directory_base = new Directory(System.IO.Directory.GetCurrentDirectory()); directory_compile = directory_base.SubFolder("compile"); directory_release = directory_base.SubFolder("release"); directory_tools = directory_base.SubFolder("tools"); directory_src_core = directory_base.SubFolder("src").SubFolder("FluentBuild"); directory_src_runner = directory_base.SubFolder("src").SubFolder("FluentBuild.BuildExe"); directory_src_converter = directory_base.SubFolder("src").SubFolder("FluentBuild.BuildFileConverter"); file_src_UI = directory_base.SubFolder("src").SubFolder("FluentBuild.BuildUI").File("FluentBuild.BuildUI.csproj"); assembly_BuildFileConverter_WithTests = directory_compile.File("BuildFileConverter.exe"); assembly_FluentBuild_UI = directory_compile.File("fb.ui.exe"); assembly_FluentBuild_WithTests_Partial = directory_compile.File("FluentBuildWithTests_partial.dll"); assembly_FluentBuild_WithTests_Merged = directory_compile.File("FluentBuild.dll"); assembly_Functional_Tests = directory_compile.File("FluentBuild_Functional_Tests.dll"); assembly_FluentBuild_Runner = directory_compile.File("fb.exe"); thirdparty_nunit = directory_tools.SubFolder("nunit").File("nunit.framework.dll"); thirdparty_rhino = directory_tools.SubFolder("rhino").File("rhino.mocks.dll"); thirdparty_sharpzip = directory_base.SubFolder("lib").SubFolder("SharpZipLib-net2.0").File("ICSharpCode.SharpZipLib.dll"); thirdparty_fluentFs = directory_base.SubFolder("lib").SubFolder("FluentFs").File("FluentFs.dll"); _version = "0.0.0.0"; Defaults.FrameworkVersion = FrameworkVersion.NET4_0.Full; AddTask(Clean); AddTask(GenerateAssemblyInfoFiles); AddTask(CopyDependantAssembliesToCompileDir); AddTask(CompileCoreSources); AddTask(CompileRunnerSources); AddTask(RunTests); AddTask(CompileFunctionalTests); //AddTask(RunFunctionalTests); AddTask(CompileBuildFileConverter); AddTask(TestBuildFileConverter); AddTask(CompileBuildUi); }
private void PublishToNuGetUsingFb() { //create a lib\net40\ folder Directory nuGetBaseFolder = directory_compile.SubFolder("nuget"); Directory nuGetFolder = nuGetBaseFolder.Create().SubFolder("lib").Create().SubFolder("net40").Create(); //copy the assemblies to it AssemblyFluentBuildRunnerRelease.Copy.To(nuGetFolder); //assembly_FluentBuild_UI.Copy.To(nuGetFolder); AssemblyFluentBuildRelease_Merged.Copy.To(nuGetFolder); Task.Publish.ToNuGet(x => x.DeployFolder(nuGetBaseFolder) .ProjectId("FluentBuild") .Version(_version) .Description("A build tool that allows you to write build scripts in a .NET language") .Authors("GotWoods") .ApiKey(Properties.CommandLineProperties.GetProperty("NuGetApiKey")) .Owners("GotWoods") .ProjectUrl("http://code.google.com/p/fluent-build") .Tags("build") ); }
///<summary> /// Sets the output directory for the msbuild task ///</summary> /// <remarks>Sets the OutDir property (i.e. /p:OutDir)</remarks> ///<param name="path">the output folder</param> ///<returns></returns> public MsBuildTask OutputDirectory(FluentFs.Core.Directory path) { OutputDirectory(path.ToString()); return(this); }
public void BuildFolderCopyShouldMoveToNewFolder() { var buildFolder = new Directory(@"c:\sample"); _copyEngine.To(buildFolder); _fileSystemWrapper.AssertWasCalled(x => x.Copy(_source, buildFolder.ToString() + "\\nonexistant.txt")); }
public CompilationTaskSamples() { //Task.Build.Csc.Target.Executable(); //a command line exe //Task.Build.Csc.Target.Library(); //a dll //Task.Build.Csc.Target.Module(); //a module //Task.Build.Csc.Target.WindowsExecutable(); //a windows EXE var baseDir = new FluentFs.Core.Directory(Environment.CurrentDirectory); var compileDir = baseDir.SubFolder("compile"); compileDir.Delete(OnError.Continue).Create(); var sampleOutput = compileDir.File("sample.dll"); var sourceFiles = new FileSet().Include(@"c:\Sample\*.cs").RecurseAllSubDirectories; Task.Build.Csc.Target.Library(compiler => compiler.AddSources(sourceFiles) .OutputFileTo(sampleOutput)); Task.Build.MsBuild(compiler => compiler.ProjectOrSolutionFilePath(@"c:\Sample\MyProject.csproj").OutputDirectory(compileDir)); var outputAssemblyInfoFile = compileDir.File("assemblyInfo.cs"); Task.CreateAssemblyInfo.Language.CSharp(build => build.OutputPath(outputAssemblyInfoFile) .ClsCompliant(true) .ComVisible(true) .Company("My Company") .Copyright("Copyright " + DateTime.Now.Year) .Culture("EN-US") .DelaySign(false) .Description("Sample Project") .FileVersion("1.2.0.0") .InformationalVersion("1.2.0.0") .KeyFile(@"c:\mykey.snk") .KeyName("KeyName") .Product("Product Name") .Title("Title") .Trademark("TM") .Version("1.2.0.0") .AddCustomAttribute("namespace.for.attribute", "AttributeName", true, "attributeValue")); var returnCode = Task.Run.Executable(exe => exe.ExecutablePath(@"c:\temp\myapp.exe").InWorkingDirectory(@"c:\temp\").AddArgument("c", "action1").AddArgument("s")); Task.Run.Executable(exe => exe.ExecutablePath(@"c:\temp\myapp.exe").ContinueOnError.SetTimeout(200)); Task.Run.Zip.Compress(x => x.SourceFile("temp.txt") .UsingCompressionLevel.Eight .UsingPassword("secretPassword") .To("output.zip")); Task.Run.Zip.Decompress(x => x.Path("output.zip") .To(@"c:\temp\") .UsingPassword("secretPassword")); Defaults.Logger.WriteDebugMessage("Debug message"); Defaults.Logger.WriteWarning("MyTask", "Warning"); Defaults.Logger.WriteError("MyTask", "Error"); Defaults.Logger.Verbosity = VerbosityLevel.None; Defaults.Logger.Verbosity = VerbosityLevel.Full; Defaults.Logger.Verbosity = VerbosityLevel.TaskDetails; Defaults.Logger.Verbosity = VerbosityLevel.TaskNamesOnly; Task.Run.Executable(exe => exe.ExecutablePath(@"c:\temp.exe")); using (Defaults.Logger.ShowDebugMessages) { Task.Run.Executable(exe => exe.ExecutablePath(@"c:\TempProcess.exe")); } Task.Run.Debugger(); Properties.CommandLineProperties.GetProperty("ServerUsername"); Task.Publish.Ftp(ftp => ftp.Server("ftp.myserver.com") .UserName("username") .Password("password") .LocalFilePath(@"c:\temp\project.zip") .RemoteFilePath(@"\release\project.zip") ); Task.Publish.ToGoogleCode(google => google.UserName("user") .Password("pass") .LocalFileName(@"c:\temp\project.zip") .TargetFileName("project-1.0.0.0.zip") .ProjectName("projectName") .Summary("Summary for upload") ); }
public IExecutable InWorkingDirectory(FluentFs.Core.Directory directory) { WorkingDirectory = directory.ToString(); return(this); }
public FluentFileSample() { var file = new FluentFs.Core.File(@"c:\temp\test.txt"); file.Copy.To(@"c:\temp\test2.txt"); file.Move.To(@"c:\NewDirectory"); file.Move.ContinueOnError.To(@"c:\DirectoryThatMayNotExist"); file.Rename.To("test41.txt"); file.Delete(OnError.Continue); var directory = new FluentFs.Core.Directory(@"c:\temp\sample"); directory.Delete(OnError.Continue).Create(OnError.Fail); directory.Files(); //returns all files in the folder directory.Files("*.txt"); //returns all files ending in .txt var childFolder = directory.SubFolder("childFolder"); //creates a new Directory object with a path of c:\temp\sample\childFolder directory.ToString(); //returns the path of the folder directory.File("test.txt"); // returns back a FluentFilesystem.File object with a path of c:\temp\sample\test.txt var fileset = new FluentFs.Core.FileSet(); fileset.Include(@"c:\Project\GUI\*.cs").RecurseAllSubDirectories .Exclude("assemblyInfo.cs") .Include(@"c:\Project\globalconfig.xml"); ReadOnlyCollection<string> files = fileset.Files; fileset.Copy.To(@"c:\temp"); }
public CompilationTaskSamples() { //Task.Build.Csc.Target.Executable(); //a command line exe //Task.Build.Csc.Target.Library(); //a dll //Task.Build.Csc.Target.Module(); //a module //Task.Build.Csc.Target.WindowsExecutable(); //a windows EXE var baseDir = new FluentFs.Core.Directory(Environment.CurrentDirectory); var compileDir = baseDir.SubFolder("compile"); compileDir.Delete(OnError.Continue).Create(); var sampleOutput = compileDir.File("sample.dll"); var sourceFiles = new FileSet().Include(@"c:\Sample\*.cs").RecurseAllSubDirectories; Task.Build.Csc.Target.Library(compiler => compiler.AddSources(sourceFiles) .OutputFileTo(sampleOutput)); Task.Build.MsBuild(compiler => compiler.ProjectOrSolutionFilePath(@"c:\Sample\MyProject.csproj").OutputDirectory(compileDir)); var outputAssemblyInfoFile = compileDir.File("assemblyInfo.cs"); Task.CreateAssemblyInfo.Language.CSharp(build=>build.OutputPath(outputAssemblyInfoFile) .ClsCompliant(true) .ComVisible(true) .Company("My Company") .Copyright("Copyright " + DateTime.Now.Year) .Culture("EN-US") .DelaySign(false) .Description("Sample Project") .FileVersion("1.2.0.0") .InformationalVersion("1.2.0.0") .KeyFile(@"c:\mykey.snk") .KeyName("KeyName") .Product("Product Name") .Title("Title") .Trademark("TM") .Version("1.2.0.0") .AddCustomAttribute("namespace.for.attribute", "AttributeName", true, "attributeValue")); var returnCode = Task.Run.Executable(exe => exe.ExecutablePath(@"c:\temp\myapp.exe").InWorkingDirectory(@"c:\temp\").AddArgument("c", "action1").AddArgument("s")); Task.Run.Executable(exe => exe.ExecutablePath(@"c:\temp\myapp.exe").ContinueOnError.SetTimeout(200)); Task.Run.Zip.Compress(x=>x.SourceFile("temp.txt") .UsingCompressionLevel.Eight .UsingPassword("secretPassword") .To("output.zip")); Task.Run.Zip.Decompress(x=>x.Path("output.zip") .To(@"c:\temp\") .UsingPassword("secretPassword")); Defaults.Logger.WriteDebugMessage("Debug message"); Defaults.Logger.WriteWarning("MyTask", "Warning"); Defaults.Logger.WriteError("MyTask", "Error"); Defaults.Logger.Verbosity = VerbosityLevel.None; Defaults.Logger.Verbosity = VerbosityLevel.Full; Defaults.Logger.Verbosity = VerbosityLevel.TaskDetails; Defaults.Logger.Verbosity = VerbosityLevel.TaskNamesOnly; Task.Run.Executable(exe => exe.ExecutablePath(@"c:\temp.exe")); using(Defaults.Logger.ShowDebugMessages) { Task.Run.Executable(exe => exe.ExecutablePath(@"c:\TempProcess.exe")); } Task.Run.Debugger(); Properties.CommandLineProperties.GetProperty("ServerUsername"); Task.Publish.Ftp(ftp => ftp.Server("ftp.myserver.com") .UserName("username") .Password("password") .LocalFilePath(@"c:\temp\project.zip") .RemoteFilePath(@"\release\project.zip") ); Task.Publish.ToGoogleCode(google => google.UserName("user") .Password("pass") .LocalFileName(@"c:\temp\project.zip") .TargetFileName("project-1.0.0.0.zip") .ProjectName("projectName") .Summary("Summary for upload") ); }