コード例 #1
0
 private void defaultSearch()
 {
     Search = new FileSet { DeepSearch = true };
     Search.AppendInclude("*{0}".ToFormat(Constants.DotSpark));
     Search.AppendInclude("*{0}".ToFormat(Constants.DotShade));
     Search.AppendInclude("bindings.xml");
 }
コード例 #2
0
 public PackageManifest()
 {
     DataFileSet = new FileSet();
     ContentFileSet = new FileSet(){
         Include = "*.as*x;*.master;Content{0}*.*".ToFormat(Path.DirectorySeparatorChar)
     };
 }
コード例 #3
0
ファイル: SolutionFiles.cs プロジェクト: modulexcite/ripple
        public void ForProjects(Solution solution, Action<string> action)
        {
            var projSet = new FileSet { Include = "*.csproj;*.vbproj;*.fsproj" };
            var targetDir = Path.Combine(solution.Directory, solution.SourceFolder);

            _fileSystem.FindFiles(targetDir, projSet).Each(action);
        }
コード例 #4
0
ファイル: SolutionFiles.cs プロジェクト: modulexcite/ripple
        public void ForNuspecs(Solution solution, Action<string> action)
        {
            var nuspecSet = new FileSet { Include = "*.nuspec" };
            var targetDir = Path.Combine(solution.Directory, solution.NugetSpecFolder);

            _fileSystem.FindFiles(targetDir, nuspecSet).Each(action);
        }
コード例 #5
0
        public virtual void Load()
        {
            var fileSet = new FileSet
            {
                DeepSearch = false,
                Include = "*.locale.config",
                Exclude = MissingLocaleConfigFile
            };

            var directories = GetDirectoriesToSearch();

            directories.SelectMany(dir => _fileSystem.FindFiles(dir, fileSet)).Where(file =>
            {
                var fileName = Path.GetFileName(file);
                return fileName != null && !fileName.StartsWith("missing.");
            }).GroupBy(CultureFor).Each(group =>
            {
                var items = group.SelectMany(LoadFrom);

                foreach (var item in items)
                {
                    var key = BuildKey(group.Key, item.Item1);

                    Translations[key] = item.Item2;
                }
            });
        }
コード例 #6
0
        // I'm okay with this finding nulls
        public IEnumerable<IFubuFile> FindFiles(FileSet fileSet)
        {
            fileSet.AppendExclude(FubuMvcPackageFacility.FubuContentFolder + "/*.*");
            fileSet.AppendExclude(FubuMvcPackageFacility.FubuPackagesFolder + "/*.*");

            return _folders.Value.SelectMany(folder => folder.FindFiles(fileSet))
                .Where(IsNotUnderExplodedBottleFolder);
        }
コード例 #7
0
 private void defaultSearch()
 {
     Search = new FileSet { DeepSearch = true };
     Search.AppendInclude("*cshtml");
     Search.AppendInclude("*vbhtml");     
     Search.AppendExclude("bin/*.*");
     Search.AppendExclude("obj/*.*");
 }
コード例 #8
0
 public void find_files()
 {
     var fileSpec = new FileSet(){
         DeepSearch = true,
         Include = "config/*.config"
     };
     theCache.FindFiles(fileSpec).Select(x => Path.GetFileNameWithoutExtension(x))
         .ShouldHaveTheSameElementsAs("a1", "a2", "b3", "b4", "c5", "c6", "c7");
 }
コード例 #9
0
        public static IEnumerable<string> FindAssemblyNames(this IFileSystem fileSystem, string directory)
        {
            var fileSet = new FileSet{
                DeepSearch = false,
                Include = "*.dll;*.exe"
            };

            return fileSystem.FindFiles(directory, fileSet).Select(Path.GetFileNameWithoutExtension);
        }
コード例 #10
0
        private IFubuFile findFile(string name)
        {
            var fileSet = new FileSet{
                DeepSearch = true,
                Include = name.ToLower()
            };

            return FindFiles(fileSet).FirstOrDefault();
        }
