Attempt address #466 and avoid Bundler issues with RVM
This commit is contained in:
parent
2e5ae051e6
commit
862a56a343
|
@ -22,6 +22,8 @@ if !ENV["MM_ROOT"] && found_path = locate_root
|
|||
ENV["MM_ROOT"] = found_path
|
||||
end
|
||||
|
||||
is_bundler_setup = false
|
||||
|
||||
# If we've found the root, try to setup Bundler
|
||||
if ENV["MM_ROOT"]
|
||||
|
||||
|
@ -33,12 +35,20 @@ if ENV["MM_ROOT"]
|
|||
ENV['BUNDLE_GEMFILE'] = git_gemfile.to_s
|
||||
end
|
||||
|
||||
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
|
||||
if File.exists?(ENV['BUNDLE_GEMFILE'])
|
||||
is_bundler_setup = true
|
||||
require 'bundler/setup'
|
||||
end
|
||||
end
|
||||
|
||||
# Automatically discover extensions in RubyGems
|
||||
require "middleman-core/extensions"
|
||||
::Middleman.load_extensions_in_path
|
||||
|
||||
if is_bundler_setup
|
||||
Bundler.require
|
||||
else
|
||||
::Middleman.load_extensions_in_path
|
||||
end
|
||||
|
||||
require "middleman-core/cli"
|
||||
|
||||
|
|
|
@ -58,23 +58,19 @@ module Middleman
|
|||
#
|
||||
# @private
|
||||
def load_extensions_in_path
|
||||
if defined?(Bundler)
|
||||
Bundler.require
|
||||
else
|
||||
require "rubygems"
|
||||
|
||||
begin
|
||||
require "middleman-more"
|
||||
rescue LoadError
|
||||
end
|
||||
|
||||
extensions = rubygems_latest_specs.select do |spec|
|
||||
spec_has_file?(spec, EXTENSION_FILE)
|
||||
end
|
||||
|
||||
extensions.each do |spec|
|
||||
require spec.name
|
||||
end
|
||||
require "rubygems"
|
||||
|
||||
begin
|
||||
require "middleman-more"
|
||||
rescue LoadError
|
||||
end
|
||||
|
||||
extensions = rubygems_latest_specs.select do |spec|
|
||||
spec_has_file?(spec, EXTENSION_FILE)
|
||||
end
|
||||
|
||||
extensions.each do |spec|
|
||||
require spec.name
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue