class Sprockets::Asset

def dependency_fresh?(environment, dep)

want to test non-asset files and directories.
A `Hash` is used rather than other `Asset` object because we

`dep` is a `Hash` with `path`, `mtime` and `hexdigest` keys.

Check if dependency is fresh.
def dependency_fresh?(environment, dep)
  path, mtime, hexdigest = dep.pathname.to_s, dep.mtime, dep.digest
  stat = environment.stat(path)
  # If path no longer exists, its definitely stale.
  if stat.nil?
    return false
  end
  # Compare dependency mime to the actual mtime. If the
  # dependency mtime is newer than the actual mtime, the file
  # hasn't changed since we created this `Asset` instance.
  #
  # However, if the mtime is newer it doesn't mean the asset is
  # stale. Many deployment environments may recopy or recheckout
  # assets on each deploy. In this case the mtime would be the
  # time of deploy rather than modified time.
  if mtime >= stat.mtime
    return true
  end
  digest = environment.file_digest(path)
  # If the mtime is newer, do a full digest comparsion. Return
  # fresh if the digests match.
  if hexdigest == digest.hexdigest
    return true
  end
  # Otherwise, its stale.
  false
end