Method: StaticMatic::Server.start

Defined in:
lib/staticmatic/server.rb

.start(staticmatic) ⇒ Object

Starts the StaticMatic preview server



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/staticmatic/server.rb', line 77

def start(staticmatic)
  port = staticmatic.configuration.preview_server_port || 3000
  
  host = staticmatic.configuration.preview_server_host || ""
  
  config = Mongrel::Configurator.new :host => host do
    puts "Running Preview of #{staticmatic.base_dir} on #{host}:#{port}"
    listener :port => port do
      uri "/", :handler => Server.new(staticmatic)
    end
    trap("INT") { stop }
    run
  end
  config.join
end