lib/mate/tmproj/ignores.rb in mate-1.1.6 vs lib/mate/tmproj/ignores.rb in mate-1.2.0
- old
+ new
@@ -12,18 +12,19 @@
def initialize(dir)
@dir = dir
@file_pattern = ["#{DOUBLE_ASTERISK_R}.+\\.(?:#{BINARY_EXTENSIONS.flatten.join('|')})"]
@folder_pattern = ["#{DOUBLE_ASTERISK_R}.git"]
- add(dir, Pathname(`git config --get core.excludesfile`.strip).expand_path)
+ process(dir, Pathname(`git config --get core.excludesfile`.strip).expand_path)
+ process(dir, Pathname('~/.tmignore').expand_path)
dir.find do |path|
Find.prune if ignore?(path)
if path.directory?
%w[.gitignore .tmignore .git/info/exclude].each do |ignore_file_name|
if (ignore_file = path + ignore_file_name).file?
- add(path, ignore_file)
+ process(path, ignore_file)
end
end
end
end
end
@@ -44,10 +45,11 @@
"^#{Regexp.escape(dir.to_s)}/(?:#{folder_pattern.join('|')})$"
end
private
- def add(parent, ignore_file)
+ def process(parent, ignore_file)
+ return unless ignore_file.exist?
current_file_pattern = []
current_folder_pattern = []
ignore_file.readlines.map do |line|
line.lstrip[/(.*?)(\r?\n)?$/, 1] # this strange stuff strips line, but allows mac Icon\r files to be ignored
end.reject do |line|