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

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

Instance Method Summary collapse

Instance Method Details

#commit_sha1_uncachedObject



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

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



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

def git_reference
  options[:reference] || DEFAULT_REFERENCE
end

#git_reference_found_uncachedObject



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

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



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

def git_remote_hashs_uncached
  git.remote_hashs(git_remote_name)
end

#git_remote_nameObject



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

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

#instance_branchObject



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

def instance_branch
  remote_branch(instance.id)
end

#master_branchObject



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

def master_branch
  remote_branch('master')
end

#remote_branch(name) ⇒ Object



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

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