Class: DevSystem::ZeitwerkShell

Inherits:
Shell show all
Defined in:
lib/dev_system/shells/zeitwerk_shell.rb

Instance Attribute Summary

Attributes inherited from Liza::Controller

#menv

Class Method Summary collapse

Methods inherited from Shell

all, cruby?, engine, jruby?, linux?, mac?, os, ruby_version, unix?, windows?

Methods inherited from Liza::Controller

#`, `, attr_accessor, attr_reader, attr_writer, #attrs, box, #box, call, color, division, division!, division?, inherited, menv_accessor, menv_reader, menv_writer, on_connected, panel, #panel, plural, require, requirements, sh, #sh, singular, subsystem, subsystem!, subsystem?, subsystem_token, token

Methods inherited from Liza::Unit

_erbs_for, #add, add, cl, #cl, class_methods_defined, const_added, const_missing, constants_defined, define_error, descendants_select, division, erbs_available, erbs_defined, erbs_for, errors, #fetch, fetch, get, #get, instance_methods_defined, log, #log, log?, #log?, #log_array, log_array, log_hash, #log_hash, #log_level, log_level, #log_level?, log_level?, log_levels, #log_levels, #log_render_convert, #log_render_format, #log_render_in, #log_render_out, method_added, methods_defined, namespace, part, raise_error, #raise_error, reload!, #reload!, #render, #render!, #render_stack, renderable_formats_for, renderable_names, section, sections, #set, set, #settings, settings, singleton_method_added, sleep, #sleep, stick, #stick, sticks, #sticks, subclasses_select, subunits, system, #system, system?, test_class, time_diff, #time_diff

Class Method Details

.core_loaderObject



90
# File 'lib/dev_system/shells/zeitwerk_shell.rb', line 90

def self.core_loader() = Lizarb.loaders[0]

.get_core_mappingsObject



31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/dev_system/shells/zeitwerk_shell.rb', line 31

def self.get_core_mappings
  ret = {}

  core_loader.__autoloads.each do |path, reference|
    ret[path] = reference
  end
  core_loader.__to_unload.each do |name, (path, reference)|
    ret[path] = reference
  end

  ret
end

.get_main_mappingsObject



44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/dev_system/shells/zeitwerk_shell.rb', line 44

def self.get_main_mappings
  ret = {}

  main_loader.__autoloads.each do |path, reference|
    ret[path] = reference
  end
  main_loader.__to_unload.each do |name, (path, reference)|
    ret[path] = reference
  end

  ret
end

.get_mappings_in_appObject



83
84
85
86
87
88
# File 'lib/dev_system/shells/zeitwerk_shell.rb', line 83

def self.get_mappings_in_app
  s = App.directory.to_s
  ret = get_main_mappings
  ret = ret.select { _1.start_with? s }
  ret
end

.get_mappings_in_system(system) ⇒ Object



76
77
78
79
80
81
# File 'lib/dev_system/shells/zeitwerk_shell.rb', line 76

def self.get_mappings_in_system(system)
  s = system.source_location_radical
  ret = get_main_mappings
  ret = ret.select { _1.start_with? s }
  ret
end

.get_unit_in_app(name) ⇒ Object



66
67
68
69
70
71
72
73
# File 'lib/dev_system/shells/zeitwerk_shell.rb', line 66

def self.get_unit_in_app(name)
  cname = name.to_s.camelcase.to_sym
  mappings = get_mappings_in_app
  references = mappings.values.select { _1.cname == cname }
  references.first.get
rescue NoMethodError
  nil
end

.get_unit_in_system(system, name) ⇒ Object



57
58
59
60
61
62
63
64
# File 'lib/dev_system/shells/zeitwerk_shell.rb', line 57

def self.get_unit_in_system(system, name)
  cname = name.to_s.camelcase.to_sym
  mappings = get_mappings_in_system(system)
  references = mappings.values.select { _1.cname == cname }
  references.first.get
rescue NoMethodError
  nil
end

.get_units_in_appObject



24
25
26
27
28
29
# File 'lib/dev_system/shells/zeitwerk_shell.rb', line 24

def self.get_units_in_app
  s = App.directory.to_s
  ret = get_main_mappings
  ret = ret.select { _1.start_with? s }
  ret.values.map(&:get)
end

.get_units_in_coreObject



3
4
5
# File 'lib/dev_system/shells/zeitwerk_shell.rb', line 3

def self.get_units_in_core
  get_core_mappings.values.map(&:get)
end

.get_units_in_system(system) ⇒ Object



17
18
19
20
21
22
# File 'lib/dev_system/shells/zeitwerk_shell.rb', line 17

def self.get_units_in_system(system)
  s = system.source_location_radical
  ret = get_main_mappings
  ret = ret.select { _1.start_with? s }
  ret.values.map(&:get)
end

.get_units_in_systemsObject



7
8
9
10
11
12
13
14
15
# File 'lib/dev_system/shells/zeitwerk_shell.rb', line 7

def self.get_units_in_systems
  ret = {}

  App.systems.each do |key, system|
    ret[key] = get_units_in_system(system)
  end
  
  ret
end

.main_loaderObject



92
# File 'lib/dev_system/shells/zeitwerk_shell.rb', line 92

def self.main_loader() = Lizarb.loaders[1]