Class: DocktorRails::Checks::ComposeFilePresent

Inherits:
BaseCheck
  • Object
show all
Defined in:
lib/docktor_rails/checks/compose_file_present.rb

Constant Summary collapse

CANDIDATES =
["compose.yml", "docker-compose.yml"].freeze

Instance Method Summary collapse

Methods inherited from BaseCheck

#name

Instance Method Details

#idObject



10
11
12
# File 'lib/docktor_rails/checks/compose_file_present.rb', line 10

def id
  "compose.file_present"
end

#run(ctx) ⇒ Object



14
15
16
17
18
19
20
21
22
23
# File 'lib/docktor_rails/checks/compose_file_present.rb', line 14

def run(ctx)
  root = ctx.fetch(:root)
  found = CANDIDATES.map { |f| File.join(root, f) }.find { |p| File.file?(p) }

  if found
    pass("Compose file present", files: [relative_to_root(found, root)])
  else
    fail("No compose.yml or docker-compose.yml found", hint: "Add a compose.yml (or docker-compose.yml) at the repo root.")
  end
end