Class: InitExporter::Helpers::Init::UpstartBackend
- Inherits:
-
BaseBackend
- Object
- BaseBackend
- InitExporter::Helpers::Init::UpstartBackend
- Defined in:
- lib/init_exporter/helpers/init/upstart_backend.rb
Instance Method Summary collapse
- #dry_run(app_name, procfile_path) ⇒ Object
- #init_type ⇒ Object
-
#initialize(ssh) ⇒ UpstartBackend
constructor
A new instance of UpstartBackend.
- #install(app_name, procfile_path) ⇒ Object
- #running?(job_name) ⇒ Boolean
- #start(job_name) ⇒ Object
- #stop(job_name) ⇒ Object
- #uninstall(app_name, procfile_path) ⇒ Object
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_type ⇒ Object
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
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 |