Module: Avm::EacWebappBase0::Instances::Deploy::Scm
- Defined in:
- lib/avm/eac_webapp_base0/instances/deploy/scm.rb
Constant Summary collapse
- DEFAULT_REMOTE_NAME =
'origin'
Instance Method Summary collapse
- #commit_reference_uncached ⇒ Object
- #git_fetch_uncached ⇒ Object
- #git_reference ⇒ Object
- #git_reference_found_uncached ⇒ Object
- #git_remote_hashs_uncached ⇒ Object
- #git_remote_name ⇒ Object
- #git_repository_path ⇒ Object
- #git_uncached ⇒ EacGit::Local
- #instance_branch ⇒ Object
- #master_branch ⇒ Object
- #remote_branch(name) ⇒ Object
- #scm ⇒ Avm::Scms::Base
Instance Method Details
#commit_reference_uncached ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/avm/eac_webapp_base0/instances/deploy/scm.rb', line 10 def commit_reference_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_fetch_uncached ⇒ Object
18 19 20 21 |
# File 'lib/avm/eac_webapp_base0/instances/deploy/scm.rb', line 18 def git_fetch_uncached infom "Fetching remote \"#{git_remote_name}\" from \"#{git_repository_path}\"..." git.remote(git_remote_name).fetch end |
#git_reference ⇒ Object
23 24 25 |
# File 'lib/avm/eac_webapp_base0/instances/deploy/scm.rb', line 23 def git_reference [OPTION_REFERENCE] || DEFAULT_REFERENCE end |
#git_reference_found_uncached ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/avm/eac_webapp_base0/instances/deploy/scm.rb', line 27 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
35 36 37 |
# File 'lib/avm/eac_webapp_base0/instances/deploy/scm.rb', line 35 def git_remote_hashs_uncached git.remote(git_remote_name).ls.hashes end |
#git_remote_name ⇒ Object
39 40 41 |
# File 'lib/avm/eac_webapp_base0/instances/deploy/scm.rb', line 39 def git_remote_name DEFAULT_REMOTE_NAME end |
#git_repository_path ⇒ Object
43 44 45 |
# File 'lib/avm/eac_webapp_base0/instances/deploy/scm.rb', line 43 def git_repository_path instance.source_instance.read_entry(::Avm::Instances::EntryKeys::INSTALL_PATH) end |
#git_uncached ⇒ EacGit::Local
48 49 50 |
# File 'lib/avm/eac_webapp_base0/instances/deploy/scm.rb', line 48 def git_uncached scm.git_repo end |
#instance_branch ⇒ Object
52 53 54 |
# File 'lib/avm/eac_webapp_base0/instances/deploy/scm.rb', line 52 def instance_branch remote_branch(instance.id) end |
#master_branch ⇒ Object
60 61 62 |
# File 'lib/avm/eac_webapp_base0/instances/deploy/scm.rb', line 60 def master_branch remote_branch('master') end |
#remote_branch(name) ⇒ Object
56 57 58 |
# File 'lib/avm/eac_webapp_base0/instances/deploy/scm.rb', line 56 def remote_branch(name) git_remote_hashs.key?("refs/heads/#{name}") ? "#{git_remote_name}/#{name}" : nil end |
#scm ⇒ Avm::Scms::Base
65 66 67 |
# File 'lib/avm/eac_webapp_base0/instances/deploy/scm.rb', line 65 def scm instance.application.local_source.scm end |