Class: Ronin::Web::CLI::Commands::Server Private
- Inherits:
-
Ronin::Web::CLI::Command
- Object
- Core::CLI::Command
- Ronin::Web::CLI::Command
- Ronin::Web::CLI::Commands::Server
- Includes:
- Core::CLI::Logging
- Defined in:
- lib/ronin/web/cli/commands/server.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Starts a web server.
Usage
ronin-web server [options]
Options
-H, --host HOST Host name or IP to bind to (Default: localhost) -p, --port PORT Port number to listen on (Default: 8000) -A, --basic-auth USER:PASSWORD Sets up Basic-Authentication -d, --dir /PATH:DIR Mounts a directory to the given PATH -f, --file /PATH:FILE Mounts a file to the given PATH -r, --root DIR Root directory to serve -R, --redirect /PATH:URL Registers a 302 Found redirect at the given PATH -h, --help Print help information
Defined Under Namespace
Classes: App
Instance Method Summary collapse
-
#run ⇒ Object
private
Runs the
ronin-web server
command.
Instance Method Details
#run ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Runs the ronin-web server
command.
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
# File 'lib/ronin/web/cli/commands/server.rb', line 132 def run if [:root] App.public_dir = [:root] else App.any('*') do puts "#{request.request_method} #{request.path}" request.headers.each do |name,value| puts "#{name}: #{value}" end puts request.body.read end end log_info "Starting web server listening on #{App.bind}:#{App.port} ..." begin App.run! rescue Errno::EADDRINUSE => error log_error(error.) exit(1) end log_info "Shutting down ..." end |