Module: KCommercial::KCPipeline::KCGit

Included in:
KCommercial::KCPipeline
Defined in:
lib/KCommercialPipeline/core/git.rb

Class Method Summary collapse

Class Method Details

.find_git_path(path = Pathname(Dir.pwd)) ⇒ Object



15
16
17
18
19
20
21
22
23
# File 'lib/KCommercialPipeline/core/git.rb', line 15

def find_git_path(path = Pathname(Dir.pwd))
  find_path = Pathname(path)
  while find_path.parent.to_s != '/' || find_path.to_s != '/'
    aim_path = find_path.join('.git')
    return find_path if aim_path.exist?
    find_path = find_path.parent
  end
  return nil
end

.gitObject



7
8
9
10
11
12
13
# File 'lib/KCommercialPipeline/core/git.rb', line 7

def git
  @git ||= begin
             git_path = find_git_path()
             return nil unless git_path
             git = Git.open(git_path)
           end
end