Attempt address #466 and avoid Bundler issues with RVM

This commit is contained in:
Thomas Reynolds 2012-06-13 20:33:50 -07:00
parent 2e5ae051e6
commit 862a56a343
2 changed files with 25 additions and 19 deletions

View file

@ -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"

View file

@ -58,9 +58,6 @@ module Middleman
#
# @private
def load_extensions_in_path
if defined?(Bundler)
Bundler.require
else
require "rubygems"
begin
@ -76,7 +73,6 @@ module Middleman
require spec.name
end
end
end
# Backwards compatible means of finding all the latest gemspecs
# available on the system