Module: Kubes::Core

Extended by:
Memoist
Included in:
Kubes
Defined in:
lib/kubes/core.rb

Instance Method Summary collapse

Instance Method Details

#appObject



5
6
7
# File 'lib/kubes/core.rb', line 5

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

#check_project!Object



40
41
42
43
44
# File 'lib/kubes/core.rb', line 40

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

#configObject



25
26
27
28
# File 'lib/kubes/core.rb', line 25

def config
  Config.instance.load_configs
  Config.instance.config
end

#configure(&block) ⇒ Object



21
22
23
# File 'lib/kubes/core.rb', line 21

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

#deep_merge!(a, b) ⇒ Object

wrapper to ensure we use the same deeper_merge options everywhere



47
48
49
50
# File 'lib/kubes/core.rb', line 47

def deep_merge!(a, b)
  a.deeper_merge!(b, config.merger.options)
  a
end

#envObject



9
10
11
# File 'lib/kubes/core.rb', line 9

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

#extraObject



13
14
15
# File 'lib/kubes/core.rb', line 13

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

#kustomize?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/kubes/core.rb', line 36

def kustomize?
  Kubectl::Kustomize.detect?
end

#loggerObject



31
32
33
# File 'lib/kubes/core.rb', line 31

def logger
  config.logger
end

#rootObject



17
18
19
# File 'lib/kubes/core.rb', line 17

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