Load from root bundler when running from git

This commit is contained in:
Thomas Reynolds 2012-05-26 14:15:36 -07:00
parent 1d90d03dd8
commit 3b847696ff
4 changed files with 127 additions and 116 deletions

View file

@ -25,8 +25,14 @@ end
# If we've found the root, try to setup Bundler
if ENV["MM_ROOT"]
# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('Gemfile', ENV["MM_ROOT"])
root_gemfile = File.expand_path('Gemfile', ENV["MM_ROOT"])
ENV['BUNDLE_GEMFILE'] ||= root_gemfile
if !File.exists?(ENV['BUNDLE_GEMFILE'])
git_gemfile = Pathname.new(__FILE__).expand_path.parent.parent.parent + "Gemfile"
ENV['BUNDLE_GEMFILE'] = git_gemfile.to_s
end
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
end
@ -34,11 +40,11 @@ end
require "middleman-core/extensions"
::Middleman.load_extensions_in_path
require "middleman-core/cli"
# Default command is server
ARGV.unshift("server") if ARGV.length < 1 || ARGV.first.include?("-")
require "middleman-core/cli"
# Start the CLI
if ENV["MM_ROOT"]
# Change directory to the root

View file

@ -137,7 +137,10 @@ module Middleman
instance_eval File.read(local_config), local_config, 1
end
activate(:sprockets) if autoload_sprockets
if autoload_sprockets
require "middleman-sprockets"
activate(:sprockets)
end
run_hook :build_config if build?
run_hook :development_config if development?

View file

@ -4,7 +4,8 @@ require "middleman-core"
libdir = File.expand_path(File.dirname(__FILE__))
$LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir)
module Middleman::More
module Middleman
module More
# Setup extension
class << self
@ -142,6 +143,7 @@ module Middleman::More
end
end
end
end
end
Middleman::Application.register Middleman::More