Start getting middleman-more tests passing. About 50% done
This commit is contained in:
parent
c8a134a386
commit
73913f0ace
97 changed files with 267 additions and 161 deletions
|
@ -20,8 +20,8 @@ require "middleman-core/vendor/hooks-0.2.0/lib/hooks"
|
|||
|
||||
# Top-level Middleman object
|
||||
module Middleman
|
||||
WINDOWS = !!(RUBY_PLATFORM =~ /(mingw|bccwin|wince|mswin32)/i)
|
||||
JRUBY = !!(RbConfig::CONFIG["RUBY_INSTALL_NAME"] =~ /^jruby/i)
|
||||
WINDOWS = !!(RUBY_PLATFORM =~ /(mingw|bccwin|wince|mswin32)/i) unless const_defined?(:WINDOWS)
|
||||
JRUBY = !!(RbConfig::CONFIG["RUBY_INSTALL_NAME"] =~ /^jruby/i) unless const_defined?(:JRUBY)
|
||||
|
||||
# Auto-load modules on-demand
|
||||
autoload :Base, "middleman-core/base"
|
||||
|
@ -85,14 +85,24 @@ module Middleman
|
|||
|
||||
module Extensions
|
||||
# Provide Apache-style index.html files for directories
|
||||
autoload :DirectoryIndexes, "middleman-core/extensions/directory_indexes"
|
||||
autoload :DirectoryIndexes, "middleman-core/extensions/directory_indexes"
|
||||
|
||||
# Lorem provides a handful of helpful prototyping methods to generate
|
||||
# words, paragraphs, fake images, names and email addresses.
|
||||
autoload :Lorem, "middleman-core/extensions/lorem"
|
||||
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
|
||||
module Extensions
|
||||
class << self
|
||||
def registered
|
||||
@_registered ||= {}
|
||||
|
@ -117,7 +127,7 @@ module Middleman
|
|||
end
|
||||
|
||||
registered[name.to_sym] = if !passed_version_check
|
||||
"== #{name} failed version check. Requested #{version}, got #{Middleman::Core::VERSION}"
|
||||
"== #{name} failed version check. Requested #{version}, got #{Middleman::VERSION}"
|
||||
elsif block_given?
|
||||
block
|
||||
elsif namespace
|
||||
|
@ -141,7 +151,7 @@ module Middleman
|
|||
end
|
||||
|
||||
# Where to look in gems for extensions to auto-register
|
||||
EXTENSION_FILE = File.join("lib", "middleman_extension.rb")
|
||||
EXTENSION_FILE = File.join("lib", "middleman_extension.rb") unless const_defined?(:EXTENSION_FILE)
|
||||
|
||||
class << self
|
||||
|
||||
|
@ -175,7 +185,7 @@ module Middleman
|
|||
extensions = rubygems_latest_specs.select do |spec|
|
||||
spec_has_file?(spec, EXTENSION_FILE)
|
||||
end
|
||||
|
||||
|
||||
extensions.each do |spec|
|
||||
require spec.name
|
||||
end
|
||||
|
@ -222,11 +232,15 @@ module Middleman
|
|||
# @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
|
||||
|
@ -235,6 +249,7 @@ module Middleman
|
|||
# require "thin"
|
||||
# ::Thin::Logging.silent = !options[:logging]
|
||||
# opts[:server] = 'thin'
|
||||
opts[:server] = 'webrick'
|
||||
|
||||
server = ::Rack::Server.new(opts)
|
||||
server.start
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue