class CiHelper::Utils

Public Class Methods

repo_root() click to toggle source
# File lib/ci_helper/utils.rb, line 3
def self.repo_root
  @repo_root ||=
      begin
        # TODO : understand the code here
        git_dir = Pathname.new(File.expand_path('.')).enum_for(:ascend).find do |path|
          File.exist?(File.join(path, '.git'))
        end

        unless git_dir
          raise CiHelper::Exceptions::InvalidGitRepo, 'no .git directory found'
        end
        git_dir.to_s
      end
end