Script/server with options

I have hacked a script that I found at http://www.koders.com/ruby into a
generalized webrick startup script. The script is attached to this post
and the help text is reproduced below. “script/server” runs webrick on
port 3000 bound to 0.0.0.0. If that is too general then you can pass a
specific port using -p= or --port=. “script/server -s” runs webrick in
ssl mode and generates a self-signed certificate. The other options are,
I hope, fairly self-explanatory.

script/server
Usage: ruby server [options]
With all defaults runs Webrick in standard http mode
listening on port 3000 for all configured addresses. If
-s | --sslmode then the server will start in https mode
on port 3000 and auto-generate a self-signed certificate.
If --sslauto=off then you must provide a server key
and certificate within the RAILS_ROOT.

-b, --binding=ip                 Binds Rails to the specified ip.
                                 Default: 0.0.0.0 - listen on all

addresses
-c, --charset=charset Set default charset for output.
Default: UTF-8
-d, --daemon Make Rails run as a Daemon (only
works
if fork is available – meaning on *nix).
-e, --environment=name Specifies the environment to run
this
server under (test/development/production).
Default: development
-h, --help Print this help text.
-m, --mime-types=filename Specifies an Apache style
mime.types
configuration file to be used for mime types
Default: none
-p, --port=port Runs Rails on the specified port.
Default: 3000
–sslcert=/path/to/certificate
For SSL (https) operation pass the
server
certificate file location relative to RAILS_ROOT.
default: /config/ssl/server.key
–sslkey=/path/to/key For SSL (https) operation pass the
server
key file location relative to RAILS_ROOT.
default: /config/ssl/server.key
-s, --sslmode Run server in SSL (https) mode.
–sslroot=/path/to/root_cert For SSL (https) operation pass the
Certificate Authority root file location relative to
RAILS_ROOT.
default:
/config/ssl/rails_root_ca.crt
–sslself=on|off Generate self-signed SSL
certificate.
Default: on

And as soon as I reviewed this online I noticed an error in the banner.
Here is the corrected script and help text:

script/server
Usage: ruby server [options]
With all defaults runs Webrick in standard http mode
listening on port 3000 for all configured addresses. If
-s | --sslmode then the server will start in https mode
on port 3000 and auto-generate a self-signed certificate.
If --sslself=off then you must provide a server key
and certificate within the RAILS_ROOT.

        ...

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs