Sha256: 708d0c4b331df337ae5a9358f0805e59bc2cbfdc905f42fe607a50dc15e9ab6e
Contents?: true
Size: 727 Bytes
Versions: 8
Compression:
Stored size: 727 Bytes
Contents
require 'rack' module Massimo class Server class << self def start(site, port = 3000) Massimo::UI.say "massimo is serving your site at http://localhost:#{port}", :growl => true app = Rack::Builder.new do use Rack::ShowExceptions run Massimo::Server.new(site) end Rack::Handler::WEBrick.run(app, :Port => port) end end def initialize(site) @site = site @file_server = Rack::File.new(site.config.output_path) @watcher = Massimo::Watcher.new(site) end def call(env) @watcher.process env['PATH_INFO'] << 'index.html' if env['PATH_INFO'] =~ /\/$/ @file_server.call(env) end end end
Version data entries
8 entries across 8 versions & 1 rubygems