module AlfonsoX::Utils

Utils for Alfonso X

Public Class Methods

repo_root() click to toggle source

Returns an absolute path to the root of the repository.

Stolen from Overcommit::Utils#repo_root

We do this ourselves rather than call `git rev-parse –show-toplevel` to solve an issue where the .git directory might not actually be valid in tests.

@return [String] GIT root file path

# File lib/alfonsox/utils.rb, line 20
def repo_root
  result = `git rev-parse --show-toplevel`
  raise 'Not in git repository' unless $CHILD_STATUS.success?
  result.chomp("\n")
end