class Object

Public Instance Methods

command_systemd(verb) click to toggle source

Execute the systemd verb action and if it fails print the error information

# File lib/mina/unicorn.rb, line 128
def command_systemd verb
  c = %((#{command_systemd_raw(verb)} && #{command_systemd_raw("status")}) || journalctl #{" --user" if is_unicorn_user_installation?} --no-pager _SYSTEMD_INVOCATION_ID=`systemctl #{" --user" if is_unicorn_user_installation?} show -p InvocationID --value #{fetch :unicorn_service_name}`)

  comment c
  command c
end
command_systemd_raw(verb) click to toggle source
# File lib/mina/unicorn.rb, line 123
def command_systemd_raw verb
  return %(systemctl#{" --user" if is_unicorn_user_installation?} #{verb} #{fetch :unicorn_service_name})
end
is_unicorn_user_installation?() click to toggle source
# File lib/mina/unicorn.rb, line 112
def is_unicorn_user_installation?
  case fetch(:unicorn_system_or_user)
  when "user" 
    true
  when "system"
    false
  else
    raise "Undefined unicorn_system_or_user value. Must be 'user' or 'system'."
  end
end
template_path() click to toggle source

Returns the path to the template to use. Depending on whether the internal template was customized.

# File lib/mina/unicorn.rb, line 104
def template_path

  custom_path = File.expand_path("./config/deploy/templates/unicorn.service.erb")
  original_path = File.expand_path("../templates/unicorn.service.erb", __FILE__)
  
  File.exist?(custom_path) ? custom_path : original_path
end
unicorn_elevate() { || ... } click to toggle source
# File lib/mina/unicorn.rb, line 135
def unicorn_elevate 

  user = fetch(:user)
  setup_user = fetch(:setup_user, user)
  if setup_user && setup_user != user
    comment %{Switching to setup_user (#{setup_user})}
    set :user, setup_user
    yield
    set :user, user
  else
    yield
  end

end