private void defaultSearch() { Search = new FileSet { DeepSearch = true }; Search.AppendInclude("*{0}".ToFormat(Constants.DotSpark)); Search.AppendInclude("*{0}".ToFormat(Constants.DotShade)); Search.AppendInclude("bindings.xml"); }
public PackageManifest() { DataFileSet = new FileSet(); ContentFileSet = new FileSet(){ Include = "*.as*x;*.master;Content{0}*.*".ToFormat(Path.DirectorySeparatorChar) }; }
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); }
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); }
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; } }); }
// 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); }
private void defaultSearch() { Search = new FileSet { DeepSearch = true }; Search.AppendInclude("*cshtml"); Search.AppendInclude("*vbhtml"); Search.AppendExclude("bin/*.*"); Search.AppendExclude("obj/*.*"); }
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"); }
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); }
private IFubuFile findFile(string name) { var fileSet = new FileSet{ DeepSearch = true, Include = name.ToLower() }; return FindFiles(fileSet).FirstOrDefault(); }
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)); }
public PackageManifest() { Role = PackageRole.Module; DataFileSet = new FileSet(); ContentFileSet = new FileSet(){ Include = "*.as*x;*.master;Content{0}*.*;*.config".ToFormat(Path.DirectorySeparatorChar) }; }
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; }); }
public bool Matches(IFileSystem fileSystem, string directory) { var rippleConfigs = new FileSet { Include = ConfigFile, DeepSearch = true }; return fileSystem.FindFiles(directory, rippleConfigs).Any(); }
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]; }
private IFubuFile findFile(string name) { if (name.IsEmpty()) return null; var fileSet = new FileSet{ DeepSearch = true, Include = name }; return FindFiles(fileSet).FirstOrDefault(); }
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(); }
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))); }
// 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; }); }
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, '/'), }; }); }
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; }
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; }
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); }
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); }
// Only here for mocking/stubbing file system junk public IEnumerable <string> FindFiles(string directory, FileSet searchSpecification) { return(searchSpecification.IncludedFilesFor(directory)); }
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; }
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)); }
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); }
private IEnumerable<string> findPackageFileNames(string applicationDirectory) { var fileSet = new FileSet() { Include = "*.zip" }; return _fileSystem.FileNamesFor(fileSet, applicationDirectory, "bin", FubuMvcPackages.FubuPackagesFolder); }
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(); }
public static IEnumerable <string> FileNamesFor(this IFileSystem fileSystem, FileSet set, params string[] pathParts) { return(fileSystem.FindFiles(FileSystem.Combine(pathParts), set)); }
private IEnumerable<string> findPackageFileNames(string applicationDirectory) { var fileSet = new FileSet{ Include = "*.zip" }; var packageFolder = FubuMvcPackages.GetApplicationPackagesDirectory(applicationDirectory); return _fileSystem.FileNamesFor(fileSet, packageFolder); }