Sha256: 8250377f25acd97ee2b50e2095928cea17e0a6abb05d11e8062ddcdc4e2d95ff

Contents?: true

Size: 740 Bytes

Versions: 1

Compression:

Stored size: 740 Bytes

Contents

module Percheron
  class Unit
    module ImageHelper
      def image_name
        '%s:%s' % [ image_repo, image_version.to_s ] if image_repo && image_version
      end

      def image_repo
        if !buildable?
          unit_config.docker_image.split(':')[0]
        elsif pseudo?
          pseudo_full_name
        else
          full_name
        end
      end

      def image_version
        if buildable?
          unit_config.version
        elsif !unit_config.docker_image.nil?
          unit_config.docker_image.split(':')[1] || 'latest'
        else
          fail Errors::UnitInvalid, 'Cannot determine image version'
        end
      end

      def image_exists?
        image.nil? ? false : true
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
percheron-0.8.0 lib/percheron/unit/image_helper.rb