Module: Avm::EacWebappBase0::Instances::Deploy::Info

Defined in:
lib/avm/eac_webapp_base0/instances/deploy/info.rb

Instance Method Summary collapse

Instance Method Details

#deploy_infoHash

Returns:

  • (Hash)


12
13
14
15
16
17
18
19
20
21
22
# File 'lib/avm/eac_webapp_base0/instances/deploy/info.rb', line 12

def deploy_info
  ::Avm::EacWebappBase0::Instances::DeployInfo.from_hash(
    {
      instance_id: instance.id,
      time: ::Time.now,
      commit_id: commit_reference,
      commit_refs: version_git_refs,
      version: version_number
    }
  )
end

#versionString

Returns:

  • (String)


25
26
27
# File 'lib/avm/eac_webapp_base0/instances/deploy/info.rb', line 25

def version
  deploy_info.to_yaml
end

#version_git_refsObject



29
30
31
32
# File 'lib/avm/eac_webapp_base0/instances/deploy/info.rb', line 29

def version_git_refs
  git_remote_hashs.select { |_name, sha1| sha1 == commit_reference }.keys
    .map { |ref| ref.gsub(%r{\Arefs/}, '') }.reject { |ref| ref == 'HEAD' }
end

#version_numberString?

Returns:

  • (String, nil)


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

def version_number
  instance.application.local_source.version.if_present(&:to_s)
end

#version_target_pathString

Returns:

  • (String)


40
41
42
# File 'lib/avm/eac_webapp_base0/instances/deploy/info.rb', line 40

def version_target_path
  ::Avm::EacWebappBase0::Instances::Base::DeployInfo::DEPLOY_INFO_SUBPATH
end