Module: Launch
- Defined in:
- lib/launch/webrick.rb,
lib/launch.rb,
lib/launch/job.rb,
lib/launch/errors.rb,
lib/launch/version.rb,
ext/launch.c
Overview
Launch::WEBrickHTTPServer adds launchd support to WEBrick.
To use, replace WEBrick::HTTPServer with Launch::WEBrickHTTPServer.
By default Launch::WEBrickHTTPServer expects to find the socket list under
'WEBrickSockets' but this may be overridden through the
:LaunchdSockets option.
The server will automatically shut down when a TERM signal is sent. If you wish to perform other shutdown actions override TERM but be sure to shut down webrick.
An example WEBrick server using Launch::WEBrickHTTPServer would be:
require 'launch/webrick'
Launch::WEBrickHTTPServer.new(:DocumentRoot => ARGV.shift).start
Here is an example plist for this server which listens on port 8000:
Defined Under Namespace
Modules: Messages Classes: Error, InvalidJob, Job, JobAlreadyExists, JobError, UnknownJob, WEBrickHTTPServer
Constant Summary collapse
- VERSION =
"2.0.0"
Class Method Summary collapse
Class Method Details
.jobs ⇒ Object
9 10 11 |
# File 'lib/launch.rb', line 9 def jobs (Messages::GETJOBS).values.map(&Job.method(:from_launch)) end |
.message(obj) ⇒ Object
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
# File 'ext/launch.c', line 141 static VALUE (VALUE self, VALUE obj) { VALUE result = Qnil; launch_data_t item, response; item = ruby_to_launch_data(obj); if (item == NULL) rb_raise(rb_cLaunchError, "item is nil"); response = launch_msg(item); launch_data_free(item); if (response == NULL) rb_sys_fail("launch");\ result = launch_data_to_ruby(response); launch_data_free(response); return result; } |