lib/sprockets/resolve.rb in sprockets-3.0.0.beta.10 vs lib/sprockets/resolve.rb in sprockets-3.0.0.rc.1
- old
+ new
@@ -149,39 +149,40 @@
path = dirname if basename == 'index'
path
end
def path_matches(load_path, logical_name, logical_basename)
- candidates, deps = [], Set.new
- dirname = File.dirname(File.join(load_path, logical_name))
+ dirname = File.dirname(File.join(load_path, logical_name))
+ candidates = dirname_matches(dirname, logical_basename)
+ deps = file_digest_dependency_set(dirname)
- result = dirname_matches(dirname, logical_basename)
- candidates.concat(result[0])
- deps.merge(result[1])
-
result = resolve_alternates(load_path, logical_name)
result[0].each do |fn|
candidates << [fn, parse_path_extnames(fn)[1]]
end
deps.merge(result[1])
- result = dirname_matches(File.join(load_path, logical_name), "index")
- candidates.concat(result[0])
- deps.merge(result[1])
+ dirname = File.join(load_path, logical_name)
+ if directory? dirname
+ result = dirname_matches(dirname, "index")
+ candidates.concat(result)
+ end
+ deps.merge(file_digest_dependency_set(dirname))
+
return candidates.select { |fn, _| file?(fn) }, deps
end
def dirname_matches(dirname, basename)
candidates = []
- entries, deps = self.entries_with_dependencies(dirname)
+ entries = self.entries(dirname)
entries.each do |entry|
name, type, _, _ = parse_path_extnames(entry)
if basename == name
candidates << [File.join(dirname, entry), type]
end
end
- return candidates, deps
+ candidates
end
def resolve_alternates(load_path, logical_name)
return [], Set.new
end