Sha256: 98a8d2e13fd9231871b13fe76a236625a4fa5740a7cf4a5cdea467317997e770

Contents?: true

Size: 1.56 KB

Versions: 69

Compression:

Stored size: 1.56 KB

Contents

# frozen_string_literal: true

require 'avm/version'
require 'eac_ruby_utils/core_ext'
require 'eac_docker/images/templatized'

module Avm
  module Docker
    class Image < ::EacDocker::Images::Templatized
      attr_reader :registry
      attr_accessor :snapshot
      attr_accessor :version

      def initialize(registry)
        @registry = registry
        self.snapshot = true
        self.version = true
      end

      def build(extra_args = [])
        nyi "Extra args: #{extra_args}" if extra_args.any?

        provide
      end

      def generator_version
        ::Avm::VERSION
      end

      def push
        ::EacDocker::Executables.docker.command.append(['push', tag]).system!
      end

      def read_entry(path, options = {})
        method = path.gsub('.', '_')
        return send(method) if respond_to?(path, true)
        return instance.read_entry(path, options) if respond_to?(:instance)

        raise "Method \"#{method}\" not found for entry \"#{path}\""
      end

      def run(instance)
        run_run(instance) if container_exist?(instance)
      end

      def tag
        r = tag_name
        r += ":#{tag_version}" if tag_version.present?
        r
      end

      def tag_name
        return registry.name if registry.name.present?

        raise 'Registry name is blank'
      end

      def tag_version
        [tag_version_version, stereotype_tag].reject(&:blank?).join('_')
      end

      def tag_version_version
        return nil unless version

        r = generator_version
        r += '-snapshot' if snapshot
        r
      end
    end
  end
end

Version data entries

69 entries across 69 versions & 3 rubygems

Version Path
avm-0.27.0 lib/avm/docker/image.rb
eac_tools-0.9.0 sub/avm/lib/avm/docker/image.rb
avm-0.26.0 lib/avm/docker/image.rb
eac_tools-0.8.0 sub/avm/lib/avm/docker/image.rb
eac_tools-0.7.0 sub/avm/lib/avm/docker/image.rb
avm-0.25.0 lib/avm/docker/image.rb
eac_tools-0.6.0 sub/avm/lib/avm/docker/image.rb
eac_tools-0.5.0 sub/avm/lib/avm/docker/image.rb
avm-0.24.0 lib/avm/docker/image.rb
eac_tools-0.4.0 sub/avm/lib/avm/docker/image.rb
eac_tools-0.3.0 sub/avm/lib/avm/docker/image.rb
eac_tools-0.2.2 sub/avm/lib/avm/docker/image.rb
avm-0.23.0 lib/avm/docker/image.rb
avm-0.22.0 lib/avm/docker/image.rb
avm-tools-0.120.0 sub/avm/lib/avm/docker/image.rb
avm-0.21.0 lib/avm/docker/image.rb
avm-tools-0.119.0 sub/avm/lib/avm/docker/image.rb
avm-0.20.0 lib/avm/docker/image.rb
avm-tools-0.118.0 sub/avm/lib/avm/docker/image.rb
avm-tools-0.117.3 sub/avm/lib/avm/docker/image.rb