Module: DocktorRails::Guidance

Defined in:
lib/docktor_rails/guidance.rb

Class Method Summary collapse

Class Method Details

.crlf_hint(platform) ⇒ Object



32
33
34
35
36
37
38
# File 'lib/docktor_rails/guidance.rb', line 32

def self.crlf_hint(platform)
  if platform&.windows?
    "CRLF usually comes from Windows checkouts. Add .gitattributes: '*.sh text eol=lf', then run: git add --renormalize ."
  else
    "Convert scripts to LF and enforce via .gitattributes: '*.sh text eol=lf'"
  end
end

.entrypoint_exec_hint(platform) ⇒ Object



40
41
42
43
44
45
46
# File 'lib/docktor_rails/guidance.rb', line 40

def self.entrypoint_exec_hint(platform)
  if platform&.windows?
    "Executable bit/shebang checks are not meaningful on Windows hosts. Prefer running via WSL2 for Linux-like behavior."
  else
    "Ensure entrypoint scripts are executable (chmod +x) and start with a shebang (e.g. #!/usr/bin/env bash)."
  end
end

.hint_for(result, platform) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/docktor_rails/guidance.rb', line 5

def self.hint_for(result, platform)
  return result.hint if result.hint

  id = result.id
  status = result.status
  return nil if status == :pass

  case id
  when "fs.shell_crlf", "compose.entrypoint_sanity"
    crlf_hint(platform)
  when "compose.healthchecks"
    "Add compose healthchecks so readiness is deterministic across machines (then you can wait on health status instead of sleeps)."
  when "env.rails_master_key"
    "Provide config/master.key (local dev), or set RAILS_MASTER_KEY (CI/prod), or add it to .env.docker."
  when "compose.env_file_present"
    "Ensure each env_file referenced in compose exists (or remove the reference)."
  when "compose.build_paths"
    "Fix compose build paths: ensure build.context directories exist and build.dockerfile paths resolve correctly."
  when "compose.entrypoint_exec"
    entrypoint_exec_hint(platform)
  when "compose.platform_risk"
    "If teammates use different CPU architectures (arm64 vs amd64), consider multi-arch images or removing hard platform pins unless necessary."
  else
    nil
  end
end