lizarb 1.0.1 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/.tool-versions +1 -0
- data/Gemfile +1 -0
- data/Gemfile.lock +7 -4
- data/README.md +23 -64
- data/README_SYSTEMS.md +80 -0
- data/Rakefile +3 -1
- data/app/dev/benches/loops_bench.rb +35 -0
- data/app/dev/commands/calculator_command.rb +69 -0
- data/app/dev/commands/calculator_command_test.rb +58 -0
- data/app/dev/commands/circle_command.rb +70 -0
- data/app/dev/commands/circle_command_test.rb +76 -0
- data/app/dev/commands/narrative_method_command.rb +60 -0
- data/app/dev/commands/narrative_method_command_test.rb +36 -0
- data/app/dev/commands/quadratic_command.rb +66 -0
- data/app/dev/commands/quadratic_command_test.rb +47 -0
- data/app/dev/generators/bench_generator/bench.rb.erb +24 -0
- data/app/dev/generators/bench_generator/bench_test.rb.erb +12 -0
- data/app/dev/generators/bench_generator.rb +2 -51
- data/app/dev/generators/command_generator/command.rb.erb +26 -0
- data/app/dev/generators/command_generator/command_test.rb.erb +12 -0
- data/app/dev/generators/command_generator.rb +2 -35
- data/app/dev/generators/record_generator.rb +46 -0
- data/app/dev/generators/{model_generator_test.rb → record_generator_test.rb} +2 -2
- data/app/dev_box.rb +24 -4
- data/app/happy_box.rb +1 -1
- data/app/net/databases/sqlite_db_test.rb +5 -5
- data/app/net/{models/app_model.rb → records/app_record.rb} +2 -1
- data/app/net/records/app_record_test.rb +8 -0
- data/app/net/records/post_record.rb +4 -0
- data/app/net/records/post_record_test.rb +8 -0
- data/app/net/records/user_record.rb +4 -0
- data/app/net/records/user_record_test.rb +8 -0
- data/app/net_box.rb +7 -7
- data/app/web/requests/api_request.rb +8 -7
- data/app/web/requests/assets_request.rb +12 -13
- data/app/web/requests/root_request.rb +6 -7
- data/app/web/requests/root_request_test.rb +1 -1
- data/app/web_box.rb +9 -1
- data/exe/lrb +3 -0
- data/lib/app.rb +19 -15
- data/lib/dev_system/dev/controllers/bench/not_found_bench.rb +27 -0
- data/lib/dev_system/dev/controllers/{command/dev_command_test.rb → bench/not_found_bench_test.rb} +3 -5
- data/lib/dev_system/dev/controllers/bench.rb +5 -7
- data/lib/dev_system/dev/controllers/bench_dsl_main_part.rb +37 -39
- data/lib/dev_system/dev/controllers/bench_test.rb +8 -10
- data/lib/dev_system/dev/controllers/command/bench_command.rb +20 -12
- data/lib/dev_system/dev/controllers/command/bench_command_test.rb +8 -10
- data/lib/dev_system/dev/controllers/command/echo_command.rb +5 -7
- data/lib/dev_system/dev/controllers/command/echo_command_test.rb +8 -10
- data/lib/dev_system/dev/controllers/command/generate_command.rb +22 -12
- data/lib/dev_system/dev/controllers/command/generate_command_test.rb +8 -10
- data/lib/dev_system/dev/controllers/command/not_found_command.rb +27 -0
- data/lib/dev_system/dev/controllers/command/not_found_command_test.rb +12 -0
- data/lib/dev_system/dev/controllers/command/terminal_command.rb +22 -0
- data/lib/dev_system/dev/controllers/command/terminal_command_test.rb +12 -0
- data/lib/dev_system/dev/controllers/command/test_command.rb +64 -49
- data/lib/dev_system/dev/controllers/command/test_command_test.rb +8 -10
- data/lib/dev_system/dev/controllers/command/version_command.rb +4 -6
- data/lib/dev_system/dev/controllers/command/version_command_test.rb +8 -10
- data/lib/dev_system/dev/controllers/command.rb +11 -13
- data/lib/dev_system/dev/controllers/command_test.rb +8 -10
- data/lib/dev_system/dev/controllers/generator.rb +5 -7
- data/lib/dev_system/dev/controllers/generator_dsl_main_part.rb +35 -37
- data/lib/dev_system/dev/controllers/generator_test.rb +8 -10
- data/lib/dev_system/dev/controllers/generators/app_generator.rb +122 -47
- data/lib/dev_system/dev/controllers/generators/app_generator_test.rb +8 -10
- data/lib/dev_system/dev/controllers/generators/generator_generator/generator.rb.erb +18 -0
- data/lib/dev_system/dev/controllers/generators/generator_generator/generator_test.rb.erb +12 -0
- data/lib/dev_system/dev/controllers/generators/generator_generator/template.rb.erb +9 -0
- data/lib/dev_system/dev/controllers/generators/generator_generator/template_test.rb.erb +12 -0
- data/lib/dev_system/dev/controllers/generators/generator_generator.rb +30 -0
- data/lib/dev_system/dev/controllers/generators/generator_generator_test.rb +12 -0
- data/lib/dev_system/dev/controllers/generators/not_found_generator.rb +27 -0
- data/lib/dev_system/dev/controllers/generators/not_found_generator_test.rb +12 -0
- data/lib/dev_system/dev/controllers/shell/bin_shell.rb +22 -0
- data/lib/dev_system/dev/controllers/shell/bin_shell_test.rb +87 -0
- data/lib/dev_system/dev/controllers/shell/dir_shell.rb +27 -0
- data/lib/dev_system/dev/controllers/shell/dir_shell_test.rb +73 -0
- data/lib/dev_system/dev/controllers/shell/file_shell.rb +56 -26
- data/lib/dev_system/dev/controllers/shell/file_shell_test.rb +143 -7
- data/lib/dev_system/dev/controllers/shell/text_shell.rb +23 -0
- data/lib/dev_system/dev/controllers/shell/text_shell_test.rb +84 -0
- data/lib/dev_system/dev/controllers/shell.rb +26 -14
- data/lib/dev_system/dev/controllers/shell_test.rb +42 -9
- data/lib/dev_system/dev/controllers/terminal/irb_terminal.rb +11 -13
- data/lib/dev_system/dev/controllers/terminal/irb_terminal_test.rb +8 -10
- data/lib/dev_system/dev/controllers/terminal/pry_terminal.rb +6 -8
- data/lib/dev_system/dev/controllers/terminal/pry_terminal_test.rb +8 -10
- data/lib/dev_system/dev/controllers/terminal.rb +11 -13
- data/lib/dev_system/dev/controllers/terminal_test.rb +8 -10
- data/lib/dev_system/dev/dev_box.rb +33 -16
- data/lib/dev_system/dev/dev_box_test.rb +12 -14
- data/lib/dev_system/dev/panels/bench_panel.rb +3 -0
- data/lib/dev_system/dev/panels/bench_panel_test.rb +12 -0
- data/lib/dev_system/dev/panels/command_panel.rb +24 -6
- data/lib/dev_system/dev/panels/command_panel_test.rb +15 -17
- data/lib/dev_system/dev/panels/generator_panel.rb +3 -0
- data/lib/dev_system/dev/panels/generator_panel_test.rb +12 -0
- data/lib/dev_system/dev/panels/log_panel.rb +9 -6
- data/lib/dev_system/dev/panels/log_panel_test.rb +11 -13
- data/lib/dev_system/dev/panels/shell_panel.rb +3 -0
- data/lib/dev_system/dev/panels/shell_panel_test.rb +12 -0
- data/lib/dev_system/dev/panels/terminal_panel.rb +3 -0
- data/lib/dev_system/dev/panels/terminal_panel_test.rb +12 -0
- data/lib/happy_system/happy/controllers/axo.rb +4 -5
- data/lib/happy_system/happy/happy_box.rb +6 -9
- data/lib/happy_system/happy/happy_box_test.rb +11 -13
- data/lib/happy_system/happy/panels/axo_panel.rb +1 -3
- data/lib/lerb.rb +106 -0
- data/lib/liza/base/box.rb +71 -26
- data/lib/liza/base/box_test.rb +7 -9
- data/lib/liza/base/controller.rb +19 -19
- data/lib/liza/base/controller_test.rb +7 -9
- data/lib/liza/base/panel.rb +40 -24
- data/lib/liza/base/panel_test.rb +10 -12
- data/lib/liza/base_parts/controller_renderer_part.rb +140 -0
- data/lib/liza/base_parts/controller_renderer_part_test.rb +16 -0
- data/lib/liza/meta/part.rb +12 -14
- data/lib/liza/meta/part_extension.rb +14 -11
- data/lib/liza/meta/part_test.rb +4 -6
- data/lib/liza/meta/system.rb +12 -14
- data/lib/liza/meta/system_test.rb +8 -10
- data/lib/liza/ruby_test.rb +7 -0
- data/lib/liza/ruby_tests/module_test.rb +21 -0
- data/lib/liza/ruby_tests/string_test.rb +59 -0
- data/lib/liza/test/test.rb +7 -8
- data/lib/liza/test/test_test.rb +168 -76
- data/lib/liza/test_parts/test_assertions_advanced_part.rb +125 -0
- data/lib/liza/test_parts/test_assertions_part.rb +81 -82
- data/lib/liza/test_parts/test_dsl_part.rb +44 -98
- data/lib/liza/test_parts/test_log_part.rb +122 -0
- data/lib/liza/test_parts/test_subject_part.rb +16 -18
- data/lib/liza/test_parts/test_tree_part.rb +137 -0
- data/lib/liza/unit.rb +108 -102
- data/lib/liza/unit_parts/unit_procedure_part.rb +17 -0
- data/lib/liza/unit_parts/unit_procedure_part_test.rb +65 -0
- data/lib/liza/unit_test.rb +69 -71
- data/lib/liza.rb +5 -0
- data/lib/lizarb/ruby/module.rb +17 -0
- data/lib/lizarb/ruby/string.rb +10 -2
- data/lib/lizarb/version.rb +1 -1
- data/lib/lizarb.rb +24 -2
- data/lib/net_system/dev/net_command.rb +10 -12
- data/lib/net_system/net/controllers/client/redis_client.rb +19 -21
- data/lib/net_system/net/controllers/client/redis_client_test.rb +20 -22
- data/lib/net_system/net/controllers/client/sqlite_client.rb +19 -21
- data/lib/net_system/net/controllers/client/sqlite_client_test.rb +20 -22
- data/lib/net_system/net/controllers/client.rb +1 -3
- data/lib/net_system/net/controllers/client_test.rb +8 -10
- data/lib/net_system/net/controllers/database/redis_db.rb +6 -8
- data/lib/net_system/net/controllers/database/redis_db_test.rb +15 -17
- data/lib/net_system/net/controllers/database/sqlite_db.rb +6 -8
- data/lib/net_system/net/controllers/database/sqlite_db_test.rb +15 -17
- data/lib/net_system/net/controllers/database.rb +21 -23
- data/lib/net_system/net/controllers/database_test.rb +8 -10
- data/lib/net_system/net/controllers/record.rb +29 -0
- data/lib/net_system/net/controllers/record_test.rb +12 -0
- data/lib/net_system/net/net_box.rb +11 -16
- data/lib/net_system/net/net_box_test.rb +12 -14
- data/lib/net_system/net/panels/client_panel.rb +1 -3
- data/lib/net_system/net/panels/client_panel_test.rb +11 -13
- data/lib/net_system/net/panels/database_panel.rb +6 -8
- data/lib/net_system/net/panels/database_panel_test.rb +11 -13
- data/lib/web_system/dev/rack_command.rb +35 -0
- data/lib/web_system/dev/request_command.rb +143 -0
- data/lib/web_system/dev/web_command.rb +6 -39
- data/lib/web_system/web/controllers/rack.rb +6 -0
- data/lib/web_system/web/controllers/rack_test.rb +16 -0
- data/lib/web_system/web/controllers/request/client_error_request.rb +9 -12
- data/lib/web_system/web/controllers/request/not_found_request.rb +9 -12
- data/lib/web_system/web/controllers/request/server_error_request.rb +10 -13
- data/lib/web_system/web/controllers/request.rb +1 -3
- data/lib/web_system/web/controllers/request_test.rb +11 -13
- data/lib/web_system/web/panels/rack_panel.rb +42 -0
- data/lib/web_system/web/panels/rack_panel_test.rb +12 -0
- data/lib/web_system/web/panels/request_panel.rb +54 -37
- data/lib/web_system/web/panels/request_panel_test.rb +28 -9
- data/lib/web_system/web/web_box.rb +16 -8
- data/lib/web_system/web/web_box_test.rb +11 -13
- data/lizarb.gemspec +2 -2
- metadata +76 -28
- data/app/dev/commands/example_command.rb +0 -57
- data/app/dev/commands/example_command_test.rb +0 -43
- data/app/dev/commands/macro_child_command.rb +0 -32
- data/app/dev/commands/macro_child_command_test.rb +0 -7
- data/app/dev/commands/macro_parent_command.rb +0 -70
- data/app/dev/commands/macro_parent_command_test.rb +0 -7
- data/app/dev/commands/my_command.rb +0 -7
- data/app/dev/commands/my_command_test.rb +0 -7
- data/app/dev/generators/model_generator.rb +0 -46
- data/app/net/models/app_model_test.rb +0 -8
- data/app/net/models/post_model.rb +0 -4
- data/app/net/models/post_model_test.rb +0 -8
- data/app/net/models/user_model.rb +0 -4
- data/app/net/models/user_model_test.rb +0 -8
- data/app_new/.gitignore +0 -4
- data/app_new/Gemfile +0 -31
- data/app_new/Procfile +0 -3
- data/lib/dev_system/dev/controllers/command/dev_command.rb +0 -24
- data/lib/liza/test_parts/test_context_part.rb +0 -81
- data/lib/net_system/net/controllers/model.rb +0 -31
- data/lib/net_system/net/controllers/model_test.rb +0 -14
data/lib/liza/base/box_test.rb
CHANGED
@@ -1,12 +1,10 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
end
|
1
|
+
class Liza::BoxTest < Liza::UnitTest
|
2
|
+
test :subject_class do
|
3
|
+
assert subject_class == Liza::Box
|
4
|
+
end
|
6
5
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
end
|
6
|
+
test :settings do
|
7
|
+
assert subject_class.log_level == :normal
|
8
|
+
assert subject_class.log_color == :white
|
11
9
|
end
|
12
10
|
end
|
data/lib/liza/base/controller.rb
CHANGED
@@ -1,27 +1,27 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
inherited_explicitly_sets_system
|
1
|
+
class Liza::Controller < Liza::Unit
|
2
|
+
part :controller_renderer
|
4
3
|
|
5
|
-
|
6
|
-
set :box, box_klass
|
7
|
-
set :panel, panel
|
8
|
-
end
|
4
|
+
inherited_explicitly_sets_system
|
9
5
|
|
10
|
-
|
11
|
-
|
12
|
-
|
6
|
+
def self.on_connected box_klass, panel
|
7
|
+
set :box, box_klass
|
8
|
+
set :panel, panel
|
9
|
+
end
|
13
10
|
|
14
|
-
|
15
|
-
|
16
|
-
|
11
|
+
def self.box
|
12
|
+
get :box
|
13
|
+
end
|
17
14
|
|
18
|
-
|
19
|
-
|
20
|
-
|
15
|
+
def self.panel
|
16
|
+
get :panel
|
17
|
+
end
|
21
18
|
|
22
|
-
|
23
|
-
|
24
|
-
|
19
|
+
def box
|
20
|
+
self.class.box
|
21
|
+
end
|
25
22
|
|
23
|
+
def panel
|
24
|
+
self.class.panel
|
26
25
|
end
|
26
|
+
|
27
27
|
end
|
@@ -1,12 +1,10 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
end
|
1
|
+
class Liza::ControllerTest < Liza::UnitTest
|
2
|
+
test :subject_class do
|
3
|
+
assert subject_class == Liza::Controller
|
4
|
+
end
|
6
5
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
end
|
6
|
+
test :settings do
|
7
|
+
assert subject_class.log_level == :normal
|
8
|
+
assert subject_class.log_color == :white
|
11
9
|
end
|
12
10
|
end
|
data/lib/liza/base/panel.rb
CHANGED
@@ -1,38 +1,54 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
inherited_explicitly_sets_system
|
1
|
+
class Liza::Panel < Liza::Unit
|
2
|
+
inherited_explicitly_sets_system
|
4
3
|
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
def self.on_connected box_klass
|
5
|
+
set :box, box_klass
|
6
|
+
end
|
8
7
|
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
def self.box
|
9
|
+
get :box
|
10
|
+
end
|
12
11
|
|
13
|
-
|
14
|
-
|
15
|
-
|
12
|
+
def box
|
13
|
+
self.class.box
|
14
|
+
end
|
16
15
|
|
17
|
-
|
18
|
-
|
19
|
-
|
16
|
+
def initialize key
|
17
|
+
@key = key
|
18
|
+
@blocks = []
|
19
|
+
@unstarted = true
|
20
|
+
end
|
20
21
|
|
21
|
-
|
22
|
-
|
22
|
+
def push block
|
23
|
+
@unstarted = true
|
24
|
+
@blocks.push block
|
25
|
+
end
|
23
26
|
|
24
|
-
|
27
|
+
def started
|
28
|
+
return self unless defined? @unstarted
|
29
|
+
remove_instance_variable :@unstarted
|
25
30
|
|
26
|
-
|
31
|
+
@blocks.each { |bl| instance_eval &bl }
|
32
|
+
@blocks.clear
|
27
33
|
|
28
|
-
|
34
|
+
self
|
35
|
+
end
|
36
|
+
|
37
|
+
def log log_level = :normal, string
|
38
|
+
raise "invalid log_level `#{log_level}`" unless LOG_LEVELS.keys.include? log_level
|
39
|
+
return unless log_level? log_level
|
29
40
|
|
30
|
-
|
41
|
+
source = box.to_s
|
31
42
|
|
32
|
-
|
43
|
+
x = source.size
|
44
|
+
source = source.bold.colorize log_color
|
33
45
|
|
34
|
-
|
35
|
-
|
46
|
+
y = source.size
|
47
|
+
source = "#{source}[:#{@key}]".ljust(LOG_JUST+y-x)
|
36
48
|
|
49
|
+
string = "#{source} #{string}"
|
50
|
+
|
51
|
+
DevBox[:log].call string
|
37
52
|
end
|
53
|
+
|
38
54
|
end
|
data/lib/liza/base/panel_test.rb
CHANGED
@@ -1,16 +1,14 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
end
|
1
|
+
class Liza::PanelTest < Liza::UnitTest
|
2
|
+
test :subject_class do
|
3
|
+
assert subject_class == Liza::Panel
|
4
|
+
end
|
6
5
|
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
def subject
|
7
|
+
subject_class.new "name"
|
8
|
+
end
|
10
9
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
end
|
10
|
+
test :settings do
|
11
|
+
assert subject_class.log_level == :normal
|
12
|
+
assert subject_class.log_color == :white
|
15
13
|
end
|
16
14
|
end
|
@@ -0,0 +1,140 @@
|
|
1
|
+
class Liza::ControllerRendererPart < Liza::Part
|
2
|
+
|
3
|
+
class Error < Liza::Error; end
|
4
|
+
class RendererNotFound < Error; end
|
5
|
+
class EmptyRenderStack < Error; end
|
6
|
+
|
7
|
+
EMPTY_RENDER_STACK_MESSAGE = <<~STRING
|
8
|
+
You called render without ERB keys,
|
9
|
+
but the render stack is empty.
|
10
|
+
Did you forget to add ERB keys?
|
11
|
+
STRING
|
12
|
+
|
13
|
+
insertion do
|
14
|
+
# EXTENSION
|
15
|
+
|
16
|
+
def self.renderer
|
17
|
+
Liza::ControllerRendererPart::Extension
|
18
|
+
end
|
19
|
+
|
20
|
+
def renderer
|
21
|
+
@renderer ||= self.class.renderer.new self
|
22
|
+
end
|
23
|
+
|
24
|
+
# CLASS
|
25
|
+
|
26
|
+
def self.controller_ancestors
|
27
|
+
ancestors.take_while { |k| k != Liza::Controller }
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.render_paths
|
31
|
+
@render_paths ||= controller_ancestors.map &:source_location_radical
|
32
|
+
end
|
33
|
+
|
34
|
+
def render_paths
|
35
|
+
self.class.render_paths
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.renderers
|
39
|
+
@renderers ||=
|
40
|
+
LERB.load(source_location_radical)
|
41
|
+
.map { |lerb| [lerb.key, lerb] }
|
42
|
+
.to_h
|
43
|
+
end
|
44
|
+
|
45
|
+
# INSTANCE
|
46
|
+
|
47
|
+
def render *keys
|
48
|
+
if keys.any?
|
49
|
+
_log_render_in keys
|
50
|
+
renderer.render keys, binding, self
|
51
|
+
elsif renderer.stack.any?
|
52
|
+
renderer.stack.pop
|
53
|
+
else
|
54
|
+
raise EmptyRenderStack, EMPTY_RENDER_STACK_MESSAGE, caller
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def _log_render_in keys
|
59
|
+
if renderer.stack.any?
|
60
|
+
log "render ↓ #{keys.join ", "}"
|
61
|
+
else
|
62
|
+
log "render #{"→ " * keys.size}#{keys.join ", "}"
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
extension do
|
68
|
+
# CLASS
|
69
|
+
|
70
|
+
def self.log(...)
|
71
|
+
solder.log(...)
|
72
|
+
end
|
73
|
+
|
74
|
+
# INSTANCE
|
75
|
+
|
76
|
+
def log(...)
|
77
|
+
self.class.log(...)
|
78
|
+
end
|
79
|
+
|
80
|
+
def erb_lists
|
81
|
+
@erb_lists ||= []
|
82
|
+
end
|
83
|
+
|
84
|
+
def stack
|
85
|
+
@stack ||= []
|
86
|
+
end
|
87
|
+
|
88
|
+
def render keys, the_binding, receiver
|
89
|
+
erbs = find_erbs_for(keys).to_a
|
90
|
+
|
91
|
+
erbs.reverse.each do |key, erb|
|
92
|
+
t = Time.now
|
93
|
+
s = erb.result the_binding, receiver
|
94
|
+
_log_render_out key, s.length, t.diff
|
95
|
+
s = wrap_comment_tags s, erb if App.mode == :code && erb.tags?
|
96
|
+
stack.push s.strip
|
97
|
+
end
|
98
|
+
|
99
|
+
stack.pop
|
100
|
+
end
|
101
|
+
|
102
|
+
def find_erbs_for keys
|
103
|
+
ret = {}
|
104
|
+
keys.each do |key|
|
105
|
+
key = "#{key}.erb"
|
106
|
+
|
107
|
+
controller = solder.class.controller_ancestors.
|
108
|
+
find { |controller| controller.renderers.has_key? key }
|
109
|
+
|
110
|
+
if controller
|
111
|
+
ret[key] = controller.renderers[key]
|
112
|
+
else
|
113
|
+
raise_renderer_not_found key
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
ret
|
118
|
+
end
|
119
|
+
|
120
|
+
def raise_renderer_not_found key
|
121
|
+
render_paths = solder.render_paths.map { |s| " #{s}/#{"#{key}".red}" }.join
|
122
|
+
raise RendererNotFound, %|Failed to find ERB #{key}
|
123
|
+
Failed to find ERB #{"#{key}".red} in #{solder.class}.render_paths
|
124
|
+
#{render_paths}|
|
125
|
+
end
|
126
|
+
|
127
|
+
def _log_render_out key, length, t
|
128
|
+
if stack.any?
|
129
|
+
log "render #{"↑ #{key}".ljust_blanks 20} with #{length.to_s.rjust_blanks 4} characters in #{t}s"
|
130
|
+
else
|
131
|
+
log "render #{"← #{key}".ljust_blanks 20} with #{length.to_s.rjust_blanks 4} characters in #{t}s"
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
def wrap_comment_tags s, erb
|
136
|
+
"<!-- #{erb.filename.split("/").last}:#{erb.lineno} -->\n#{s}\n<!-- #{erb.filename.split("/").last} -->"
|
137
|
+
end
|
138
|
+
|
139
|
+
end
|
140
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class Liza::ControllerRendererPartTest < Liza::Test
|
2
|
+
|
3
|
+
test :subject_class do
|
4
|
+
assert subject_class == Liza::ControllerRendererPart
|
5
|
+
end
|
6
|
+
|
7
|
+
test :settings do
|
8
|
+
assert subject_class.get(:log_level) == :normal
|
9
|
+
assert subject_class.get(:log_color) == :white
|
10
|
+
assert subject_class.log_level == :normal
|
11
|
+
assert subject_class.log_color == :white
|
12
|
+
|
13
|
+
assert subject_class.settings == {}
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
data/lib/liza/meta/part.rb
CHANGED
@@ -1,19 +1,17 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
@insertion
|
8
|
-
end
|
1
|
+
class Liza::Part < Liza::Unit
|
2
|
+
def self.insertion &block
|
3
|
+
if block_given?
|
4
|
+
@insertion = block
|
5
|
+
else
|
6
|
+
@insertion
|
9
7
|
end
|
8
|
+
end
|
10
9
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
end
|
10
|
+
def self.extension &block
|
11
|
+
if block_given?
|
12
|
+
@extension = block
|
13
|
+
else
|
14
|
+
@extension
|
17
15
|
end
|
18
16
|
end
|
19
17
|
end
|
@@ -1,13 +1,16 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
1
|
+
class Liza::PartExtension
|
2
|
+
def self.solder
|
3
|
+
@solder ||=
|
4
|
+
if first_namespace == "Liza"
|
5
|
+
Liza.const_get last_namespace[0..-12]
|
6
|
+
else
|
7
|
+
Object.const_get name[0..-12]
|
8
|
+
end
|
9
|
+
end
|
10
10
|
|
11
|
-
|
11
|
+
def initialize solder
|
12
|
+
@solder = solder
|
12
13
|
end
|
13
|
-
|
14
|
+
|
15
|
+
attr_reader :solder
|
16
|
+
end
|
data/lib/liza/meta/part_test.rb
CHANGED
data/lib/liza/meta/system.rb
CHANGED
@@ -1,20 +1,18 @@
|
|
1
|
-
|
2
|
-
class System < Unit
|
1
|
+
class Liza::System < Liza::Unit
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
def self.const name
|
4
|
+
const_get name.to_s.camelize
|
5
|
+
end
|
7
6
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
end
|
7
|
+
def self.insertion key, &block
|
8
|
+
if block_given?
|
9
|
+
registrar[:"insertion_#{key}"] = block
|
10
|
+
else
|
11
|
+
registrar[:"insertion_#{key}"]
|
14
12
|
end
|
13
|
+
end
|
15
14
|
|
16
|
-
|
17
|
-
|
18
|
-
end
|
15
|
+
def self.registrar
|
16
|
+
@registrar ||= {}
|
19
17
|
end
|
20
18
|
end
|
@@ -1,13 +1,11 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
end
|
6
|
-
|
7
|
-
test :settings do
|
8
|
-
assert subject_class.log_level == :normal
|
9
|
-
assert subject_class.log_color == :white
|
10
|
-
end
|
1
|
+
class Liza::SystemTest < Liza::UnitTest
|
2
|
+
test :subject_class do
|
3
|
+
assert subject_class == Liza::System
|
4
|
+
end
|
11
5
|
|
6
|
+
test :settings do
|
7
|
+
assert subject_class.log_level == :normal
|
8
|
+
assert subject_class.log_color == :white
|
12
9
|
end
|
10
|
+
|
13
11
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class Liza::ModuleTest < Liza::RubyTest
|
2
|
+
|
3
|
+
test :subject_class do
|
4
|
+
assert subject_class == Module
|
5
|
+
end
|
6
|
+
|
7
|
+
test :source_location do
|
8
|
+
assert Object.source_location == []
|
9
|
+
|
10
|
+
assert Liza::Command.source_location[1] == 1
|
11
|
+
assert AppCommand.source_location[1] == 1
|
12
|
+
end
|
13
|
+
|
14
|
+
test :source_location_radical do
|
15
|
+
assert Object.source_location_radical == nil
|
16
|
+
|
17
|
+
assert Liza::Command.source_location_radical.end_with? "/lib/dev_system/dev/controllers/command"
|
18
|
+
assert AppCommand.source_location_radical.end_with? "/app/dev/commands/app_command"
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
class Liza::StringTest < Liza::RubyTest
|
2
|
+
|
3
|
+
test :subject_class do
|
4
|
+
assert subject_class == String
|
5
|
+
end
|
6
|
+
|
7
|
+
test :initializers do
|
8
|
+
s0 = String.new
|
9
|
+
s1 = ''
|
10
|
+
s2 = ""
|
11
|
+
|
12
|
+
assert s0.class == String
|
13
|
+
assert s1.class == String
|
14
|
+
assert s2.class == String
|
15
|
+
end
|
16
|
+
|
17
|
+
test :lpartition do
|
18
|
+
todo "write examples"
|
19
|
+
end
|
20
|
+
|
21
|
+
test :rpartition do
|
22
|
+
todo "write examples"
|
23
|
+
end
|
24
|
+
|
25
|
+
test :camelcase do
|
26
|
+
assert "" == "".camelcase
|
27
|
+
assert "A" == "a".camelcase
|
28
|
+
assert "Ab" == "ab".camelcase
|
29
|
+
assert "AbC" == "ab_c".camelcase
|
30
|
+
assert "AbCd" == "ab_cd".camelcase
|
31
|
+
assert "Ab" == "ab_".camelcase
|
32
|
+
assert "Cd" == "_cd".camelcase
|
33
|
+
end
|
34
|
+
|
35
|
+
test :snakecase do
|
36
|
+
assert "" == "".snakecase
|
37
|
+
assert "a" == "A".snakecase
|
38
|
+
assert "ab" == "Ab".snakecase
|
39
|
+
assert "ab_c" == "AbC".snakecase
|
40
|
+
assert "ab_cd" == "AbCd".snakecase
|
41
|
+
end
|
42
|
+
|
43
|
+
test :rjust_blanks do
|
44
|
+
todo "write examples"
|
45
|
+
end
|
46
|
+
|
47
|
+
test :rjust_zeroes do
|
48
|
+
todo "write examples"
|
49
|
+
end
|
50
|
+
|
51
|
+
test :ljust_blanks do
|
52
|
+
todo "write examples"
|
53
|
+
end
|
54
|
+
|
55
|
+
test :ljust_zeroes do
|
56
|
+
todo "write examples"
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
data/lib/liza/test/test.rb
CHANGED
@@ -1,11 +1,10 @@
|
|
1
|
-
|
2
|
-
class Test < Unit
|
1
|
+
class Liza::Test < Liza::Unit
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
3
|
+
part :test_assertions
|
4
|
+
part :test_assertions_advanced
|
5
|
+
part :test_dsl
|
6
|
+
part :test_log
|
7
|
+
part :test_subject
|
8
|
+
part :test_tree
|
8
9
|
|
9
|
-
end
|
10
10
|
end
|
11
|
-
|