Module: RunitServiceHelper

Defined in:
lib/runit_service_helper.rb

Overview

This module provides an easy method to create service directories in your application and have them populated with runner scripts.

The methods are available through service. in your deploy.rb

Instance Method Summary collapse

Instance Method Details

#add(service_name, runner_options = {}, logger_options = {}) ⇒ Object

Adds a service to the applications service directory and creates run and log/run scripts

If no runner or logger options are passed, looks for a runner template called <service_name>_runner and a log runner template called <service_name>_log_runner. These should be in the templates directory set with runner_template_path in your deploy.rb.

  • If the runner template does not exist an exception will be raised
  • If the logger template does not exist the standard logger template will be used.

If you want to use your own template or a string containing rhtml pass a :template option to the appropriate options hash.

The default options will be passed through to the template as described in RunitRunnerHelper#create



26
27
28
29
30
# File 'lib/runit_service_helper.rb', line 26

def add(service_name, runner_options = {}, logger_options = {})
  make_service_dir service_name
  create_service(service_name, runner_options)
  create_service(service_name, logger_options.merge(:log_runner => true))
end

#service_dir(service_name) ⇒ Object

Returns the full path to the service directory given a service name. Doesn't check the service name is valid.



34
35
36
# File 'lib/runit_service_helper.rb', line 34

def service_dir(service_name)
  "#{configuration.service_root}/#{configuration.service_dir}/#{service_name}"
end