Browse files

Add ability for file exclusions to be RexExp based

  • Loading branch information...
1 parent 912e6d6 commit 21bca9959d2a8e20b5829e873acbffd36d695aeb @HowardvanRooijen HowardvanRooijen committed Jan 9, 2011
View
10 ...tions/Endjin.Templify.Domain/Domain/Packager/Specifications/FileExclusionSpecification.cs
@@ -31,18 +31,14 @@ private bool ShouldExclude(string path)
{
string[] segments = path.Split(new[] { Path.DirectorySeparatorChar }, StringSplitOptions.RemoveEmptyEntries);
- bool shouldExclude = false;
-
- foreach (string directory in segments.Where(directory => this.DirectoryExclusions.Any(exclusion => Regex.IsMatch(directory, exclusion))))
- {
- shouldExclude = true;
- }
+ bool shouldExclude = segments.Any(directory => this.DirectoryExclusions.Any(exclusion => Regex.IsMatch(directory, exclusion)));
if (!shouldExclude)
{
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;
View
3 ...Templify.Specifications/Domain/Packager/Specifications/FileExclusionSpecificationSpecs.cs
@@ -35,7 +35,7 @@ public abstract class specification_for_file_exclusion_specification : Specifica
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.*" };
file_list = new List<string>
@@ -53,6 +53,7 @@ public abstract class specification_for_file_exclusion_specification : Specifica
@"C:\__NAME__\hooks\applypatch-msg.user",
@"C:\__NAME__\hooks\applypatch-msg.resharper",
@"C:\__NAME__\hooks\applypatch-msg.suo",
+ @"C:\__NAME__\hooks\applypatch-msg.zza",
@"C:\__NAME__\_ReSharper.__NAME__\ModuleIds.xml",
@"C:\__NAME__\_ReSharper.__NAME__\SymbolCache.bin",
@"C:\__NAME__\_ReSharper.__NAME__\BuildScriptCache\.crc",

0 comments on commit 21bca99

Please sign in to comment.