Sha256: dade2c656c67c445734af0d8a86cb8f02997eb50bbc14e1fa6848e675aeac96b

Contents?: true

Size: 1.19 KB

Versions: 12

Compression:

Stored size: 1.19 KB

Contents

# frozen_string_literal: true

module Avm
  module EacWebappBase0
    class Deploy
      module GitInfo
        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

        def git_reference
          options[:reference] || DEFAULT_REFERENCE
        end

        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

        def git_remote_hashs_uncached
          git.remote_hashs(git_remote_name)
        end

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

        def instance_branch
          remote_branch(instance.id)
        end

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

        def master_branch
          remote_branch('master')
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
avm-tools-0.74.1 lib/avm/eac_webapp_base0/deploy/git_info.rb
avm-tools-0.74.0 lib/avm/eac_webapp_base0/deploy/git_info.rb
avm-tools-0.73.0 lib/avm/eac_webapp_base0/deploy/git_info.rb
avm-tools-0.72.0 lib/avm/eac_webapp_base0/deploy/git_info.rb
avm-tools-0.71.0 lib/avm/eac_webapp_base0/deploy/git_info.rb
avm-tools-0.70.2 lib/avm/eac_webapp_base0/deploy/git_info.rb
avm-tools-0.70.1 lib/avm/eac_webapp_base0/deploy/git_info.rb
avm-tools-0.70.0 lib/avm/eac_webapp_base0/deploy/git_info.rb
avm-tools-0.69.3 lib/avm/eac_webapp_base0/deploy/git_info.rb
avm-tools-0.69.2 lib/avm/eac_webapp_base0/deploy/git_info.rb
avm-tools-0.69.1 lib/avm/eac_webapp_base0/deploy/git_info.rb
avm-tools-0.69.0 lib/avm/eac_webapp_base0/deploy/git_info.rb