Class: PleaseRun::Platform::Systemd

Inherits:
Base
  • Object
show all
Defined in:
lib/pleaserun/platform/systemd.rb

Overview

The platform implementation for systemd.

If you use Fedora 18+ or CentOS/RHEL 7+, this is for you.

Instance Method Summary collapse

Methods inherited from Base

#initialize, #platform, #render, #render_template, #safe_filename, #sysv_log, #sysv_log_directory?, #template_path

Methods included from MustacheMethods

#escaped, #escaped_args, #quoted, #shell_args, #shell_continuation, #shell_quote

Methods included from Configurable

#configurable_setup, included, #validate

Constructor Details

This class inherits a constructor from PleaseRun::Platform::Base

Instance Method Details

#filesObject



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/pleaserun/platform/systemd.rb', line 8

def files
  begin
    # TODO(sissel): Make it easy for subclasses to extend validation on attributes.
    insist { program } =~ /^\//
  rescue Insist::Failure
    raise PleaseRun::Configurable::ValidationError, "In systemd, the program must be a full path. You gave '#{program}'."
  end

  return Enumerator::Generator.new do |enum|
    enum.yield(safe_filename("/lib/systemd/system/{{{ name }}}.service"), render_template("program.service"))
    enum.yield(safe_filename("/lib/systemd/system/{{{ name }}}-prestart.sh"), render_template("prestart.sh"), 0755) if prestart
  end
end

#install_actionsObject

def files



22
23
24
# File 'lib/pleaserun/platform/systemd.rb', line 22

def install_actions
  return ["systemctl --system daemon-reload"]
end