Class: Bunto::Commands::Serve
- Inherits:
-
Bunto::Command
- Object
- Bunto::Command
- Bunto::Commands::Serve
- Defined in:
- lib/bunto/commands/serve.rb,
lib/bunto/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 Bunto::Command
add_build_options, configuration_from_options, inherited, process_site, subclasses
Class Method Details
.init_with_program(prog) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/bunto/commands/serve.rb', line 20 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["config"] opts["url"] = default_url(opts) if Bunto.env == "development" Build.process(opts) opts["config"] = config Serve.process(opts) end end end |
.process(opts) ⇒ Object
46 47 48 49 50 51 52 |
# File 'lib/bunto/commands/serve.rb', line 46 def process(opts) opts = (opts) destination = opts["destination"] setup(destination) start_up_webrick(opts, destination) end |