Module: Avm::Stereotypes::EacWebappBase0::Deploy::GitInfo
- Defined in:
- lib/avm/stereotypes/eac_webapp_base0/deploy/git_info.rb
Instance Method Summary collapse
- #commit_sha1_uncached ⇒ Object
- #git_reference ⇒ Object
- #git_reference_found_uncached ⇒ Object
- #git_remote_hashs_uncached ⇒ Object
- #git_remote_name ⇒ Object
- #instance_branch ⇒ Object
- #master_branch ⇒ Object
- #remote_branch(name) ⇒ Object
Instance Method Details
#commit_sha1_uncached ⇒ Object
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_reference ⇒ Object
16 17 18 |
# File 'lib/avm/stereotypes/eac_webapp_base0/deploy/git_info.rb', line 16 def git_reference [:reference] || DEFAULT_REFERENCE end |
#git_reference_found_uncached ⇒ Object
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_uncached ⇒ Object
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_name ⇒ Object
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_branch ⇒ Object
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_branch ⇒ Object
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 |