module Middleman
def load_extensions_in_path
- Private: -
def load_extensions_in_path if defined?(Bundler) Bundler.require else extensions = rubygems_latest_specs.select do |spec| spec_has_file?(spec, EXTENSION_FILE) end extensions.each do |spec| require spec.name end end end
def rubygems_latest_specs
-
(Array)
- Array of latest Gem::Specification
Other tags:
- Private: -
def rubygems_latest_specs # If newer Rubygems if ::Gem::Specification.respond_to? :latest_specs ::Gem::Specification.latest_specs else ::Gem.source_index.latest_specs end end
def server(&block)
-
(Class)
-
def server(&block) @@servercounter ||= 1 @@servercounter += 1 const_set("MiddlemanApplication#{@@servercounter}", Class.new(Middleman::Application)) end
def spec_has_file?(spec, path)
-
(Boolean)
- Whether the file exists
Parameters:
-
Path
(String
) -- to look for -
(
Gem::Specification
) --
Other tags:
- Private: -
def spec_has_file?(spec, path) full_path = File.join(spec.full_gem_path, path) File.exists?(full_path) end
def start_server(options={})
-
(Rack::Server)
-
Parameters:
-
options
(Hash
) -- to pass to Rack::Server.new
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