Class: Middleman::Cli::Server

Inherits:
Thor
  • Object
show all
Defined in:
lib/middleman-core/cli/server.rb

Overview

Server thor task

Instance Method Summary collapse

Instance Method Details

#serverObject

Start the server



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/middleman-core/cli/server.rb', line 42

def server
  require "middleman-core"
  require "middleman-core/preview_server"

  if !ENV["MM_ROOT"]
    puts "== Could not find a Middleman project config.rb"
    puts "== Treating directory as a static site to be served"
    ENV["MM_ROOT"] = Dir.pwd
    ENV["MM_SOURCE"] = ""
  end

  params = {
    :port              => options["port"],
    :host              => options["host"],
    :environment       => options["environment"],
    :debug             => options["verbose"],
    :instrumenting     => options["instrument"],
    :"disable-watcher" => options["disable-watcher"]
  }

  puts "== The Middleman is loading"
  ::Middleman::PreviewServer.start(params)
end