Class: Jekyll::Commands::Serve
- Inherits:
-
Jekyll::Command
- Object
- Jekyll::Command
- Jekyll::Commands::Serve
- Defined in:
- lib/jekyll/commands/serve.rb,
lib/jekyll/commands/serve/servlet.rb
Defined Under Namespace
Classes: Servlet
Constant Summary collapse
- COMMAND_OPTIONS =
{ "ssl_cert" => ["--ssl-cert [CERT]", "X.509 (SSL) certificate."], "host" => ["host", "-H", "--host [HOST]", "Host to bind to"], "open_url" => ["-o", "--open-url", "Launch your site in a browser"], "detach" => ["-B", "--detach", "Run the server in the background"], "ssl_key" => ["--ssl-key [KEY]", "X.509 (SSL) Private Key."], "port" => ["-P", "--port [PORT]", "Port to listen on"], "show_dir_listing" => ["--show-dir-listing", "Show a directory listing instead of loading your index file.",], "skip_initial_build" => ["skip_initial_build", "--skip-initial-build", "Skips the initial site build which occurs before the server is started.",], }.freeze
Class Method Summary collapse
Methods inherited from Jekyll::Command
add_build_options, configuration_from_options, inherited, process_site, subclasses
Class Method Details
.init_with_program(prog) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/jekyll/commands/serve.rb', line 22 def init_with_program(prog) prog.command(:serve) do |cmd| cmd.description "Serve your site locally" cmd.syntax "serve [options]" cmd.alias :server cmd.alias :s (cmd) COMMAND_OPTIONS.each do |key, val| cmd.option key, *val end cmd.action do |_, opts| opts["serving"] = true opts["watch" ] = true unless opts.key?("watch") config = (opts) if Jekyll.env == "development" config["url"] = default_url(config) end [Build, Serve].each { |klass| klass.process(config) } end end end |
.process(opts) ⇒ Object
49 50 51 52 53 54 55 |
# File 'lib/jekyll/commands/serve.rb', line 49 def process(opts) opts = (opts) destination = opts["destination"] setup(destination) start_up_webrick(opts, destination) end |