module Sprockets::PathUtils

def stat_sorted_tree(dir, &block)

Returns an Enumerator of [path, stat].

dir - A String directory

order.
Public: Recursive stat all the files under a directory in alphabetical
def stat_sorted_tree(dir, &block)
  return to_enum(__method__, dir) unless block_given?
  self.stat_directory(dir).sort_by { |path, stat|
    stat.directory? ? "#{path}/" : path
  }.each do |path, stat|
    yield path, stat
    if stat.directory?
      stat_sorted_tree(path, &block)
    end
  end
  nil
end