Fix whitespace

This commit is contained in:
Piotr Usewicz 2012-02-11 09:35:49 +00:00
parent b82ad07b51
commit f5edfa75df

View file

@ -24,70 +24,70 @@ module Middleman
JRUBY = !!(RbConfig::CONFIG["RUBY_INSTALL_NAME"] =~ /^jruby/i) unless const_defined?(:JRUBY)
DARWIN = RbConfig::CONFIG['target_os'] =~ /darwin/i unless const_defined?(:DARWIN)
LINUX = RbConfig::CONFIG['target_os'] =~ /linux/i unless const_defined?(:LINUX)
# Auto-load modules on-demand
autoload :Base, "middleman-core/base"
autoload :Cache, "middleman-core/cache"
autoload :Templates, "middleman-core/templates"
autoload :Watcher, "middleman-core/watcher"
module Cli
autoload :Base, "middleman-core/cli"
autoload :Build, "middleman-core/cli/build"
autoload :Init, "middleman-core/cli/init"
autoload :Server, "middleman-core/cli/server"
end
# Custom Renderers
module Renderers
autoload :ERb, "middleman-core/renderers/erb"
end
module Sitemap
autoload :Store, "middleman-core/sitemap/store"
autoload :Page, "middleman-core/sitemap/page"
autoload :Template, "middleman-core/sitemap/template"
end
module CoreExtensions
# File Change Notifier
autoload :FileWatcher, "middleman-core/core_extensions/file_watcher"
# In-memory Sitemap
autoload :Sitemap, "middleman-core/core_extensions/sitemap"
# Add Builder callbacks
autoload :Builder, "middleman-core/core_extensions/builder"
# Custom Feature API
autoload :Extensions, "middleman-core/core_extensions/extensions"
# Asset Path Pipeline
autoload :Assets, "middleman-core/core_extensions/assets"
# Data looks at the data/ folder for YAML files and makes them available
# to dynamic requests.
autoload :Data, "middleman-core/core_extensions/data"
# Parse YAML from templates
autoload :FrontMatter, "middleman-core/core_extensions/front_matter"
# External helpers looks in the helpers/ folder for helper modules
autoload :ExternalHelpers, "middleman-core/core_extensions/external_helpers"
# DefaultHelpers are the built-in dynamic template helpers.
autoload :DefaultHelpers, "middleman-core/core_extensions/default_helpers"
# Extended version of Padrino's rendering
autoload :Rendering, "middleman-core/core_extensions/rendering"
# Pass custom options to views
autoload :Routing, "middleman-core/core_extensions/routing"
# Catch and show exceptions at the Rack level
autoload :ShowExceptions, "middleman-core/core_extensions/show_exceptions"
end
module Extensions
# Provide Apache-style index.html files for directories
autoload :DirectoryIndexes, "middleman-core/extensions/directory_indexes"
@ -95,18 +95,18 @@ module Middleman
# Lorem provides a handful of helpful prototyping methods to generate
# words, paragraphs, fake images, names and email addresses.
autoload :Lorem, "middleman-core/extensions/lorem"
# AutomaticImageSizes inspects the images used in your dynamic templates
# and automatically adds width and height attributes to their HTML
# elements.
autoload :AutomaticImageSizes, "middleman-core/extensions/automatic_image_sizes"
# AssetHost allows you to setup multiple domains to host your static
# assets. Calls to asset paths in dynamic templates will then rotate
# through each of the asset servers to better spread the load.
autoload :AssetHost, "middleman-core/extensions/asset_host"
end
module Extensions
class << self
def registered
@ -114,9 +114,9 @@ module Middleman
end
def register(name, namespace=nil, version=nil, &block)
# If we've already got a matching extension that passed the
# If we've already got a matching extension that passed the
# version check, bail out.
return if registered.has_key?(name.to_sym) &&
return if registered.has_key?(name.to_sym) &&
!registered[name.to_sym].is_a?(String)
if block_given?
@ -154,12 +154,12 @@ module Middleman
end
end
end
# Where to look in gems for extensions to auto-register
EXTENSION_FILE = File.join("lib", "middleman_extension.rb") unless const_defined?(:EXTENSION_FILE)
class << self
# Recursively convert a normal Hash into a HashWithIndifferentAccess
#
# @private
@ -181,7 +181,7 @@ module Middleman
data
end
end
# Automatically load extensions from available RubyGems
# which contain the EXTENSION_FILE
#
@ -190,12 +190,12 @@ module Middleman
extensions = rubygems_latest_specs.select do |spec|
spec_has_file?(spec, EXTENSION_FILE)
end
extensions.each do |spec|
require spec.name
end
end
# Backwards compatible means of finding all the latest gemspecs
# available on the system
#
@ -209,7 +209,7 @@ module Middleman
::Gem.source_index.latest_specs
end
end
# Where a given Gem::Specification has a specific file. Used
# to discover extensions and Sprockets-supporting gems.
#
@ -221,9 +221,9 @@ module Middleman
full_path = File.join(spec.full_gem_path, path)
File.exists?(full_path)
end
# Create a new Class which is based on Middleman::Base
# Used to create a safe sandbox into which extensions and
# Used to create a safe sandbox into which extensions and
# configuration can be included later without impacting
# other classes and instances.
#
@ -231,34 +231,34 @@ module Middleman
def server(&block)
Class.new(Middleman::Base)
end
# Creates a new Rack::Server
#
# @param [Hash] options to pass to Rack::Server.new
# @return [Rack::Server]
def start_server(options={})
require "webrick"
opts = {
:Port => options[:port] || 4567,
:Host => options[:host] || "0.0.0.0",
:AccessLog => []
}
opts[:Logger] = WEBrick::Log::new("/dev/null", 7) if !options[:logging]
app_class = options[:app] ||= ::Middleman.server.inst
opts[:app] = app_class
# Disable for Beta 1. See if people notice.
# require "thin"
# ::Thin::Logging.silent = !options[:logging]
# opts[:server] = 'thin'
opts[:server] = 'webrick'
server = ::Rack::Server.new(opts)
server.start
server
end
end
end
end