Clean up whitespace, play with cane for testing style quality and code complexity
This commit is contained in:
parent
955c66a54f
commit
446aa6a4ba
133 changed files with 895 additions and 871 deletions
|
@ -32,7 +32,7 @@
|
|||
module Middleman
|
||||
module CoreExtensions
|
||||
module Extensions
|
||||
|
||||
|
||||
# Register extension
|
||||
class << self
|
||||
# @private
|
||||
|
@ -44,13 +44,13 @@ module Middleman
|
|||
app.define_hook :before_configuration
|
||||
app.define_hook :build_config
|
||||
app.define_hook :development_config
|
||||
|
||||
|
||||
if ENV["AUTOLOAD_SPROCKETS"]
|
||||
app.set :autoload_sprockets, (ENV["AUTOLOAD_SPROCKETS"] == "true")
|
||||
else
|
||||
app.set :autoload_sprockets, true
|
||||
end
|
||||
|
||||
|
||||
app.extend ClassMethods
|
||||
app.send :include, InstanceMethods
|
||||
app.delegate :configure, :to => :"self.class"
|
||||
|
@ -67,23 +67,23 @@ module Middleman
|
|||
def configure(env, &block)
|
||||
send("#{env}_config", &block)
|
||||
end
|
||||
|
||||
|
||||
# Alias `extensions` to access registered extensions
|
||||
#
|
||||
# @return [Array<Module>]
|
||||
def extensions
|
||||
@extensions ||= []
|
||||
end
|
||||
|
||||
|
||||
# Register a new extension
|
||||
#
|
||||
#
|
||||
# @param [Module] extension Extension modules to register
|
||||
# @param [Hash] options Per-extension options hash
|
||||
# @return [void]
|
||||
def register(extension, options={}, &block)
|
||||
@extensions ||= []
|
||||
@extensions += [extension]
|
||||
|
||||
|
||||
extend extension
|
||||
if extension.respond_to?(:registered)
|
||||
if extension.method(:registered).arity === 1
|
||||
|
@ -94,7 +94,7 @@ module Middleman
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# Instance methods
|
||||
module InstanceMethods
|
||||
# This method is available in the project's `config.rb`.
|
||||
|
@ -111,7 +111,7 @@ module Middleman
|
|||
else
|
||||
::Middleman::Extensions.load(ext.to_sym)
|
||||
end
|
||||
|
||||
|
||||
if ext_module.nil?
|
||||
logger.warning "== Unknown Extension: #{ext}"
|
||||
else
|
||||
|
@ -119,24 +119,24 @@ module Middleman
|
|||
self.class.register(ext_module, options, &block)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# Load features before starting server
|
||||
def initialize
|
||||
super
|
||||
|
||||
|
||||
self.class.inst = self
|
||||
run_hook :before_configuration
|
||||
|
||||
|
||||
# Search the root of the project for required files
|
||||
$LOAD_PATH.unshift(root)
|
||||
|
||||
|
||||
# Check for and evaluate local configuration
|
||||
local_config = File.join(root, "config.rb")
|
||||
if File.exists? local_config
|
||||
logger.debug "== Reading: Local config"
|
||||
instance_eval File.read(local_config), local_config, 1
|
||||
end
|
||||
|
||||
|
||||
if autoload_sprockets
|
||||
begin
|
||||
require "middleman-sprockets"
|
||||
|
@ -144,12 +144,12 @@ module Middleman
|
|||
rescue LoadError
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
run_hook :build_config if build?
|
||||
run_hook :development_config if development?
|
||||
|
||||
|
||||
run_hook :after_configuration
|
||||
|
||||
|
||||
logger.debug "Loaded extensions:"
|
||||
self.class.extensions.each do |ext|
|
||||
logger.debug "== Extension: #{ext}"
|
||||
|
@ -158,4 +158,4 @@ module Middleman
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue