Class: CiHelper::Utils

Inherits:
Object
  • Object
show all
Defined in:
lib/ci_helper/utils.rb

Class Method Summary collapse

Class Method Details

.repo_rootObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
# 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