module Luban::Deployment::Service::Worker::Base
Public Instance Methods
control_file_dir()
click to toggle source
# File lib/luban/deployment/cli/service/worker.rb, line 73 def control_file_dir; @control_file_dir ||= ""; end
control_file_name()
click to toggle source
# File lib/luban/deployment/cli/service/worker.rb, line 79 def control_file_name @control_file_name ||= "#{service_name}.conf" end
control_file_path()
click to toggle source
# File lib/luban/deployment/cli/service/worker.rb, line 75 def control_file_path @control_file_path ||= control_path.join(control_file_name) end
control_path()
click to toggle source
# File lib/luban/deployment/cli/service/worker.rb, line 69 def control_path @control_path ||= profile_path.join(control_file_dir) end
log_file_name()
click to toggle source
# File lib/luban/deployment/cli/service/worker.rb, line 53 def log_file_name @log_file_name ||= "#{service_name}.log" end
log_file_path()
click to toggle source
# File lib/luban/deployment/cli/service/worker.rb, line 49 def log_file_path @log_file_path ||= log_path.join(log_file_name) end
log_path()
click to toggle source
# File lib/luban/deployment/cli/service/worker.rb, line 45 def log_path @log_path ||= shared_path.join('log') end
output_redirection(output)
click to toggle source
# File lib/luban/deployment/cli/service/worker.rb, line 18 def output_redirection(output) case output when :stdout "2>&1" when nil "> /dev/null 2>&1" when "" "" else ">> #{output} 2>&1" end end
pid_file_name()
click to toggle source
# File lib/luban/deployment/cli/service/worker.rb, line 65 def pid_file_name @pid_file_name ||= "#{service_name}.pid" end
pid_file_path()
click to toggle source
# File lib/luban/deployment/cli/service/worker.rb, line 61 def pid_file_path @pid_file_path ||= pids_path.join(pid_file_name) end
pids_path()
click to toggle source
# File lib/luban/deployment/cli/service/worker.rb, line 57 def pids_path @pids_path ||= shared_path.join('pids') end
profile_name()
click to toggle source
# File lib/luban/deployment/cli/service/worker.rb, line 35 def profile_name; service_name; end
profile_path()
click to toggle source
# File lib/luban/deployment/cli/service/worker.rb, line 41 def profile_path @profile_path ||= shared_path.join('profile', profile_name) end
service_entry()
click to toggle source
# File lib/luban/deployment/cli/service/worker.rb, line 37 def service_entry @service_entry ||= "#{env_name.gsub('/', '.')}.#{profile_name}" end
shell_command(cmd, setup: shell_setup, prefix: shell_prefix, output: shell_output, delimiter: shell_delimiter)
click to toggle source
# File lib/luban/deployment/cli/service/worker.rb, line 11 def shell_command(cmd, setup: shell_setup, prefix: shell_prefix, output: shell_output, delimiter: shell_delimiter) cmd = "#{prefix.join(' ')} #{cmd}" unless prefix.empty? cmd = "#{setup.join(' ' + delimiter + ' ')} #{delimiter} #{cmd}" unless setup.empty? "#{cmd} #{output_redirection(output)}" end
shell_delimiter()
click to toggle source
# File lib/luban/deployment/cli/service/worker.rb, line 9 def shell_delimiter; @shell_delimiter ||= ';'; end
shell_output()
click to toggle source
# File lib/luban/deployment/cli/service/worker.rb, line 8 def shell_output; @shell_output ||= :stdout; end
shell_prefix()
click to toggle source
# File lib/luban/deployment/cli/service/worker.rb, line 7 def shell_prefix; @shell_prefix ||= []; end
shell_setup()
click to toggle source
# File lib/luban/deployment/cli/service/worker.rb, line 6 def shell_setup; @shell_setup ||= ["source #{envrc_file}"]; end