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 we've found the root, try to setup Bundler
if ENV["MM_ROOT"] if ENV["MM_ROOT"]
# Set up gems listed in the Gemfile. root_gemfile = File.expand_path('Gemfile', ENV["MM_ROOT"])
ENV['BUNDLE_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']) require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
end end
@ -34,11 +40,11 @@ end
require "middleman-core/extensions" require "middleman-core/extensions"
::Middleman.load_extensions_in_path ::Middleman.load_extensions_in_path
require "middleman-core/cli"
# Default command is server # Default command is server
ARGV.unshift("server") if ARGV.length < 1 || ARGV.first.include?("-") ARGV.unshift("server") if ARGV.length < 1 || ARGV.first.include?("-")
require "middleman-core/cli"
# Start the CLI # Start the CLI
if ENV["MM_ROOT"] if ENV["MM_ROOT"]
# Change directory to the root # Change directory to the root

View file

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

View file

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