Class: Dapp::GitRepo::Own

Inherits:
Base
  • Object
show all
Defined in:
lib/dapp/git_repo/own.rb

Overview

Own Git repo

Instance Attribute Summary

Attributes inherited from Base

#dimg, #name

Instance Method Summary collapse

Methods inherited from Base

#branch, #cleanup!, #commit_at, #diff, #file_exist_in_tree?, #git_bare

Constructor Details

#initialize(dimg) ⇒ Own

Returns a new instance of Own.



5
6
7
# File 'lib/dapp/git_repo/own.rb', line 5

def initialize(dimg)
  super(dimg, 'own')
end

Instance Method Details

#container_pathObject



9
10
11
# File 'lib/dapp/git_repo/own.rb', line 9

def container_path
  dimg.container_dapp_path('own', "#{name}.git")
end

#latest_commit(branch = nil) ⇒ Object



19
20
21
# File 'lib/dapp/git_repo/own.rb', line 19

def latest_commit(branch = nil)
  super(branch || 'HEAD')
end

#lookup_commit(commit) ⇒ Object



23
24
25
26
27
# File 'lib/dapp/git_repo/own.rb', line 23

def lookup_commit(commit)
  super
rescue Rugged::OdbError => _e
  raise Error::Rugged, code: :commit_not_found_in_local_git_repository, data: { commit: commit }
end

#pathObject



13
14
15
16
17
# File 'lib/dapp/git_repo/own.rb', line 13

def path
  @path ||= Rugged::Repository.discover(dimg.home_path.to_s).path
rescue Rugged::RepositoryError => _e
  raise Error::Rugged, code: :local_git_repository_does_not_exist
end