Sha256: 8cdecd246e68865f05575e66aa7c53d55833a747c0db6fd0c3ac15c6c66b8ab0

Contents?: true

Size: 1.05 KB

Versions: 7

Compression:

Stored size: 1.05 KB

Contents

module Kubes
  module Core
    extend Memoist

    def app
      ENV['KUBES_APP'] unless ENV['KUBES_APP'].blank?
    end

    def env
      ENV['KUBES_ENV'].blank? ? "dev" : ENV['KUBES_ENV']
    end

    def extra
      ENV['KUBES_EXTRA'] unless ENV['KUBES_EXTRA'].blank?
    end

    def root
      ENV['KUBES_ROOT'] || Dir.pwd
    end

    def configure(&block)
      Config.instance.configure(&block)
    end

    def config
      Config.instance.load_configs
      Config.instance.config
    end
    memoize :config

    def logger
      config.logger
    end
    memoize :logger

    def kustomize?
      Kubectl::Kustomize.detect?
    end

    def check_project!
      return if File.exist?("#{Kubes.root}/.kubes/config.rb")
      logger.error "ERROR: It doesnt look like this is a kubes project. Are you sure you are in a kubes project?".color(:red)
      ENV['KUBES_TEST'] ? raise : exit(1)
    end

    # wrapper to ensure we use the same deeper_merge options everywhere
    def deep_merge!(a, b)
      a.deeper_merge!(b, config.merger.options)
      a
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
kubes-0.9.3 lib/kubes/core.rb
kubes-0.9.2 lib/kubes/core.rb
kubes-0.9.1 lib/kubes/core.rb
kubes-0.9.0 lib/kubes/core.rb
kubes-0.8.10 lib/kubes/core.rb
kubes-0.8.9 lib/kubes/core.rb
kubes-0.8.8 lib/kubes/core.rb