Sha256: c1f3b9455dbb507723c3b33afe2442ec3425770c8045f866a708880c7c59aa45

Contents?: true

Size: 997 Bytes

Versions: 35

Compression:

Stored size: 997 Bytes

Contents

# frozen_string_literal: true

require 'eac_docker/images/base'
require 'eac_docker/images/coded'
require 'eac_ruby_utils/core_ext'
require 'eac_ruby_utils/fs/temp'
require 'eac_templates/patches/object/template'

module EacDocker
  module Images
    class Templatized < ::EacDocker::Images::Base
      enable_immutable
      immutable_accessor :tag
      attr_reader :provide_dir

      def id
        tag
      end

      def provide
        ::EacRubyUtils::Fs::Temp.on_directory do |provide_dir|
          begin
            self.provide_dir = provide_dir
            write_in_provide_dir
            coded_image(provide_dir).tag(tag).provide
          ensure
            self.provide_dir = nil
          end
        end
      end

      def coded_image(provide_dir)
        ::EacDocker::Images::Coded.new(provide_dir)
      end

      protected

      def write_in_provide_dir
        template.apply(self, provide_dir)
      end

      private

      attr_writer :provide_dir
    end
  end
end

Version data entries

35 entries across 35 versions & 2 rubygems

Version Path
eac_tools-0.55.4 sub/eac_docker/lib/eac_docker/images/templatized.rb
eac_tools-0.55.3 sub/eac_docker/lib/eac_docker/images/templatized.rb
eac_tools-0.55.2 sub/eac_docker/lib/eac_docker/images/templatized.rb
eac_docker-0.6.0 lib/eac_docker/images/templatized.rb
eac_tools-0.55.1 sub/eac_docker/lib/eac_docker/images/templatized.rb
eac_tools-0.55.0 sub/eac_docker/lib/eac_docker/images/templatized.rb
eac_tools-0.54.0 sub/eac_docker/lib/eac_docker/images/templatized.rb
eac_tools-0.53.0 sub/eac_docker/lib/eac_docker/images/templatized.rb
eac_tools-0.52.0 sub/eac_docker/lib/eac_docker/images/templatized.rb
eac_tools-0.51.0 sub/eac_docker/lib/eac_docker/images/templatized.rb
eac_tools-0.50.0 sub/eac_docker/lib/eac_docker/images/templatized.rb
eac_tools-0.49.0 sub/eac_docker/lib/eac_docker/images/templatized.rb
eac_tools-0.48.1 sub/eac_docker/lib/eac_docker/images/templatized.rb
eac_tools-0.48.0 sub/eac_docker/lib/eac_docker/images/templatized.rb
eac_tools-0.47.2 sub/eac_docker/lib/eac_docker/images/templatized.rb
eac_tools-0.47.1 sub/eac_docker/lib/eac_docker/images/templatized.rb
eac_tools-0.47.0 sub/eac_docker/lib/eac_docker/images/templatized.rb
eac_tools-0.46.0 sub/eac_docker/lib/eac_docker/images/templatized.rb
eac_tools-0.45.2 sub/eac_docker/lib/eac_docker/images/templatized.rb
eac_tools-0.45.1 sub/eac_docker/lib/eac_docker/images/templatized.rb