module Sprockets::GemPaths

Constants

VERSION

Public Class Methods

rubygems_latest_specs() click to toggle source
# File lib/sprockets/gem_paths.rb, line 5
def self.rubygems_latest_specs
  # If newer Rubygems
  if ::Gem::Specification.respond_to? :latest_specs
    ::Gem::Specification.latest_specs
  else
    ::Gem.source_index.latest_specs
  end
end

Public Instance Methods

append_gem_paths() click to toggle source
# File lib/sprockets/gem_paths.rb, line 14
def append_gem_paths
  try_paths = [
    %w{ assets },
    %w{ app },
    %w{ app assets },
    %w{ vendor },
    %w{ vendor assets },
    %w{ lib },
    %w{ lib assets }
  ].inject([]) do |sum, v|
    sum + [
      File.join(v, 'javascripts'),
      File.join(v, 'stylesheets'),
      File.join(v, 'images'),
      File.join(v, 'fonts')
    ]
  end

  (Sprockets::GemPaths.rubygems_latest_specs.map(&:full_gem_path)).each do |root_path|
    try_paths.map {|p| File.join(root_path, p) }.
      select {|p| File.directory?(p) }.
      each {|path| append_path(path) }
  end
end