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
|
ENV["MM_ROOT"] = found_path
|
||||||
end
|
end
|
||||||
|
|
||||||
|
is_bundler_setup = false
|
||||||
|
|
||||||
# If we've found the root, try to setup Bundler
|
# If we've found the root, try to setup Bundler
|
||||||
if ENV["MM_ROOT"]
|
if ENV["MM_ROOT"]
|
||||||
|
|
||||||
|
@ -33,12 +35,20 @@ if ENV["MM_ROOT"]
|
||||||
ENV['BUNDLE_GEMFILE'] = git_gemfile.to_s
|
ENV['BUNDLE_GEMFILE'] = git_gemfile.to_s
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
# Automatically discover extensions in RubyGems
|
# Automatically discover extensions in RubyGems
|
||||||
require "middleman-core/extensions"
|
require "middleman-core/extensions"
|
||||||
|
|
||||||
|
if is_bundler_setup
|
||||||
|
Bundler.require
|
||||||
|
else
|
||||||
::Middleman.load_extensions_in_path
|
::Middleman.load_extensions_in_path
|
||||||
|
end
|
||||||
|
|
||||||
require "middleman-core/cli"
|
require "middleman-core/cli"
|
||||||
|
|
||||||
|
|
|
@ -58,9 +58,6 @@ module Middleman
|
||||||
#
|
#
|
||||||
# @private
|
# @private
|
||||||
def load_extensions_in_path
|
def load_extensions_in_path
|
||||||
if defined?(Bundler)
|
|
||||||
Bundler.require
|
|
||||||
else
|
|
||||||
require "rubygems"
|
require "rubygems"
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
@ -76,7 +73,6 @@ 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
|
||||||
|
|
Loading…
Reference in a new issue