コード例 #11
0
        public IEnumerable<string> FindAssemblies(string applicationDirectory)
        {
            var assemblyNames = new FileSet { Include = "*.dll", DeepSearch = false };
            var fileSystem = new FileSystem();

            return FubuMvcPackageFacility
                .GetPackageDirectories()
                .SelectMany(dir => fileSystem.FindFiles(dir, assemblyNames));
        }
コード例 #12
0
ファイル: PackageManifest.cs プロジェクト: cprieto/fubumvc
        public PackageManifest()
        {
            Role = PackageRole.Module;

            DataFileSet = new FileSet();
            ContentFileSet = new FileSet(){
                Include = "*.as*x;*.master;Content{0}*.*;*.config".ToFormat(Path.DirectorySeparatorChar)
            };
        }
コード例 #13
0
ファイル: ContentFolder.cs プロジェクト: roend83/fubumvc
        public IEnumerable<IFubuFile> FindFiles(FileSet fileSet)
        {
            return _fileSystem.FindFiles(Path, fileSet).Select(file =>
            {
                var fubuFile = new FubuFile(file, Provenance);
                fubuFile.RelativePath = file.PathRelativeTo(Path).Replace("\\", "/");

                return fubuFile;
            });
        }
コード例 #14
0
        public bool Matches(IFileSystem fileSystem, string directory)
        {
            var rippleConfigs = new FileSet
            {
                Include = ConfigFile,
                DeepSearch = true
            };

            return fileSystem.FindFiles(directory, rippleConfigs).Any();
        }
コード例 #15
0
        public static string FindSolutionFile(IFileSystem fileSystem, string directory)
        {
            var slnSet = new FileSet
            {
                Include = "*.sln",
                DeepSearch = true
            };

            var files = fileSystem.FindFiles(directory, slnSet).ToArray();
            return files.Length != 1 ? null : files[0];
        }
コード例 #16
0
        private IFubuFile findFile(string name)
        {
            if (name.IsEmpty()) return null;

            var fileSet = new FileSet{
                DeepSearch = true,
                Include = name
            };

            return FindFiles(fileSet).FirstOrDefault();
        }
コード例 #17
0
ファイル: MoveContent.cs プロジェクト: mmoore99/fubumvc
        public void Execute(TemplatePlanContext context)
        {
            var fileSet = new FileSet
                                   {
                                       DeepSearch = false,
                                       Include = "*.*",
                                       Exclude = "*.exe;*.dll;.git;*{0};".ToFormat(FubuIgnoreFile)
                                   };
            var fubuIgnore = FileSystem.Combine(context.TempDir, FubuIgnoreFile);
            if(_fileSystem.FileExists(fubuIgnore))
            {
                _fileSystem
                    .ReadStringFromFile(fubuIgnore)
                    .SplitOnNewLine()
                    .Each(ignore =>
                              {
                                  fileSet.Exclude += "{0};".ToFormat(ignore);
                              });
            }

            var excludedFiles = fileSet.ExcludedFilesFor(context.TempDir);
            _fileSystem
                .FindFiles(context.TempDir, fileSet)
                .Where(file => !excludedFiles.Contains(file))
                .Each(from =>
                          {
                              var destination = Path.Combine(context.TargetPath, _fileSystem.GetFileName(from));
                              if (_fileSystem.FileExists(destination)) _fileSystem.DeleteFile(destination);
                              _fileSystem.MoveFile(from, destination);
                          });

            _fileSystem
                .ChildDirectoriesFor(context.TempDir)
                .Each(directory =>
                          {
                              var destinationName = _fileSystem.GetFileName(directory);
                              if(destinationName == ".git")
                              {
                                  return;
                              }

                              var destination = Path.Combine(context.TargetPath, destinationName);
                              if (_fileSystem.DirectoryExists(destination))
                              {
                                  _fileSystem.DeleteDirectory(destination);
                              }
                              _fileSystem.MoveDirectory(directory, destination);
                          });

            var info = new DirectoryInfo(context.TempDir);
            info.SafeDelete();
        }
