class Object

Public Instance Methods

compile_path_with_parcels?(logical_path) click to toggle source
# File lib/parcels/sprockets.rb, line 79
def compile_path_with_parcels?(logical_path)
  return false if ::Parcels.is_fortitude_logical_path?(logical_path)
  compile_path_without_parcels?(logical_path)
end
env() click to toggle source
# File lib/parcels/sprockets.rb, line 108
def env
  ::Parcels::Sprockets::StaticCompilerEnvProxy.new(@env)
end
find_relative_with_parcels(name, base, options) click to toggle source
# File lib/parcels/sprockets.rb, line 129
def find_relative_with_parcels(name, base, options)
  sprockets_context = (options[:custom] || { })[:sprockets_context]
  sprockets_context ||= context if respond_to?(:context)
  unless sprockets_context
    raise "Unable to find the Sprockets context here; it was neither in options, nor do we have it in the class"
  end

  parcels = sprockets_context.environment.parcels
  expanded_locations_to_search = sprockets_context.environment.paths + [ File.dirname(base) ]
  expanded_locations_to_search = expanded_locations_to_search.map do |location|
    if location.kind_of?(::Pathname)
      location
    else
      ::Pathname.new(location.to_s)
    end
  end

  if name =~ self.class.const_get(:GLOB) && parcels.is_underneath_root?(base)
    paths_to_search = expanded_locations_to_search

    imports = nil
    paths_to_search.each do |path_to_search|
      glob_against = Pathname.new(File.join(path_to_search.to_s, 'dummy'))
      imports = glob_imports(name, glob_against, :load_paths => [ path_to_search ])
      return imports if imports
    end
  end

  load_paths = (options[:load_paths] || [ ]) + expanded_locations_to_search
  return find_relative_without_parcels(name, base, options.merge(:load_paths => load_paths))
end
format_extension_with_parcels() click to toggle source
# File lib/parcels/sprockets.rb, line 57
def format_extension_with_parcels
  out = format_extension_without_parcels
  out = nil if out && out =~ /^\.html$/i
  out
end
index_with_parcels() click to toggle source
# File lib/parcels/sprockets.rb, line 23
def index_with_parcels
  parcels.create_and_add_all_workaround_directories!
  index_without_parcels
end
initialize_with_parcels(environment) click to toggle source

Older versions of Sprockets don’t actually hang on to the environment here.

# File lib/parcels/sprockets.rb, line 33
def initialize_with_parcels(environment)
  initialize_without_parcels(environment)
  @environment ||= environment
end
parcels() click to toggle source
# File lib/parcels/sprockets.rb, line 19
def parcels
  @parcels ||= ::Parcels::Environment.new(self)
end
process_require_parcels_directive(*set_names) click to toggle source
# File lib/parcels/sprockets.rb, line 46
def process_require_parcels_directive(*set_names)
  set_names = set_names.map do |set_name|
    set_name = set_name.to_s.strip
    set_name = $1 if set_name =~ /,?(.*?),?$/i
    set_name.strip.to_sym
  end
  context.environment.parcels.add_all_widgets_to!(context, set_names.map(&:to_sym))
end