buff-ignore 1.0.4 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +3 -0
- data/lib/buff/ignore/ignore_file.rb +14 -14
- data/lib/buff/ignore/version.rb +1 -1
- metadata +1 -1
data/CHANGELOG.md
CHANGED
@@ -63,6 +63,20 @@ module Buff
|
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
66
|
+
# Determine if a given filename should be ignored
|
67
|
+
#
|
68
|
+
# @param [String] filename
|
69
|
+
# the file to match
|
70
|
+
#
|
71
|
+
# @return [Boolean]
|
72
|
+
# true if the file should be ignored, false otherwise
|
73
|
+
def ignored?(filename)
|
74
|
+
base = File.expand_path(options[:base] || File.dirname(filepath))
|
75
|
+
basename = filename.sub(base + File::SEPARATOR, '')
|
76
|
+
|
77
|
+
ignores.any? { |ignore| File.fnmatch?(ignore, basename) }
|
78
|
+
end
|
79
|
+
|
66
80
|
private
|
67
81
|
# The list of options
|
68
82
|
#
|
@@ -77,20 +91,6 @@ module Buff
|
|
77
91
|
line.empty? || line =~ COMMENT_OR_WHITESPACE
|
78
92
|
end
|
79
93
|
end
|
80
|
-
|
81
|
-
# Helper boolean to determine if a given filename should be ignored
|
82
|
-
#
|
83
|
-
# @param [String] filename
|
84
|
-
# the file to match
|
85
|
-
#
|
86
|
-
# @return [Boolean]
|
87
|
-
# true if the file should be ignored, false otherwise
|
88
|
-
def ignored?(filename)
|
89
|
-
base = File.expand_path(options[:base] || File.dirname(filepath))
|
90
|
-
basename = filename.sub(base + File::SEPARATOR, '')
|
91
|
-
|
92
|
-
ignores.any? { |ignore| File.fnmatch?(ignore, basename) }
|
93
|
-
end
|
94
94
|
end
|
95
95
|
end
|
96
96
|
end
|
data/lib/buff/ignore/version.rb
CHANGED