Class: Kubes::Autoloader

Inherits:
Object
  • Object
show all
Defined in:
lib/kubes/autoloader.rb

Defined Under Namespace

Classes: Inflector

Class Method Summary collapse

Class Method Details

.kubes_rootObject

Autoloader runs so early that Kubes.root is not available, so we must declare it here



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

def kubes_root
  ENV['KUBES_ROOT'] || '.'
end

.setupObject



13
14
15
16
17
18
19
20
21
22
# File 'lib/kubes/autoloader.rb', line 13

def setup
  loader = Zeitwerk::Loader.new
  loader.inflector = Inflector.new
  loader.push_dir(File.dirname(__dir__)) # lib

  helpers = "#{kubes_root}/.kubes/helpers"
  loader.push_dir(helpers) if File.exist?(helpers) # project helpers

  loader.setup
end