Module: InitExporter::Helpers::Init
- Defined in:
- lib/init_exporter/helpers/init.rb,
lib/init_exporter/helpers/init/base_backend.rb,
lib/init_exporter/helpers/init/systemd_backend.rb,
lib/init_exporter/helpers/init/upstart_backend.rb
Defined Under Namespace
Classes: BaseBackend, SystemdBackend, UpstartBackend
Class Method Summary
collapse
Class Method Details
.all_procfiles ⇒ Object
29
30
31
32
33
34
35
36
|
# File 'lib/init_exporter/helpers/init.rb', line 29
def all_procfiles
@all_procfiles ||= begin
list_procfiles.map do |path|
stage, role = extract_stage_and_role(path)
{stage: stage, role: role, path: path}
end
end
end
|
.application_init_name(application, role) ⇒ Object
19
20
21
22
23
|
# File 'lib/init_exporter/helpers/init.rb', line 19
def application_init_name(application, role)
suffix = role.to_s == 'all' ? '' : "_#{role}"
application.tr('-', '_').gsub(/\W/, '') + suffix
end
|
.detect_backend(ssh) ⇒ Object
.init_job_name(application, role) ⇒ Object
25
26
27
|
# File 'lib/init_exporter/helpers/init.rb', line 25
def init_job_name(application, role)
init_job_prefix + application_init_name(application, role)
end
|
.init_roles ⇒ Object
52
53
54
|
# File 'lib/init_exporter/helpers/init.rb', line 52
def init_roles
known_procfiles.map { |p| p[:role] }.uniq
end
|
.known_procfiles ⇒ Object
38
39
40
41
42
|
# File 'lib/init_exporter/helpers/init.rb', line 38
def known_procfiles
all_procfiles.reject do |p|
p[:stage] == :unknown || p[:role] == :unknown
end
end
|
.procfile_exists?(stage, role) ⇒ Boolean
44
45
46
|
# File 'lib/init_exporter/helpers/init.rb', line 44
def procfile_exists?(stage, role)
all_procfiles.find { |p| p[:stage] == stage && p[:role] == role }
end
|
.procfiles_for(stage) ⇒ Object
48
49
50
|
# File 'lib/init_exporter/helpers/init.rb', line 48
def procfiles_for(stage)
known_procfiles.select { |p| p[:stage] == stage }
end
|