4
5
6
7
8
9
10
11
12
13
14
15
16
|
# File 'lib/jasmine/path_expander.rb', line 4
def self.expand(base_directory, patterns, globber = Dir.method(:glob))
negative, positive = patterns.partition {|pattern| /^!/ =~ pattern}
chosen, negated = [positive, negative].collect do |patterns|
patterns.map do |path|
files = globber.call(File.join(base_directory, path.gsub(/^!/, '')))
if files.empty? && !(path =~ /\*|^\!/)
files = [File.join(base_directory, path)]
end
files
end.flatten.uniq
end
chosen - negated
end
|