Sha256: 7812f2091510343ec15a2f48bff3e767b7567da63aa571bb0ada59f919bc5a09

Contents?: true

Size: 720 Bytes

Versions: 11

Compression:

Stored size: 720 Bytes

Contents

require "base64"

module Kubes::Compiler::Shared
  module Helpers
    extend Kubes::Compiler::Dsl::Core::Fields
    fields "name"

    def built_image
      return @options[:image] if @options[:image] # override

      path = Kubes.config.state.docker_image_path
      unless File.exist?(path)
        raise "Missing file with docker image built by kubes: #{path}. Try first running: kubes docker build"
      end
      IO.read(path)
    end

    def with_extra(value)
      [value, extra].compact.join('-')
    end

    def extra
      extra = ENV['KUBES_EXTRA']
      extra&.strip&.empty? ? nil : extra # if blank string then also return nil
    end

    def base64(v)
      Base64.encode64(v).strip
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
kubes-0.4.1 lib/kubes/compiler/shared/helpers.rb
kubes-0.4.0 lib/kubes/compiler/shared/helpers.rb
kubes-0.3.5 lib/kubes/compiler/shared/helpers.rb
kubes-0.3.4 lib/kubes/compiler/shared/helpers.rb
kubes-0.3.3 lib/kubes/compiler/shared/helpers.rb
kubes-0.3.2 lib/kubes/compiler/shared/helpers.rb
kubes-0.3.1 lib/kubes/compiler/shared/helpers.rb
kubes-0.3.0 lib/kubes/compiler/shared/helpers.rb
kubes-0.2.6 lib/kubes/compiler/shared/helpers.rb
kubes-0.2.5 lib/kubes/compiler/shared/helpers.rb
kubes-0.2.4 lib/kubes/compiler/shared/helpers.rb