Module: Avm::Stereotypes::EacWebappBase0::Deploy::GitInfo

Defined in:
lib/avm/stereotypes/eac_webapp_base0/deploy/git_info.rb

Instance Method Summary collapse

Instance Method Details

#commit_sha1_uncachedObject



8
9
10
11
12
13
14
# File 'lib/avm/stereotypes/eac_webapp_base0/deploy/git_info.rb', line 8

def commit_sha1_uncached
  git_fetch
  r = git.rev_parse(git_reference_found)
  return r if r

  raise ::Avm::Result::Error, "No commit SHA1 found for \"#{git_reference_found}\""
end

#git_referenceObject



16
17
18
# File 'lib/avm/stereotypes/eac_webapp_base0/deploy/git_info.rb', line 16

def git_reference
  options[:reference] || DEFAULT_REFERENCE
end

#git_reference_found_uncachedObject



20
21
22
23
24
25
26
# File 'lib/avm/stereotypes/eac_webapp_base0/deploy/git_info.rb', line 20

def git_reference_found_uncached
  %w[git_reference instance_branch master_branch].map { |b| send(b) }.find(&:present?) ||
    raise(
      ::Avm::Result::Error,
      'No git reference found (Searched for option, instance and master)'
    )
end

#git_remote_hashs_uncachedObject



28
29
30
# File 'lib/avm/stereotypes/eac_webapp_base0/deploy/git_info.rb', line 28

def git_remote_hashs_uncached
  git.remote_hashs(git_remote_name)
end

#git_remote_nameObject



32
33
34
# File 'lib/avm/stereotypes/eac_webapp_base0/deploy/git_info.rb', line 32

def git_remote_name
  ::Avm::Git::DEFAULT_REMOTE_NAME
end

#instance_branchObject



36
37
38
# File 'lib/avm/stereotypes/eac_webapp_base0/deploy/git_info.rb', line 36

def instance_branch
  remote_branch(instance.id)
end

#master_branchObject



44
45
46
# File 'lib/avm/stereotypes/eac_webapp_base0/deploy/git_info.rb', line 44

def master_branch
  remote_branch('master')
end

#remote_branch(name) ⇒ Object



40
41
42
# File 'lib/avm/stereotypes/eac_webapp_base0/deploy/git_info.rb', line 40

def remote_branch(name)
  git_remote_hashs.key?("refs/heads/#{name}") ? "#{git_remote_name}/#{name}" : nil
end