lizarb 1.0.2 → 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/Gemfile.lock +1 -1
- 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/records/app_record_test.rb +1 -1
- data/app/net/records/post_record_test.rb +1 -1
- data/app/net/records/user_record_test.rb +1 -1
- data/app/net_box.rb +7 -7
- data/app/web_box.rb +2 -2
- data/lib/app.rb +1 -1
- data/lib/dev_system/dev/controllers/bench/not_found_bench.rb +17 -19
- data/lib/dev_system/dev/controllers/bench/not_found_bench_test.rb +9 -11
- 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 -22
- 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 +20 -22
- data/lib/dev_system/dev/controllers/command/generate_command_test.rb +8 -10
- data/lib/dev_system/dev/controllers/command/not_found_command.rb +17 -19
- data/lib/dev_system/dev/controllers/command/not_found_command_test.rb +8 -10
- data/lib/dev_system/dev/controllers/command/terminal_command.rb +12 -14
- data/lib/dev_system/dev/controllers/command/terminal_command_test.rb +8 -10
- data/lib/dev_system/dev/controllers/command/test_command.rb +64 -53
- 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 +103 -53
- data/lib/dev_system/dev/controllers/generators/app_generator_test.rb +8 -10
- data/lib/dev_system/dev/controllers/generators/not_found_generator.rb +17 -19
- data/lib/dev_system/dev/controllers/generators/not_found_generator_test.rb +8 -10
- 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 +16 -18
- 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/liza/base/box.rb +71 -26
- data/lib/liza/base/box_test.rb +7 -9
- data/lib/liza/base/controller.rb +19 -21
- data/lib/liza/base/controller_test.rb +7 -9
- data/lib/liza/base/panel.rb +42 -27
- data/lib/liza/base/panel_test.rb +10 -12
- data/lib/liza/meta/part.rb +12 -14
- data/lib/liza/meta/part_extension.rb +14 -16
- 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 +4 -6
- data/lib/liza/ruby_tests/module_test.rb +1 -1
- data/lib/liza/test/test.rb +7 -10
- data/lib/liza/test/test_test.rb +158 -159
- data/lib/liza/test_parts/test_assertions_advanced_part.rb +102 -104
- data/lib/liza/test_parts/test_assertions_part.rb +81 -83
- data/lib/liza/test_parts/test_dsl_part.rb +47 -49
- data/lib/liza/test_parts/test_log_part.rb +88 -90
- data/lib/liza/test_parts/test_subject_part.rb +16 -18
- data/lib/liza/test_parts/test_tree_part.rb +105 -107
- data/lib/liza/unit.rb +108 -104
- data/lib/liza/unit_test.rb +69 -71
- data/lib/lizarb/version.rb +1 -1
- 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 +21 -23
- data/lib/net_system/net/controllers/record_test.rb +8 -10
- 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 +26 -17
- data/lib/web_system/dev/request_command.rb +2 -2
- data/lib/web_system/dev/web_command.rb +6 -8
- data/lib/web_system/web/controllers/rack.rb +4 -6
- data/lib/web_system/web/controllers/rack_test.rb +11 -13
- data/lib/web_system/web/controllers/request/client_error_request.rb +9 -11
- data/lib/web_system/web/controllers/request/not_found_request.rb +9 -11
- data/lib/web_system/web/controllers/request/server_error_request.rb +10 -12
- 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 +37 -39
- data/lib/web_system/web/panels/rack_panel_test.rb +8 -10
- data/lib/web_system/web/panels/request_panel.rb +54 -56
- data/lib/web_system/web/panels/request_panel_test.rb +1 -1
- data/lib/web_system/web/web_box.rb +14 -18
- data/lib/web_system/web/web_box_test.rb +11 -13
- metadata +10 -5
- data/app_new/.gitignore +0 -4
- data/app_new/Gemfile +0 -31
- data/app_new/Procfile +0 -3
data/lib/liza/base/box.rb
CHANGED
@@ -1,40 +1,85 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
inherited_explicitly_sets_system
|
1
|
+
class Liza::Box < Liza::Unit
|
2
|
+
inherited_explicitly_sets_system
|
4
3
|
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
# def self.has_panel symbol, panel_name = symbol
|
5
|
+
# system_klass = get :system
|
6
|
+
# panel_class = system_klass.const "#{symbol}_panel"
|
8
7
|
|
9
|
-
|
8
|
+
# _has_panel_define panel_name, "get(:panels)[:#{panel_name}]"
|
10
9
|
|
11
|
-
|
12
|
-
|
10
|
+
# panel = panel_class.new panel_name
|
11
|
+
# add :panels, panel_name, panel
|
13
12
|
|
14
|
-
|
15
|
-
|
13
|
+
# panel_class.on_connected self
|
14
|
+
# end
|
16
15
|
|
17
|
-
|
18
|
-
|
19
|
-
|
16
|
+
# def self.has_controller symbol, panel_name = symbol
|
17
|
+
# system_klass = get :system
|
18
|
+
# controller_class = system_klass.const symbol
|
20
19
|
|
21
|
-
|
20
|
+
# panel = public_send panel_name
|
22
21
|
|
23
|
-
|
24
|
-
|
22
|
+
# controller_class.on_connected self, panel
|
23
|
+
# end
|
24
|
+
|
25
|
+
# def self.method_missing symbol, *args, &block
|
26
|
+
# if panels.has_key? symbol
|
27
|
+
# panels[symbol]
|
28
|
+
# else
|
29
|
+
# super
|
30
|
+
# end
|
31
|
+
# end
|
32
|
+
|
33
|
+
# def self.respond_to_missing? symbol, include_private = false
|
34
|
+
# get(:panels).keys.include?(symbol) || super
|
35
|
+
# end
|
25
36
|
|
26
|
-
|
27
|
-
|
37
|
+
# def self._has_panel_define name, resource
|
38
|
+
# class_eval <<-CODE, __FILE__, __LINE__ + 1
|
28
39
|
|
29
|
-
def self.#{name} &block
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
40
|
+
# def self.#{name} &block
|
41
|
+
# if block_given?
|
42
|
+
# #{resource}.instance_eval &block
|
43
|
+
# else
|
44
|
+
# #{resource}
|
45
|
+
# end
|
46
|
+
# end
|
47
|
+
|
48
|
+
# CODE
|
49
|
+
# end
|
50
|
+
|
51
|
+
def self.panels
|
52
|
+
get :panels
|
53
|
+
end
|
54
|
+
|
55
|
+
def self.[] symbol
|
56
|
+
panels[symbol].started
|
34
57
|
end
|
35
|
-
end
|
36
58
|
|
37
|
-
|
59
|
+
def self.panel symbol, panel_class = nil, &block
|
60
|
+
raise ArgumentError, "block required" unless block_given?
|
61
|
+
|
62
|
+
system_class = get :system
|
63
|
+
panel_class ||= system_class.const "#{symbol}_panel"
|
64
|
+
|
65
|
+
if Hash(get :panels).has_key? symbol
|
66
|
+
panel = panels[symbol]
|
67
|
+
else
|
68
|
+
panel_class.on_connected self
|
69
|
+
panel = panel_class.new symbol
|
70
|
+
add :panels, symbol, panel
|
38
71
|
end
|
72
|
+
|
73
|
+
panel.push block
|
39
74
|
end
|
75
|
+
|
76
|
+
def self.has_controller symbol, panel_name = symbol
|
77
|
+
system_klass = get :system
|
78
|
+
controller_class = system_klass.const symbol
|
79
|
+
|
80
|
+
panel = self[panel_name]
|
81
|
+
|
82
|
+
controller_class.on_connected self, panel
|
83
|
+
end
|
84
|
+
|
40
85
|
end
|
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,29 +1,27 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
part :controller_renderer
|
1
|
+
class Liza::Controller < Liza::Unit
|
2
|
+
part :controller_renderer
|
4
3
|
|
5
|
-
|
4
|
+
inherited_explicitly_sets_system
|
6
5
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
def self.box
|
13
|
-
get :box
|
14
|
-
end
|
6
|
+
def self.on_connected box_klass, panel
|
7
|
+
set :box, box_klass
|
8
|
+
set :panel, panel
|
9
|
+
end
|
15
10
|
|
16
|
-
|
17
|
-
|
18
|
-
|
11
|
+
def self.box
|
12
|
+
get :box
|
13
|
+
end
|
19
14
|
|
20
|
-
|
21
|
-
|
22
|
-
|
15
|
+
def self.panel
|
16
|
+
get :panel
|
17
|
+
end
|
23
18
|
|
24
|
-
|
25
|
-
|
26
|
-
|
19
|
+
def box
|
20
|
+
self.class.box
|
21
|
+
end
|
27
22
|
|
23
|
+
def panel
|
24
|
+
self.class.panel
|
28
25
|
end
|
26
|
+
|
29
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,39 +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
|
-
|
23
|
-
|
22
|
+
def push block
|
23
|
+
@unstarted = true
|
24
|
+
@blocks.push block
|
25
|
+
end
|
24
26
|
|
25
|
-
|
27
|
+
def started
|
28
|
+
return self unless defined? @unstarted
|
29
|
+
remove_instance_variable :@unstarted
|
26
30
|
|
27
|
-
|
28
|
-
|
31
|
+
@blocks.each { |bl| instance_eval &bl }
|
32
|
+
@blocks.clear
|
29
33
|
|
30
|
-
|
31
|
-
|
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
|
40
|
+
|
41
|
+
source = box.to_s
|
32
42
|
|
33
|
-
|
34
|
-
|
35
|
-
DevBox.logs.call string
|
36
|
-
end
|
43
|
+
x = source.size
|
44
|
+
source = source.bold.colorize log_color
|
37
45
|
|
46
|
+
y = source.size
|
47
|
+
source = "#{source}[:#{@key}]".ljust(LOG_JUST+y-x)
|
48
|
+
|
49
|
+
string = "#{source} #{string}"
|
50
|
+
|
51
|
+
DevBox[:log].call string
|
38
52
|
end
|
53
|
+
|
39
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
|
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,18 +1,16 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
end
|
11
|
-
|
12
|
-
def initialize solder
|
13
|
-
@solder = solder
|
14
|
-
end
|
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
|
15
10
|
|
16
|
-
|
11
|
+
def initialize solder
|
12
|
+
@solder = solder
|
17
13
|
end
|
18
|
-
|
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
|
data/lib/liza/ruby_test.rb
CHANGED
@@ -1,9 +1,7 @@
|
|
1
|
-
|
2
|
-
class RubyTest < Test
|
3
|
-
|
4
|
-
def self.subject_class
|
5
|
-
@subject_class ||= Object.const_get last_namespace[0..-5]
|
6
|
-
end
|
1
|
+
class Liza::RubyTest < Liza::Test
|
7
2
|
|
3
|
+
def self.subject_class
|
4
|
+
@subject_class ||= Object.const_get last_namespace[0..-5]
|
8
5
|
end
|
6
|
+
|
9
7
|
end
|
data/lib/liza/test/test.rb
CHANGED
@@ -1,13 +1,10 @@
|
|
1
|
-
|
2
|
-
class Test < Unit
|
1
|
+
class Liza::Test < Liza::Unit
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
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
|
10
9
|
|
11
|
-
end
|
12
10
|
end
|
13
|
-
|