コード例 #18
0
ファイル: FileScanner.cs プロジェクト: jemacom/fubumvc
        private void scan(string root, string directory, FileSet fileSet, Action<FileFound> onFound, IEnumerable<string> excludes)
        {
            if (alreadyScannedOrNonexistent(directory)) { return; }

            _scannedDirectories.Add(directory);

            _fileSystem.ChildDirectoriesFor(directory)
                .Each(dir => scan(root, dir, fileSet, onFound, excludes));

            var included = fileSet.IncludedFilesFor(directory).ToList();
            var excluded = included.Where(x => excludes.Any(x.Contains));

            var files = included.Except(excluded).ToList();

            files.Each(file => onFound(new FileFound(file, root, directory)));
        }
コード例 #19
0
        // I'm okay with this finding nulls

        public IEnumerable<IFubuFile> FindFiles(FileSet fileSet)
        {
            return _fileSystem.FindFiles(_root, fileSet).Select(file =>
            {
                var fubuFile = new FubuFile(file)
                {
                    RelativePath = file.PathRelativeTo(_root).Replace("\\", "/")
                };

                if (fubuFile.RelativePath.IsEmpty())
                {
                    throw new ArgumentException("Not able to determine a relative path for " + file);
                }

                return fubuFile;
            });
        }
コード例 #20
0
        private IEnumerable<OutlineFile> theWrittenFiles()
        {
            var directory = Context.Service<DocSettings>().Root;
            var top = new OutlineReader(_outlineFile).ReadFile();

            OutlineWriter.WriteToFiles(directory, top);

            var fileSet = new FileSet
            {
                Include = "*.md;order.txt"
            };

            return new FileSystem().FindFiles(directory, fileSet).Select(file =>
            {
                return new OutlineFile
                {
                    Path = file.PathRelativeTo(directory).Replace(Path.DirectorySeparatorChar, '/'),
                };
            });
        } 
コード例 #21
0
        public IEnumerable<IPackageInfo> Load(IPackageLog log)
        {
            var fileSystem = new FileSystem();
            var manifestFileSpec = new FileSet { Include = PackageManifest.FILE, DeepSearch = true };
            var manifestReader = new PackageManifestReader(_sourceRoot, fileSystem, folder => folder);

            //how can i 'where' the manifests

            var pis = fileSystem.FileNamesFor(manifestFileSpec, _sourceRoot)
                .Select(Path.GetDirectoryName)
                .Select(manifestReader.LoadFromFolder);

            var filtered = pis.Where(pi=>PackageRole.Module.Equals(pi.Role));

            ConsoleWriter.PrintHorizontalLine();
            ConsoleWriter.Write("Solution Package Loader found:");
            filtered.Each(p=>ConsoleWriter.Write("  {0}", p.Name));
            ConsoleWriter.PrintHorizontalLine();

            return filtered;
        }
コード例 #22
0
        private FileSet buildFileSet(XmlDocument document, Expression<Func<PackageManifest, object>> expression)
        {
            var node = document.DocumentElement.SelectSingleNode(expression.ToAccessor().Name) as XmlElement;

            var fileSet = new FileSet();

            if (node == null) return fileSet;

            if (node.HasAttribute("Include"))
            {
                fileSet.Include = node.GetAttribute("Include");
            }

            if (node.HasAttribute("Exclude"))
            {
                fileSet.Exclude = node.GetAttribute("Exclude");
            }

            var deepSearchNode = node.SelectSingleNode("DeepSearch");
            if (deepSearchNode != null) fileSet.DeepSearch = bool.Parse(deepSearchNode.InnerText);

            return fileSet;
        }
コード例 #23
0
ファイル: FileSet.cs プロジェクト: nieve/fubucore
 public bool Equals(FileSet other)
 {
     if (ReferenceEquals(null, other)) return false;
     if (ReferenceEquals(this, other)) return true;
     return Equals(other.Include, Include) && Equals(other.Exclude, Exclude) && other.DeepSearch.Equals(DeepSearch);
 }
