Class: DevSystem::NotFoundBench

Inherits:
Bench show all
Defined in:
lib/dev_system/subsystems/bench/benches/not_found_bench.rb

Instance Attribute Summary

Attributes inherited from Liza::Controller

#menv

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Liza::Controller

#`, `, attr_accessor, attr_reader, attr_writer, #attrs, box, #box, 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

.call(env) ⇒ Object



3
4
5
# File 'lib/dev_system/subsystems/bench/benches/not_found_bench.rb', line 3

def self.call env
  new.call env
end

Instance Method Details

#call(env) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/dev_system/subsystems/bench/benches/not_found_bench.rb', line 7

def call env
  app_shell = AppShell.new
  app_shell.filter_by_unit Bench

  app_shell.filter_out_units SortedBench if defined? SortedBench
  failed_name = env[:bench_name_original]
  app_shell.filter_by_name_including failed_name if failed_name

  outputs(app_shell, failed_name)
end

#outputs(app_shell, failed_name) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/dev_system/subsystems/bench/benches/not_found_bench.rb', line 20

def outputs(app_shell, failed_name)
  domains = app_shell.get_domains.reject(&:empty?)
  log "domains: #{domains.count}"
  puts

  if domains.empty?
    log stick :black, :green, "No results found for '#{failed_name}'"
    app_shell.undo_filter!
    domains = app_shell.get_domains
  end

  domains.each do |domain|
    next if domain.empty?

    if log? :normal
      puts typo.h1 domain.name.snakecase.upcase, domain.color
    end

    puts
    domain.layers.each do |layer|
      next if layer.objects.empty?

      if log? :normal
        m = "h#{layer.level}"
        name = layer.level==1 ? domain.name.to_s.upcase : layer.name.to_s
        puts typo.send m, name, layer.color unless layer.level==3

        puts stick layer.color, layer.path
        puts
      end

      layer.objects.each { print_class _1 }
      puts
    end
  end
end


57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/dev_system/subsystems/bench/benches/not_found_bench.rb', line 57

def print_class klass, description: nil
  return if [NotFoundBench].include? klass

  sidebar_length = Log.panel.sidebar_size
  signature = {}
  signature[:name] = klass.token.to_s
  signature[:description] = "no description"

  puts [
    "liza bench #{signature[:name]}".ljust(sidebar_length),
    (description or signature[:description])
  ].join ""
end

#typoObject



71
# File 'lib/dev_system/subsystems/bench/benches/not_found_bench.rb', line 71

def typo () = TypographyShell