62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
# File 'lib/cnvrg/project.rb', line 62
def get_ignore_list
ignore_list = []
if !File.exist? self.local_path + "/.cnvrgignore"
return ignore_list
end
File.open(self.local_path + "/.cnvrgignore", "r").each_line do |line|
line = line.strip
if line.start_with? "#" or ignore_list.include? line or line.empty?
next
end
if line.end_with? "*"
list_regex = Dir.glob("**/#{line}", File::FNM_DOTMATCH).flatten
list_regex.each do |l|
ignore_list << l
if File.directory?(l)
all_sub = Dir.glob("#{line}/**/*", File::FNM_DOTMATCH).flatten
ignore_list << all_sub.flatten
end
end
elsif line.end_with? "/*"
line = line.gsub("/*", "")
regex_list = Dir.glob("**/#{line}/**/*", File::FNM_DOTMATCH).flatten
ignore_list << regex_list
elsif line.include? "*"
regex_list = Dir.glob("**/#{line}").flatten
ignore_list << regex_list
elsif line.end_with? "/" or File.directory?(line)
ignore_list << line
all_sub = Dir.glob("#{line}/**/*", File::FNM_DOTMATCH).flatten
ignore_list << all_sub.flatten
else
ignore_list << line
end
end
return ignore_list.flatten
end
|