class InitExporter::Helpers::Init::UpstartBackend

Public Class Methods

new(ssh) click to toggle source
# File lib/init_exporter/helpers/init/upstart_backend.rb, line 7
def initialize(ssh)
  @ssh = ssh
end

Public Instance Methods

dry_run(app_name, procfile_path) click to toggle source
# File lib/init_exporter/helpers/init/upstart_backend.rb, line 19
def dry_run(app_name, procfile_path)
  init_exporter_installed? ? super : true
end
init_type() click to toggle source
# File lib/init_exporter/helpers/init/upstart_backend.rb, line 11
def init_type
  'upstart'
end
install(app_name, procfile_path) click to toggle source
# File lib/init_exporter/helpers/init/upstart_backend.rb, line 15
def install(app_name, procfile_path)
  init_exporter_installed? ? super : run_upstart_exporter(app_name, '-p', procfile_path)
end
running?(job_name) click to toggle source
# File lib/init_exporter/helpers/init/upstart_backend.rb, line 35
def running?(job_name)
  @ssh.test :sudo, "/sbin/initctl status #{job_name} | grep start"
end
start(job_name) click to toggle source
# File lib/init_exporter/helpers/init/upstart_backend.rb, line 27
def start(job_name)
  @ssh.execute :sudo, 'start', job_name
end
stop(job_name) click to toggle source
# File lib/init_exporter/helpers/init/upstart_backend.rb, line 31
def stop(job_name)
  @ssh.execute :sudo, 'stop', job_name
end
uninstall(app_name, procfile_path) click to toggle source
# File lib/init_exporter/helpers/init/upstart_backend.rb, line 23
def uninstall(app_name, procfile_path)
  init_exporter_installed? ? super : run_upstart_exporter(app_name, '-c')
end

Private Instance Methods

init_exporter_installed?() click to toggle source
# File lib/init_exporter/helpers/init/upstart_backend.rb, line 41
def init_exporter_installed?
  @ssh.test 'which', 'init-exporter'
end
run_upstart_exporter(app_name, *args) click to toggle source
# File lib/init_exporter/helpers/init/upstart_backend.rb, line 45
def run_upstart_exporter(app_name, *args)
  @ssh.execute :sudo, 'upstart-export', '-n', app_name, *args
end