Class: InitExporter::Helpers::Init::UpstartBackend

Inherits:
BaseBackend
  • Object
show all
Defined in:
lib/init_exporter/helpers/init/upstart_backend.rb

Instance Method Summary collapse

Constructor Details

#initialize(ssh) ⇒ UpstartBackend

Returns a new instance of UpstartBackend.



7
8
9
# File 'lib/init_exporter/helpers/init/upstart_backend.rb', line 7

def initialize(ssh)
  @ssh = ssh
end

Instance Method Details

#dry_run(app_name, procfile_path) ⇒ Object



19
20
21
# 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_typeObject



11
12
13
# File 'lib/init_exporter/helpers/init/upstart_backend.rb', line 11

def init_type
  'upstart'
end

#install(app_name, procfile_path) ⇒ Object



15
16
17
# 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) ⇒ Boolean

Returns:

  • (Boolean)


35
36
37
# 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) ⇒ Object



27
28
29
# 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) ⇒ Object



31
32
33
# 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) ⇒ Object



23
24
25
# 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