Skip to content
This repository has been archived by the owner on Oct 5, 2023. It is now read-only.

Commit

Permalink
Add ability for file exclusions to be RexExp based
Browse files Browse the repository at this point in the history
  • Loading branch information
HowardvanRooijen committed Jan 9, 2011
1 parent 912e6d6 commit 21bca99
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
Expand Up @@ -31,18 +31,14 @@ private bool ShouldExclude(string path)
{ {
string[] segments = path.Split(new[] { Path.DirectorySeparatorChar }, StringSplitOptions.RemoveEmptyEntries); string[] segments = path.Split(new[] { Path.DirectorySeparatorChar }, StringSplitOptions.RemoveEmptyEntries);


bool shouldExclude = false; bool shouldExclude = segments.Any(directory => this.DirectoryExclusions.Any(exclusion => Regex.IsMatch(directory, exclusion)));

foreach (string directory in segments.Where(directory => this.DirectoryExclusions.Any(exclusion => Regex.IsMatch(directory, exclusion))))
{
shouldExclude = true;
}


if (!shouldExclude) if (!shouldExclude)
{ {
string file = segments[segments.Length - 1]; string file = segments[segments.Length - 1];
string fileExtension = new FileInfo(file).Extension.ToLowerInvariant();


shouldExclude = this.FileExclusions.Contains(new FileInfo(file).Extension.ToLowerInvariant()); shouldExclude = this.FileExclusions.Any(exclusion => Regex.IsMatch(fileExtension, exclusion));
} }


return shouldExclude; return shouldExclude;
Expand Down
Expand Up @@ -35,7 +35,7 @@ public abstract class specification_for_file_exclusion_specification : Specifica


Establish context = () => Establish context = () =>
{ {
subject.FileExclusions = new List<string> {".cache",".mst",".msm",".gitignore",".idx",".pack",".user",".resharper",".suo"}; subject.FileExclusions = new List<string> {".cache",".mst",".msm",".gitignore",".idx",".pack",".user",".resharper",".suo", ".zz*"};
subject.DirectoryExclusions = new List<string> { "bin", "obj", "debug", "release", ".git", "_ReSharper.*" }; subject.DirectoryExclusions = new List<string> { "bin", "obj", "debug", "release", ".git", "_ReSharper.*" };
file_list = new List<string> file_list = new List<string>
Expand All @@ -53,6 +53,7 @@ public abstract class specification_for_file_exclusion_specification : Specifica
@"C:\__NAME__\hooks\applypatch-msg.user", @"C:\__NAME__\hooks\applypatch-msg.user",
@"C:\__NAME__\hooks\applypatch-msg.resharper", @"C:\__NAME__\hooks\applypatch-msg.resharper",
@"C:\__NAME__\hooks\applypatch-msg.suo", @"C:\__NAME__\hooks\applypatch-msg.suo",
@"C:\__NAME__\hooks\applypatch-msg.zza",
@"C:\__NAME__\_ReSharper.__NAME__\ModuleIds.xml", @"C:\__NAME__\_ReSharper.__NAME__\ModuleIds.xml",
@"C:\__NAME__\_ReSharper.__NAME__\SymbolCache.bin", @"C:\__NAME__\_ReSharper.__NAME__\SymbolCache.bin",
@"C:\__NAME__\_ReSharper.__NAME__\BuildScriptCache\.crc", @"C:\__NAME__\_ReSharper.__NAME__\BuildScriptCache\.crc",
Expand Down

0 comments on commit 21bca99

Please sign in to comment.