Class: DevSystem::TestCommand
Instance Attribute Summary
#menv
Instance Method Summary
collapse
#after, #ask?, #default_args, #default_booleans, #default_strings, #given_args, #given_booleans, #given_strings, #input_args, #input_booleans, #input_strings, #set_arg, #set_boolean, #set_default_arg, #set_default_array, #set_default_boolean, #set_default_string, #set_input_arg, #set_input_array, #set_input_boolean, #set_input_string, #set_string, #simple_arg, #simple_arg_ask, #simple_arg_ask_snakecase, #simple_args, #simple_args_from_2, #simple_array, #simple_boolean, #simple_boolean_yes, #simple_booleans, #simple_color, #simple_controller_placement, #simple_string, #simple_strings
Methods inherited from BaseCommand
#action_method_name, #action_name, #after, #around, #call, call, #env, get_command_signatures, #not_found, typo, #typo
Methods inherited from Command
get_command_signatures
#`, `, 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
Instance Method Details
#_call_counting(app_shell) ⇒ Object
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
# File 'lib/dev_system/commands/test_command.rb', line 66
def _call_counting(app_shell)
puts
Liza.log ""
Liza.log stick :b, :black, :white, " TEST TOTALS ".center(120, "-")
Liza.log ""
puts
totals = Hash.new { 0 }
last_namespace = nil
app_shell.get_domains.each do |domain|
next if domain.empty?
puts
puts typo.h1 domain.name.to_s, domain.color, length: 120
puts
domain.layers.each do |layer|
next if layer.objects.empty?
m = "h#{layer.level}"
puts typo.send m, layer.name.to_s, layer.color, length: 120 unless layer.level == 1
puts stick layer.color, layer.path
puts
layer.objects.each do |object|
object.totals.each do |k, v|
totals[k] += v.size
end
size = 60 - object.to_s.size
total_line = object.totals.map do |k, v|
s = "#{k}: #{v.size}"
s = ":#{k} => #{v.size.to_s.rjust 2}"
s = stick :b, :white, :light_red, s if k==:errors && v.size.positive?
s = stick :b, :black, :light_yellow, s if k==:fails && v.size.positive?
s = stick :b, :white, :light_blue, s if k==:todos && v.size.positive?
s = stick :b, :light_green, s if k==:passes && v.size.positive?
s
end
total_line = "{ #{ total_line.join(", ") } }"
Liza.log "#{typo.color_class object}#{" " * size} #{total_line}"
end
puts
end
end
puts
totals_line = totals.map do |k, v|
s = "#{k}: #{v}"
s = ":#{k} => #{v.to_s.rjust 2}"
s = stick :b, :white, :light_red, s if k==:errors && v.positive?
s = stick :b, :black, :light_yellow, s if k==:fails && v.positive?
s = stick :b, :white, :light_blue, s if k==:todos && v.positive?
s = stick :b, :black, :light_green, s if k==:passes && v.positive?
s
end
totals_line = "{ #{ totals_line.join(", ") } }"
Liza.log "#{"Total".ljust 60} #{totals_line}"
puts
end
|
#_call_silence_other_units ⇒ Object
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
# File 'lib/dev_system/commands/test_command.rb', line 42
def _call_silence_other_units
[
Liza::Part,
Liza::System,
Liza::Box,
Liza::Panel,
Liza::Controller,
].each do |x|
x.class_eval do
def self.log(...) super(...) if self == TestCommand end
def self.puts(...) super(...) if self == TestCommand end
def log(...) super(...) if self.class == TestCommand end
def puts(...) super(...) if self.class == TestCommand end
end
end
end
|
#_call_testing(test_classes) ⇒ Object
59
60
61
62
63
64
|
# File 'lib/dev_system/commands/test_command.rb', line 59
def _call_testing test_classes
i, count = 0, test_classes.count
for test_class in test_classes
test_class.call i+=1, count
end
end
|
#build_filters ⇒ Object
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
|
# File 'lib/dev_system/commands/test_command.rb', line 124
def build_filters
app_shell = AppShell.new
app_shell.filter_by_unit Liza::Test
domains = simple_array(:domains)
log "domains = #{domains}"
app_shell.filter_by_domains domains
case simple_args.count
when 0
log "No filter"
when 1
name = simple_args[0]
log "Filter by name starting with #{name}"
app_shell.filter_by_starting_with name
else
case simple_args[0]
when "all"
log "Filter by all names"
app_shell.filter_by_including_all_names simple_args[1..]
else
app_shell.filter_by_including_any_name simple_args
end
end
app_shell
end
|
#call_default ⇒ Object
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/dev_system/commands/test_command.rb', line 16
def call_default
Lizarb.eager_load!
DevBox[:log]. 60
_call_silence_other_units
now = Time.now
app_shell = build_filters
set_input_boolean :run do |default|
InputShell.yes? "Do you want to run the tests?", default: default
end
should_run = simple_boolean(:run)
test_classes = app_shell.get_lists.flatten
log "Testing #{test_classes}"
_call_testing test_classes if should_run
log "Done Testing (#{now.diff}s)"
puts
log "Counting #{test_classes.count} Test Classes"
_call_counting app_shell
log "Done Counting (#{now.diff}s)"
end
|