class Capistrano::Cluster::Service

Attributes

name[RW]

Public Class Methods

new(name, &block) click to toggle source
# File lib/capistrano/cluster/service.rb, line 5
def initialize(name, &block)
  @name = name
  instance_eval(&block)
end

Public Instance Methods

log_file(*args) click to toggle source
# File lib/capistrano/cluster/service.rb, line 40
def log_file(*args)
  @log_file = args.first if args.length > 0
  @log_file || "/var/log/service.#{@name}.log"
end
pid_file(*args) click to toggle source
# File lib/capistrano/cluster/service.rb, line 20
def pid_file(*args)
  @pid_file = args.first if args.length > 0
  @pid_file || "/var/run/#{@name}.pid"
end
reload(*args) click to toggle source
# File lib/capistrano/cluster/service.rb, line 25
def reload(*args)
  @reload = args.first if args.length > 0
  @reload || "stop;start"
end
script() click to toggle source
# File lib/capistrano/cluster/service.rb, line 45
def script
  file("service", name: name, start_cmd: start, pid_file: pid_file, working_dir: working_dir, reload_cmd: reload, stop_cmd: stop, user: user)
end
start(*args) click to toggle source
# File lib/capistrano/cluster/service.rb, line 10
def start(*args)
  @start = args.first if args.length > 0
  @start || fail("no start command defined for #{@name}")
end
stop(*args) click to toggle source
# File lib/capistrano/cluster/service.rb, line 30
def stop(*args)
  @stop = args.first if args.length > 0
  @stop || "kill -TERM $(< #{pid_file})"
end
user(*args) click to toggle source
# File lib/capistrano/cluster/service.rb, line 35
def user(*args)
  @user = args.first if args.length > 0
  @user
end
working_dir(*args) click to toggle source
# File lib/capistrano/cluster/service.rb, line 15
def working_dir(*args)
  @working_dir = args.first if args.length > 0
  @working_dir || "/tmp"
end