Represents a file used or created in a build
        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");
        }
示例#2
0
 public void SetUp()
 {
     _fileSystemWrapper = MockRepository.GenerateStub<IFileSystemWrapper>();
     _source = @"c:\temp\test.txt";
     _file = new File(_source);
     _destination = @"c:\test.txt";
     _subject = new MoveFileArtifact(_fileSystemWrapper, _file);
 }
示例#3
0
        public void Setup()
        {
            _source = @"c:\temp\nonexistant.txt";
            _destination = @"c:\temp\nonexistant2.txt";

            _artifact = new File(_source);
            _fileSystemWrapper = MockRepository.GenerateStub<IFileSystemWrapper>();
            _copyEngine = new CopyFile(_fileSystemWrapper, _artifact);
        }
示例#4
0
        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 OutputFileTo_ShouldWorkWithBuildArtifact()
        {
            string    reference      = "external.dll";
            var       outputAssembly = new File("myapp.dll");
            string    source         = "myfile.cs";
            FileSet   sources        = new FileSet().Include(source);
            BuildTask build          = new BuildTask("", "library").OutputFileTo(outputAssembly).AddRefences(reference).AddSources(sources).IncludeDebugSymbols;

            build.BuildArgs();
            Assert.That(build._argumentBuilder.Build().Trim(), Is.EqualTo(String.Format("/out:\"{0}\" /target:{1} /reference:\"{2}\" /debug \"{3}\"", outputAssembly, "library", reference, source)));
        }
示例#7
0
        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);
        }
示例#8
0
        public void FileExamples()
        {
            var file = new File(@"c:\temp\web.config");
            file.Copy.To(@"c:\nottemp\");
            file.Copy.ContinueOnError.To(@"c:\nottemp\");
            file.Copy.ReplaceToken("ConnectionString").With("blah").To(@"c:\nottemp\web.config");

            file.Move.To(@"c:\nottemp\");
            file.Move.ContinueOnError.To(@"c:\nottemp");

            file.Rename.To("blah2.txt");
            file.Rename.ContinueOnError.To("blah2.txt");
        }
示例#9
0
        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 );
        }
示例#10
0
        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;
        }
示例#11
0
        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);
        }
示例#12
0
        public Publish()
        {
            AssemblyFluentBuildRelease_Partial = directory_compile.File("FluentBuild-partial.dll");
            AssemblyFluentBuildRelease_Merged = directory_compile.File("FluentBuild.dll");
            AssemblyFluentBuildRunnerRelease = directory_compile.File("fb.exe");

            _version = "1.2.0.0";
            _finalFileName = "FluentBuild-" + _version + ".zip";
            ZipFilePath = directory_release.File(_finalFileName);

            ClearTasks();

            AddTask(Clean);
            AddTask(CompileBuildUi);
            AddTask(CompileCoreWithOutTests);
            AddTask(CompileRunner);
            //AddTask(CompileBuildFileConverterWithoutTests);
            AddTask(Compress);
            //move to tools folder here?
            //AddTask(PublishToRepository);
            //AddTask(PublishToNuGetUsingFb);
        }
示例#13
0
        public Publish()
        {
            AssemblyFluentBuildRelease_Partial = directory_compile.File("FluentBuild-partial.dll");
            AssemblyFluentBuildRelease_Merged  = directory_compile.File("FluentBuild.dll");
            AssemblyFluentBuildRunnerRelease   = directory_compile.File("fb.exe");

            _version       = "1.2.0.0";
            _finalFileName = "FluentBuild-" + _version + ".zip";
            ZipFilePath    = directory_release.File(_finalFileName);

            ClearTasks();

            AddTask(Clean);
            AddTask(CompileBuildUi);
            AddTask(CompileCoreWithOutTests);
            AddTask(CompileRunner);
            //AddTask(CompileBuildFileConverterWithoutTests);
            AddTask(Compress);
            //move to tools folder here?
            //AddTask(PublishToRepository);
            //AddTask(PublishToNuGetUsingFb);
        }
示例#14
0
 public void OutputFileTo_ShouldWorkWithBuildArtifact()
 {
     string reference = "external.dll";
     var outputAssembly = new File("myapp.dll");
     string source = "myfile.cs";
     FileSet sources = new FileSet().Include(source);
     BuildTask build = new BuildTask("", "library").OutputFileTo(outputAssembly).AddRefences(reference).AddSources(sources).IncludeDebugSymbols;
     build.BuildArgs();
     Assert.That(build._argumentBuilder.Build().Trim(), Is.EqualTo(String.Format("/out:\"{0}\" /target:{1} /reference:\"{2}\" /debug \"{3}\"", outputAssembly, "library", reference, source)));
 }
示例#15
0
        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");
        }
示例#16
0
 public static Executable Executable(File executablePath)
 {
     return new Executable(executablePath.ToString());
 }