Class: Kdep::Doctor::CheckAncestorIgnoresState

Inherits:
Check
  • Object
show all
Defined in:
lib/kdep/doctor/check_ancestor_ignores_state.rb

Constant Summary collapse

ID =
"ancestor_ignores_state".freeze

Instance Attribute Summary

Attributes inherited from Check

#deploy_dir

Instance Method Summary collapse

Methods inherited from Check

#initialize

Constructor Details

This class inherits a constructor from Kdep::Doctor::Check

Instance Method Details

#runObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/kdep/doctor/check_ancestor_ignores_state.rb', line 9

def run
  state_path = File.join(deploy_dir, Kdep::State::FILENAME)
  _, status = Open3.capture2("git", "check-ignore", "-v", state_path)
  if status.success?
    Result.new(
      id: ID, severity: :error,
      message: "An ancestor .gitignore is ignoring #{state_path}",
      hint: "Run 'git check-ignore -v #{state_path}' to find which file, then remove the pattern."
    )
  else
    Result.ok(ID)
  end
rescue Errno::ENOENT
  Result.ok(ID)
end