Module: Sprockets::PathDependencyUtils

### Home Classes Methods

### In Files

- lib/sprockets/path_dependency_utils.rb

### Methods

- #entries_with_dependencies
- #file_digest_dependency_set
- #stat_directory_with_dependencies
- #stat_sorted_tree_with_dependencies

### Included Modules

- Sprockets::PathUtils
- Sprockets::URIUtils

### Class/Module Index

Quicksearch

- Sprockets
- Sprockets::ArgumentError
- Sprockets::Asset
- Sprockets::Autoload
- Sprockets::Base
- Sprockets::Bower
- Sprockets::Bundle
- Sprockets::Cache
- Sprockets::Cache::FileStore
- Sprockets::Cache::GetWrapper
- Sprockets::Cache::HashWrapper
- Sprockets::Cache::MemoryStore
- Sprockets::Cache::NullStore
- Sprockets::Cache::ReadWriteWrapper
- Sprockets::Cache::Wrapper
- Sprockets::CachedEnvironment
- Sprockets::ClosureCompressor
- Sprockets::CoffeeScriptProcessor
- Sprockets::CoffeeScriptTemplate
- Sprockets::Compressing
- Sprockets::Configuration
- Sprockets::ContentTypeMismatch
- Sprockets::Context
- Sprockets::ConversionError
- Sprockets::Dependencies
- Sprockets::DigestUtils
- Sprockets::DirectiveProcessor
- Sprockets::ERBProcessor
- Sprockets::ERBTemplate
- Sprockets::EcoProcessor
- Sprockets::EcoTemplate
- Sprockets::EjsProcessor
- Sprockets::EjsTemplate
- Sprockets::EncodingUtils
- Sprockets::Engines
- Sprockets::Environment
- Sprockets::Error
- Sprockets::FileNotFound
- Sprockets::FileOutsidePaths
- Sprockets::FileReader
- Sprockets::HTTPUtils
- Sprockets::Index
- Sprockets::JstProcessor
- Sprockets::LegacyProcProcessor
- Sprockets::LegacyTiltProcessor
- Sprockets::Loader
- Sprockets::Manifest
- Sprockets::ManifestUtils
- Sprockets::Mime
- Sprockets::NotFound
- Sprockets::NotImplementedError
- Sprockets::PathDependencyUtils
- Sprockets::PathDigestUtils
- Sprockets::PathUtils
- Sprockets::Paths
- Sprockets::Processing
- Sprockets::ProcessorUtils
- Sprockets::Resolve
- Sprockets::SassCompressor
- Sprockets::SassProcessor
- Sprockets::SassProcessor::CacheStore
- Sprockets::SassProcessor::Functions
- Sprockets::SassTemplate
- Sprockets::ScssProcessor
- Sprockets::ScssTemplate
- Sprockets::Server
- Sprockets::Transformers
- Sprockets::URITar
- Sprockets::URIUtils
- Sprockets::UglifierCompressor
- Sprockets::UnloadedAsset
- Sprockets::Utils
- Sprockets::YUICompressor
- Rake
- Rake::SprocketsTask

No matching classes.

# Sprockets::PathDependencyUtils

Internal: Related PathUtils helpers that also track all the file system calls they make for caching purposes. All functions return a standard return value and a Set of cache dependency URIs that can be used in the future to see if the returned value should be invalidated from cache.

    entries_with_dependencies("app/assets/javascripts")
    # => [
    #   ["application.js", "projects.js", "users.js", ...]
    #    #<Set: {"file-digest:/path/to/app/assets/javascripts"}>
    # ]

The returned dependency set can be passed to resolve_dependencies(deps) to check if the returned result is still fresh. In this case, entry always returns a single path, but multiple calls should accumulate dependencies into a single set thats saved off and checked later.

    resolve_dependencies(deps)
    # => "\x01\x02\x03"

Later, resolving the same set again will produce a different hash if something on the file system has changed.

    resolve_dependencies(deps)
    # => "\x03\x04\x05"

### Public Instance Methods

entries_with_dependencies(path) click to toggle source

Internal: List directory entries and return a set of dependencies that would invalid the cached return result.

See PathUtils#entries

path - String directory path

Returns an Array of entry names and a Set of dependency URIs.

    # File lib/sprockets/path_dependency_utils.rb, line 43
    def entries_with_dependencies(path)
      return entries(path), file_digest_dependency_set(path)
    end

file_digest_dependency_set(path) click to toggle source

Internal: Returns a set of dependencies for a particular path.

path - String directory path

Returns a Set of dependency URIs.

    # File lib/sprockets/path_dependency_utils.rb, line 64
    def file_digest_dependency_set(path)
      Set.new([build_file_digest_uri(path)])
    end

stat_directory_with_dependencies(dir) click to toggle source

Internal: List directory filenames and associated Stats under a directory.

See PathUtils#stat_directory

dir - A String directory

Returns an Array of filenames and a Set of dependency URIs.

    # File lib/sprockets/path_dependency_utils.rb, line 55
    def stat_directory_with_dependencies(dir)
      return stat_directory(dir).to_a, file_digest_dependency_set(dir)
    end

stat_sorted_tree_with_dependencies(dir) click to toggle source

Internal: List directory filenames and associated Stats under an entire directory tree.

See PathUtils#stat_sorted_tree

dir - A String directory

Returns an Array of filenames and a Set of dependency URIs.

    # File lib/sprockets/path_dependency_utils.rb, line 76
    def stat_sorted_tree_with_dependencies(dir)
      deps = Set.new([build_file_digest_uri(dir)])
      results = stat_sorted_tree(dir).map do |path, stat|
        deps << build_file_digest_uri(path) if stat.directory?
        [path, stat]
      end
      return results, deps
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.