Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Jekyll server monkey-patch to mirror Core #499

Merged
merged 1 commit into from
Sep 26, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions lib/jekyll/commands/serve.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,24 @@ module Jekyll
module Commands
class Serve < Command
class << self
private

def start_up_webrick(opts, destination)
@reload_reactor.start(opts) if opts["livereload"]

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

jekyll_admin_monkey_patch(server)
jekyll_admin_monkey_patch

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

def jekyll_admin_monkey_patch(server)
server.mount "/admin", Rack::Handler::WEBrick, JekyllAdmin::StaticServer
server.mount "/_api", Rack::Handler::WEBrick, JekyllAdmin::Server
def jekyll_admin_monkey_patch
@server.mount "/admin", Rack::Handler::WEBrick, JekyllAdmin::StaticServer
@server.mount "/_api", Rack::Handler::WEBrick, JekyllAdmin::Server
Jekyll.logger.info "JekyllAdmin mode:", ENV["RACK_ENV"] || "production"
end
end
Expand Down