module Middleman

def load_extensions_in_path

Other tags:
    Private: -
def load_extensions_in_path
  if defined?(Bundler)
    Bundler.require
  else
    extensions = rubygems_latest_specs.select do |spec|
      spec_has_file?(spec, EXTENSION_FILE)
    end
    extensions.each do |spec|
      require spec.name
    end
  end
end

def rubygems_latest_specs

Returns:
  • (Array) - Array of latest Gem::Specification

Other tags:
    Private: -
def 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

def spec_has_file?(spec, path)

Returns:
  • (Boolean) - Whether the file exists

Parameters:
  • path (String) -- Path to look for
  • spec (Gem::Specification) --

Other tags:
    Private: -
def spec_has_file?(spec, path)
  full_path = File.join(spec.full_gem_path, path)
  File.exists?(full_path)
end