コード例 #24
0
 public IEnumerable<string> FindAssemblies(string applicationDirectory)
 {
     var assemblyNames = new FileSet { Include = "*.dll", DeepSearch = false };
     var directory = FubuMvcPackages.GetApplicationPackagesDirectory(applicationDirectory);
     return _fileSystem.FindFiles(directory, assemblyNames).Select(Path.GetFileNameWithoutExtension);
 }
コード例 #25
0
 // Only here for mocking/stubbing file system junk
 public IEnumerable <string> FindFiles(string directory, FileSet searchSpecification)
 {
     return(searchSpecification.IncludedFilesFor(directory));
 }
コード例 #26
0
ファイル: ISolutionFiles.cs プロジェクト: bobpace/ripple
        public static SolutionFiles FromDirectory(string directory)
        {
            var rippleConfigs = new FileSet
            {
                Include = RippleDependencyStrategy.RippleDependenciesConfig,
                DeepSearch = true
            };

            var isClassicMode = false;
            var configFiles = new FileSystem().FindFiles(directory, rippleConfigs);

            if (!configFiles.Any())
            {
                isClassicMode = true;
                RippleLog.Info("Classic Mode Detected");
            }

            var files =  isClassicMode ? Classic() : Basic();
            files.resetDirectories(directory);

            return files;
        }
コード例 #27
0
ファイル: FileScanner.cs プロジェクト: jemacom/fubumvc
 public void Scan(ScanRequest request)
 {
     var fileSet = new FileSet { Include = request.Filters,  DeepSearch = false };
     _scannedDirectories = new List<string>();
     request.Roots.Each(root => scan(root, root, fileSet, request.OnFound, request.ExcludedDirectories));
 }
コード例 #28
0
ファイル: PackageExploder.cs プロジェクト: cprieto/fubumvc
        private IEnumerable<string> findPackageFileNames(string applicationDirectory, IPackageLog log)
        {
            var fileSet = new FileSet{
                Include = "*.zip"
            };

            var packageFolder = BottleFiles.GetApplicationPackagesDirectory(applicationDirectory);

            log.Trace("Searching for zip files in package directory " + packageFolder);

            return _fileSystem.FileNamesFor(fileSet, packageFolder);
        }
コード例 #29
0
 private IEnumerable<string> findPackageFileNames(string applicationDirectory)
 {
     var fileSet = new FileSet()
                   {
                       Include = "*.zip"
                   };
     return _fileSystem.FileNamesFor(fileSet, applicationDirectory, "bin", FubuMvcPackages.FubuPackagesFolder);
 }
コード例 #30
0
ファイル: NugetFolderCache.cs プロジェクト: ventaur/ripple
        private IEnumerable<INugetFile> findNugetFiles()
        {
            var nugetSpec = new FileSet {Include = "*.nupkg"};
            _fileSystem
                .FindFiles(_folder, nugetSpec)
                .Each(file =>
                {
                    try
                    {
                        if (new FileInfo(file).Length == 0)
                        {
                            _fileSystem.DeleteFile(file);
                        }

                        if (_validatePackages)
                        {
                            using (new ZipPackage(file).GetStream())
                            {
                            }
                        }
                    }
                    catch
                    {
                        _fileSystem.DeleteFile(file);
                    }
                });

            return _fileSystem
                .FindFiles(_folder, nugetSpec)
                .Select(file => new NugetFile(file, _solution.Mode))
                .ToList();
        }
コード例 #31
0
 public static IEnumerable <string> FileNamesFor(this IFileSystem fileSystem, FileSet set, params string[] pathParts)
 {
     return(fileSystem.FindFiles(FileSystem.Combine(pathParts), set));
 }
コード例 #32
0
ファイル: PackageExploder.cs プロジェクト: Jakobsson/fubumvc
        private IEnumerable<string> findPackageFileNames(string applicationDirectory)
        {
            var fileSet = new FileSet{
                Include = "*.zip"
            };

            var packageFolder = FubuMvcPackages.GetApplicationPackagesDirectory(applicationDirectory);

            return _fileSystem.FileNamesFor(fileSet, packageFolder);
        }