Module: Avm::EacWebappBase0::Deploy::GitInfo
- Defined in:
- lib/avm/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
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_reference ⇒ Object
15 16 17 |
# File 'lib/avm/eac_webapp_base0/deploy/git_info.rb', line 15 def git_reference [:reference] || DEFAULT_REFERENCE end |
#git_reference_found_uncached ⇒ Object
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_uncached ⇒ Object
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_name ⇒ Object
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_branch ⇒ Object
35 36 37 |
# File 'lib/avm/eac_webapp_base0/deploy/git_info.rb', line 35 def instance_branch remote_branch(instance.id) end |
#master_branch ⇒ Object
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 |