Load extensions even when only using middleman-core. Also, use Bundler.require when available rather than scanning gems for extensions.

This commit is contained in:
Ben Hollis 2012-03-13 23:00:02 -07:00
parent baa7d42d74
commit f1051d8c59
3 changed files with 13 additions and 9 deletions

View file

@ -46,6 +46,9 @@ rescue LoadError
end end
end end
# Automatically discover extensions in RubyGems
Middleman.load_extensions_in_path
# Change directory to the root # Change directory to the root
Dir.chdir(ENV["MM_ROOT"] || Dir.pwd) do Dir.chdir(ENV["MM_ROOT"] || Dir.pwd) do

View file

@ -196,6 +196,9 @@ module Middleman
# #
# @private # @private
def load_extensions_in_path def load_extensions_in_path
if defined?(Bundler)
Bundler.require
else
extensions = rubygems_latest_specs.select do |spec| extensions = rubygems_latest_specs.select do |spec|
spec_has_file?(spec, EXTENSION_FILE) spec_has_file?(spec, EXTENSION_FILE)
end end
@ -204,6 +207,7 @@ module Middleman
require spec.name require spec.name
end end
end end
end
# Backwards compatible means of finding all the latest gemspecs # Backwards compatible means of finding all the latest gemspecs
# available on the system # available on the system

View file

@ -3,6 +3,3 @@ require "middleman-more"
# Make the VERSION string available # Make the VERSION string available
require "middleman-core/version" require "middleman-core/version"
# Automatically discover extensions in RubyGems
Middleman.load_extensions_in_path