Class: Bunto::Commands::Serve

Inherits:
Command
  • Object
show all
Defined in:
lib/bunto/commands/serve.rb

Class Method Summary collapse

Class Method Details

.bunto_admin_monkey_patch(server) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/bunto/commands/serve.rb', line 16

def bunto_admin_monkey_patch(server)
  server.mount "/admin", Rack::Handler::WEBrick, BuntoAdmin::StaticServer
  server.mount "/_api",  Rack::Handler::WEBrick, BuntoAdmin::Server
  Bunto.logger.warn "Auto-regeneration:", "disabled by BuntoAdmin."
  Bunto.logger.warn "", "The site will regenerate only via the Admin interface."
  Bunto.logger.info "BuntoAdmin mode:", ENV["RACK_ENV"] || "production"
end

.start_up_webrick(opts, destination) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'lib/bunto/commands/serve.rb', line 5

def start_up_webrick(opts, destination)
  server = WEBrick::HTTPServer.new(webrick_opts(opts)).tap { |o| o.unmount("") }
  server.mount(opts["baseurl"], Servlet, destination, file_handler_opts)

  bunto_admin_monkey_patch(server)

  Bunto.logger.info "Server address:", server_address(server, opts)
  launch_browser server, opts if opts["open_url"]
  boot_or_detach server, opts
end