Include() 공개 메소드

public Include ( Directory path ) : FileSet
path Directory
리턴 FileSet
예제 #1
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");
        }
예제 #2
0
 public void IncludeWithFilter()
 {
     var fs = new FileSet();
     var readOnlyCollection = fs.Include(new Directory(rootFolder)).Filter("*.cs").Files;
     Assert.That(readOnlyCollection[0], Is.EqualTo(Path.Combine(rootFolder, "file1.cs")));
     Assert.That(readOnlyCollection[1], Is.EqualTo(Path.Combine(rootFolder, "file2.cs")));
     Assert.That(readOnlyCollection[2], Is.EqualTo(Path.Combine(rootFolder, "file3.cs")));
 }
예제 #3
0
        private void CompileBuildFileConverterWithoutTests()
        {
            var sourceFiles = new FileSet();
            sourceFiles.Include(directory_src_converter).RecurseAllSubDirectories.Filter("*.cs")
                .Exclude(directory_src_converter).RecurseAllSubDirectories.Filter("*Tests.cs");
            ;

            Task.Build.Csc.Target.Executable(x => x.AddSources(sourceFiles).OutputFileTo(assembly_BuildFileConverter_WithTests));
        }
예제 #4
0
        public void GenerateFrom_ShouldPopulateFiles()
        {
            var fileset = new FileSet();
            fileset.Include(new File("c:\temp\nonexistant.txt"));

            Resgen subject = new Resgen().GenerateFrom(fileset);

            Assert.That(subject.Files, Is.Not.Null);
            Assert.That(subject, Is.Not.Null);
        }
예제 #5
0
        public void ExecuteShouldRunExe()
        {
            var mock = MockRepository.GenerateStub<IActionExcecutor>();
            var fileset = new FileSet();
            fileset.Include(new File(@"c:\temp\nonexistant.txt"));

            Resgen subject = new Resgen(mock).GenerateFrom(fileset).OutputTo(@"c:\temp\");
            subject.Execute();
            mock.AssertWasCalled(x=>x.Execute(Arg<Func<Executable, object>>.Is.Anything));
        }
예제 #6
0
        public static string BuildAssemblyFromSources(string path, string baseDirectory)
        {
            if (!System.IO.Directory.Exists(path))
                throw new DirectoryNotFoundException("Could not find the directory to build of " + path);

            Defaults.Logger.WriteDebugMessage("Sources found in: " + path);
            var fileset = new FileSet();
            fileset = fileset.Include(new Directory(path)).RecurseAllSubDirectories.Filter("*.cs");

            string startPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase).Replace("file:\\", "");

            string fluentBuilddll = Path.Combine(startPath, "FluentBuild.dll");

            Defaults.Logger.WriteDebugMessage("Adding in reference to the FluentBuild DLL from: " + fluentBuilddll);

            string tempPath = Environment.GetEnvironmentVariable("TEMP") + "\\FluentBuild\\" + DateTime.Now.Ticks;
            //System.IO.Directory.Delete(Environment.GetEnvironmentVariable("TEMP") + "\\FluentBuild\\", true);
            System.IO.Directory.CreateDirectory(tempPath);
            string outputAssembly = Path.Combine(tempPath, "build.dll");

            Defaults.Logger.WriteDebugMessage("Output Assembly: " + outputAssembly);

            var references = new List<String>() { fluentBuilddll };

            /*
            var fluentFs = new FluentFs.Core.File(Path.Combine(startPath, "FluentFs.dll"));
            if (File.Exists(fluentFs.ToString()))
            {
                fluentFs.Copy.To(tempPath);
                references.Add(fluentFs.ToString());
            }
             */

            //add in third party references
            var projectParser = new ProjectParser(path, baseDirectory);
            if (projectParser.HasProjectFile())
            {
                var referencesFromProjectFile = projectParser.GetReferences();
                foreach (var referenceFromProjectFile in referencesFromProjectFile)
                {
                    Defaults.Logger.WriteDebugMessage("Adding in third party reference " + referenceFromProjectFile);
                }
                references.AddRange(referencesFromProjectFile);
            }

            Task.Build.Csc.Target.Library(x => x.AddSources(fileset).AddRefences(references.ToArray()).IncludeDebugSymbols.OutputFileTo(outputAssembly));
            return outputAssembly;
        }
예제 #7
0
        public FileSet Execute()
        {
            string resGenExecutable = GetPathToResGenExecutable();

            var outputFiles = new FileSet();
            foreach (string resourceFileName in Files.Files)
            {
                string outputFileName = Prefix + Path.GetFileNameWithoutExtension(resourceFileName) + ".resources";
                outputFileName = Path.Combine(OutputFolder, outputFileName);
                outputFiles.Include(outputFileName);
                var builder = new ArgumentBuilder();
                builder.StartOfEntireArgumentString = "\"" + resourceFileName + "\" \"" + outputFileName + "\"";
                _actionExcecutor.Execute<Executable>(x=>x.ExecutablePath(resGenExecutable).UseArgumentBuilder(builder));
            }
            return outputFiles;
        }
예제 #8
0
 public static FileSet as_file_set(this File[] files)
 {
     var result = new FileSet();
     foreach (var item in files)
     {
         result.Include(item);
     }
     return result;
 }
예제 #9
0
        private void CompileBuildFileConverter()
        {
            var sourceFiles = new FileSet();
            sourceFiles.Include(directory_src_converter).RecurseAllSubDirectories.Filter("*.cs");

            Task.Build.Csc.Target.Executable(x => x
                        .AddSources(sourceFiles)
                        .IncludeDebugSymbols
                        .AddRefences(thirdparty_rhino, thirdparty_nunit)
                        .OutputFileTo(assembly_BuildFileConverter_WithTests)
                        );
        }
예제 #10
0
        private void CompileCoreSources()
        {
            var sourceFiles = new FileSet();
            sourceFiles.Include(directory_src_core).RecurseAllSubDirectories.Filter("*.cs");

            Task.Build.Csc.Target.Library(x => x
                .AddSources(sourceFiles)
                .IncludeDebugSymbols
                .AddRefences(thirdparty_rhino, thirdparty_nunit, thirdparty_sharpzip, thirdparty_fluentFs)
                .OutputFileTo(assembly_FluentBuild_WithTests_Partial)
                );

            Task.Run.ILMerge(x => x.ExecutableLocatedAt(@"tools\ilmerge\ilmerge.exe")
              .AddSource(assembly_FluentBuild_WithTests_Partial)
              .AddSource(thirdparty_sharpzip)
              .AddSource(thirdparty_fluentFs)
              .OutputTo(assembly_FluentBuild_WithTests_Merged));

            assembly_FluentBuild_WithTests_Partial.Delete();
        }
예제 #11
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");
        }