class Initd::Script

Attributes

daemon[R]
description[R]
path[R]

Public Class Methods

new(path, script, args, user) click to toggle source
# File lib/initd/script.rb, line 9
def initialize(path, script, args, user)
  @path = path
  @daemon = {
      :name => name,
      :script => script,
      :args => args,
      :user => user,
  }
  @description = name
end

Public Instance Methods

content() click to toggle source
# File lib/initd/script.rb, line 28
def content
  template = templates_dir.join('script.erb')
  ERB.new(template.read, nil, '<>').result(binding)
end
name() click to toggle source
# File lib/initd/script.rb, line 20
def name
  @path.basename.to_s
end
pidfile() click to toggle source
# File lib/initd/script.rb, line 24
def pidfile
  Pathname.new('/var/run').join(@daemon[:name]).join("#{@daemon[:name]}.pid")
end
templates_dir() click to toggle source
# File lib/initd/script.rb, line 5
def templates_dir
  Pathname.new(__FILE__).dirname.dirname.dirname.join('templates')
end