lizarb 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (128) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/app/dev_box.rb +24 -4
  4. data/app/happy_box.rb +1 -1
  5. data/app/net/databases/sqlite_db_test.rb +5 -5
  6. data/app/net/records/app_record_test.rb +1 -1
  7. data/app/net/records/post_record_test.rb +1 -1
  8. data/app/net/records/user_record_test.rb +1 -1
  9. data/app/net_box.rb +7 -7
  10. data/app/web_box.rb +2 -2
  11. data/lib/app.rb +1 -1
  12. data/lib/dev_system/dev/controllers/bench/not_found_bench.rb +17 -19
  13. data/lib/dev_system/dev/controllers/bench/not_found_bench_test.rb +9 -11
  14. data/lib/dev_system/dev/controllers/bench.rb +5 -7
  15. data/lib/dev_system/dev/controllers/bench_dsl_main_part.rb +37 -39
  16. data/lib/dev_system/dev/controllers/bench_test.rb +8 -10
  17. data/lib/dev_system/dev/controllers/command/bench_command.rb +20 -22
  18. data/lib/dev_system/dev/controllers/command/bench_command_test.rb +8 -10
  19. data/lib/dev_system/dev/controllers/command/echo_command.rb +5 -7
  20. data/lib/dev_system/dev/controllers/command/echo_command_test.rb +8 -10
  21. data/lib/dev_system/dev/controllers/command/generate_command.rb +20 -22
  22. data/lib/dev_system/dev/controllers/command/generate_command_test.rb +8 -10
  23. data/lib/dev_system/dev/controllers/command/not_found_command.rb +17 -19
  24. data/lib/dev_system/dev/controllers/command/not_found_command_test.rb +8 -10
  25. data/lib/dev_system/dev/controllers/command/terminal_command.rb +12 -14
  26. data/lib/dev_system/dev/controllers/command/terminal_command_test.rb +8 -10
  27. data/lib/dev_system/dev/controllers/command/test_command.rb +64 -53
  28. data/lib/dev_system/dev/controllers/command/test_command_test.rb +8 -10
  29. data/lib/dev_system/dev/controllers/command/version_command.rb +4 -6
  30. data/lib/dev_system/dev/controllers/command/version_command_test.rb +8 -10
  31. data/lib/dev_system/dev/controllers/command.rb +11 -13
  32. data/lib/dev_system/dev/controllers/command_test.rb +8 -10
  33. data/lib/dev_system/dev/controllers/generator.rb +5 -7
  34. data/lib/dev_system/dev/controllers/generator_dsl_main_part.rb +35 -37
  35. data/lib/dev_system/dev/controllers/generator_test.rb +8 -10
  36. data/lib/dev_system/dev/controllers/generators/app_generator.rb +103 -53
  37. data/lib/dev_system/dev/controllers/generators/app_generator_test.rb +8 -10
  38. data/lib/dev_system/dev/controllers/generators/not_found_generator.rb +17 -19
  39. data/lib/dev_system/dev/controllers/generators/not_found_generator_test.rb +8 -10
  40. data/lib/dev_system/dev/controllers/terminal/irb_terminal.rb +11 -13
  41. data/lib/dev_system/dev/controllers/terminal/irb_terminal_test.rb +8 -10
  42. data/lib/dev_system/dev/controllers/terminal/pry_terminal.rb +6 -8
  43. data/lib/dev_system/dev/controllers/terminal/pry_terminal_test.rb +8 -10
  44. data/lib/dev_system/dev/controllers/terminal.rb +11 -13
  45. data/lib/dev_system/dev/controllers/terminal_test.rb +8 -10
  46. data/lib/dev_system/dev/dev_box.rb +33 -16
  47. data/lib/dev_system/dev/dev_box_test.rb +12 -14
  48. data/lib/dev_system/dev/panels/bench_panel.rb +3 -0
  49. data/lib/dev_system/dev/panels/bench_panel_test.rb +12 -0
  50. data/lib/dev_system/dev/panels/command_panel.rb +16 -18
  51. data/lib/dev_system/dev/panels/command_panel_test.rb +15 -17
  52. data/lib/dev_system/dev/panels/generator_panel.rb +3 -0
  53. data/lib/dev_system/dev/panels/generator_panel_test.rb +12 -0
  54. data/lib/dev_system/dev/panels/log_panel.rb +9 -6
  55. data/lib/dev_system/dev/panels/log_panel_test.rb +11 -13
  56. data/lib/dev_system/dev/panels/shell_panel.rb +3 -0
  57. data/lib/dev_system/dev/panels/shell_panel_test.rb +12 -0
  58. data/lib/dev_system/dev/panels/terminal_panel.rb +3 -0
  59. data/lib/dev_system/dev/panels/terminal_panel_test.rb +12 -0
  60. data/lib/happy_system/happy/controllers/axo.rb +4 -5
  61. data/lib/happy_system/happy/happy_box.rb +6 -9
  62. data/lib/happy_system/happy/happy_box_test.rb +11 -13
  63. data/lib/happy_system/happy/panels/axo_panel.rb +1 -3
  64. data/lib/liza/base/box.rb +71 -26
  65. data/lib/liza/base/box_test.rb +7 -9
  66. data/lib/liza/base/controller.rb +19 -21
  67. data/lib/liza/base/controller_test.rb +7 -9
  68. data/lib/liza/base/panel.rb +42 -27
  69. data/lib/liza/base/panel_test.rb +10 -12
  70. data/lib/liza/meta/part.rb +12 -14
  71. data/lib/liza/meta/part_extension.rb +14 -16
  72. data/lib/liza/meta/part_test.rb +4 -6
  73. data/lib/liza/meta/system.rb +12 -14
  74. data/lib/liza/meta/system_test.rb +8 -10
  75. data/lib/liza/ruby_test.rb +4 -6
  76. data/lib/liza/ruby_tests/module_test.rb +1 -1
  77. data/lib/liza/test/test.rb +7 -10
  78. data/lib/liza/test/test_test.rb +158 -159
  79. data/lib/liza/test_parts/test_assertions_advanced_part.rb +102 -104
  80. data/lib/liza/test_parts/test_assertions_part.rb +81 -83
  81. data/lib/liza/test_parts/test_dsl_part.rb +47 -49
  82. data/lib/liza/test_parts/test_log_part.rb +88 -90
  83. data/lib/liza/test_parts/test_subject_part.rb +16 -18
  84. data/lib/liza/test_parts/test_tree_part.rb +105 -107
  85. data/lib/liza/unit.rb +108 -104
  86. data/lib/liza/unit_test.rb +69 -71
  87. data/lib/lizarb/version.rb +1 -1
  88. data/lib/net_system/dev/net_command.rb +10 -12
  89. data/lib/net_system/net/controllers/client/redis_client.rb +19 -21
  90. data/lib/net_system/net/controllers/client/redis_client_test.rb +20 -22
  91. data/lib/net_system/net/controllers/client/sqlite_client.rb +19 -21
  92. data/lib/net_system/net/controllers/client/sqlite_client_test.rb +20 -22
  93. data/lib/net_system/net/controllers/client.rb +1 -3
  94. data/lib/net_system/net/controllers/client_test.rb +8 -10
  95. data/lib/net_system/net/controllers/database/redis_db.rb +6 -8
  96. data/lib/net_system/net/controllers/database/redis_db_test.rb +15 -17
  97. data/lib/net_system/net/controllers/database/sqlite_db.rb +6 -8
  98. data/lib/net_system/net/controllers/database/sqlite_db_test.rb +15 -17
  99. data/lib/net_system/net/controllers/database.rb +21 -23
  100. data/lib/net_system/net/controllers/database_test.rb +8 -10
  101. data/lib/net_system/net/controllers/record.rb +21 -23
  102. data/lib/net_system/net/controllers/record_test.rb +8 -10
  103. data/lib/net_system/net/net_box.rb +11 -16
  104. data/lib/net_system/net/net_box_test.rb +12 -14
  105. data/lib/net_system/net/panels/client_panel.rb +1 -3
  106. data/lib/net_system/net/panels/client_panel_test.rb +11 -13
  107. data/lib/net_system/net/panels/database_panel.rb +6 -8
  108. data/lib/net_system/net/panels/database_panel_test.rb +11 -13
  109. data/lib/web_system/dev/rack_command.rb +26 -17
  110. data/lib/web_system/dev/request_command.rb +2 -2
  111. data/lib/web_system/dev/web_command.rb +6 -8
  112. data/lib/web_system/web/controllers/rack.rb +4 -6
  113. data/lib/web_system/web/controllers/rack_test.rb +11 -13
  114. data/lib/web_system/web/controllers/request/client_error_request.rb +9 -11
  115. data/lib/web_system/web/controllers/request/not_found_request.rb +9 -11
  116. data/lib/web_system/web/controllers/request/server_error_request.rb +10 -12
  117. data/lib/web_system/web/controllers/request.rb +1 -3
  118. data/lib/web_system/web/controllers/request_test.rb +11 -13
  119. data/lib/web_system/web/panels/rack_panel.rb +37 -39
  120. data/lib/web_system/web/panels/rack_panel_test.rb +8 -10
  121. data/lib/web_system/web/panels/request_panel.rb +54 -56
  122. data/lib/web_system/web/panels/request_panel_test.rb +1 -1
  123. data/lib/web_system/web/web_box.rb +14 -18
  124. data/lib/web_system/web/web_box_test.rb +11 -13
  125. metadata +10 -5
  126. data/app_new/.gitignore +0 -4
  127. data/app_new/Gemfile +0 -31
  128. data/app_new/Procfile +0 -3
data/lib/liza/base/box.rb CHANGED
@@ -1,40 +1,85 @@
1
- module Liza
2
- class Box < Unit
3
- inherited_explicitly_sets_system
1
+ class Liza::Box < Liza::Unit
2
+ inherited_explicitly_sets_system
4
3
 
5
- def self.has_panel symbol, panel_name = symbol
6
- system_klass = get :system
7
- panel_class = system_klass.const "#{symbol}_panel"
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
- _has_panel_define panel_name, "get(:panels)[:#{panel_name}]"
8
+ # _has_panel_define panel_name, "get(:panels)[:#{panel_name}]"
10
9
 
11
- panel = panel_class.new panel_name
12
- add :panels, panel_name, panel
10
+ # panel = panel_class.new panel_name
11
+ # add :panels, panel_name, panel
13
12
 
14
- panel_class.on_connected self
15
- end
13
+ # panel_class.on_connected self
14
+ # end
16
15
 
17
- def self.has_controller symbol, panel_name = symbol
18
- system_klass = get :system
19
- controller_class = system_klass.const symbol
16
+ # def self.has_controller symbol, panel_name = symbol
17
+ # system_klass = get :system
18
+ # controller_class = system_klass.const symbol
20
19
 
21
- panel = public_send panel_name
20
+ # panel = public_send panel_name
22
21
 
23
- controller_class.on_connected self, panel
24
- end
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
- def self._has_panel_define name, resource
27
- class_eval <<-CODE, __FILE__, __LINE__ + 1
37
+ # def self._has_panel_define name, resource
38
+ # class_eval <<-CODE, __FILE__, __LINE__ + 1
28
39
 
29
- def self.#{name} &block
30
- if block_given?
31
- #{resource}.instance_eval &block
32
- else
33
- #{resource}
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
- CODE
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
@@ -1,12 +1,10 @@
1
- module Liza
2
- class BoxTest < UnitTest
3
- test :subject_class do
4
- assert subject_class == Liza::Box
5
- end
1
+ class Liza::BoxTest < Liza::UnitTest
2
+ test :subject_class do
3
+ assert subject_class == Liza::Box
4
+ end
6
5
 
7
- test :settings do
8
- assert subject_class.log_level == :normal
9
- assert subject_class.log_color == :white
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
@@ -1,29 +1,27 @@
1
- module Liza
2
- class Controller < Unit
3
- part :controller_renderer
1
+ class Liza::Controller < Liza::Unit
2
+ part :controller_renderer
4
3
 
5
- inherited_explicitly_sets_system
4
+ inherited_explicitly_sets_system
6
5
 
7
- def self.on_connected box_klass, panel
8
- set :box, box_klass
9
- set :panel, panel
10
- end
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
- def self.panel
17
- get :panel
18
- end
11
+ def self.box
12
+ get :box
13
+ end
19
14
 
20
- def box
21
- self.class.box
22
- end
15
+ def self.panel
16
+ get :panel
17
+ end
23
18
 
24
- def panel
25
- self.class.panel
26
- end
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
- module Liza
2
- class ControllerTest < UnitTest
3
- test :subject_class do
4
- assert subject_class == Liza::Controller
5
- end
1
+ class Liza::ControllerTest < Liza::UnitTest
2
+ test :subject_class do
3
+ assert subject_class == Liza::Controller
4
+ end
6
5
 
7
- test :settings do
8
- assert subject_class.log_level == :normal
9
- assert subject_class.log_color == :white
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
@@ -1,39 +1,54 @@
1
- module Liza
2
- class Panel < Unit
3
- inherited_explicitly_sets_system
1
+ class Liza::Panel < Liza::Unit
2
+ inherited_explicitly_sets_system
4
3
 
5
- def self.on_connected box_klass
6
- set :box, box_klass
7
- end
4
+ def self.on_connected box_klass
5
+ set :box, box_klass
6
+ end
8
7
 
9
- def self.box
10
- get :box
11
- end
8
+ def self.box
9
+ get :box
10
+ end
12
11
 
13
- def box
14
- self.class.box
15
- end
12
+ def box
13
+ self.class.box
14
+ end
16
15
 
17
- def initialize name
18
- @name = name
19
- end
16
+ def initialize key
17
+ @key = key
18
+ @blocks = []
19
+ @unstarted = true
20
+ end
20
21
 
21
- def log log_level = :normal, string
22
- raise "invalid log_level `#{log_level}`" unless LOG_LEVELS.keys.include? log_level
23
- return unless log_level? log_level
22
+ def push block
23
+ @unstarted = true
24
+ @blocks.push block
25
+ end
24
26
 
25
- source = box.to_s
27
+ def started
28
+ return self unless defined? @unstarted
29
+ remove_instance_variable :@unstarted
26
30
 
27
- x = source.size
28
- source = source.bold.colorize log_color
31
+ @blocks.each { |bl| instance_eval &bl }
32
+ @blocks.clear
29
33
 
30
- y = source.size
31
- source = "#{source}.#{@name}".ljust(LOG_JUST+y-x)
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
- string = "#{source} #{string}"
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
@@ -1,16 +1,14 @@
1
- module Liza
2
- class PanelTest < UnitTest
3
- test :subject_class do
4
- assert subject_class == Liza::Panel
5
- end
1
+ class Liza::PanelTest < Liza::UnitTest
2
+ test :subject_class do
3
+ assert subject_class == Liza::Panel
4
+ end
6
5
 
7
- def subject
8
- subject_class.new "name"
9
- end
6
+ def subject
7
+ subject_class.new "name"
8
+ end
10
9
 
11
- test :settings do
12
- assert subject_class.log_level == :normal
13
- assert subject_class.log_color == :white
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
@@ -1,19 +1,17 @@
1
- module Liza
2
- class Part < Unit
3
- def self.insertion &block
4
- if block_given?
5
- @insertion = block
6
- else
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
- def self.extension &block
12
- if block_given?
13
- @extension = block
14
- else
15
- @extension
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
- module Liza
2
- class PartExtension
3
- def self.solder
4
- @solder ||=
5
- if first_namespace == "Liza"
6
- Liza.const_get last_namespace[0..-12]
7
- else
8
- Object.const_get name[0..-12]
9
- end
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
- attr_reader :solder
11
+ def initialize solder
12
+ @solder = solder
17
13
  end
18
- end
14
+
15
+ attr_reader :solder
16
+ end
@@ -1,8 +1,6 @@
1
- module Liza
2
- class PartTest < Test
3
- test :subject_class do
4
- assert subject_class == Liza::Part
5
- end
6
-
1
+ class Liza::PartTest < Liza::Test
2
+ test :subject_class do
3
+ assert subject_class == Liza::Part
7
4
  end
5
+
8
6
  end
@@ -1,20 +1,18 @@
1
- module Liza
2
- class System < Unit
1
+ class Liza::System < Liza::Unit
3
2
 
4
- def self.const name
5
- const_get name.to_s.camelize
6
- end
3
+ def self.const name
4
+ const_get name.to_s.camelize
5
+ end
7
6
 
8
- def self.insertion key, &block
9
- if block_given?
10
- registrar[:"insertion_#{key}"] = block
11
- else
12
- registrar[:"insertion_#{key}"]
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
- def self.registrar
17
- @registrar ||= {}
18
- end
15
+ def self.registrar
16
+ @registrar ||= {}
19
17
  end
20
18
  end
@@ -1,13 +1,11 @@
1
- module Liza
2
- class SystemTest < UnitTest
3
- test :subject_class do
4
- assert subject_class == Liza::System
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
@@ -1,9 +1,7 @@
1
- module Liza
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
@@ -7,7 +7,7 @@ class Liza::ModuleTest < Liza::RubyTest
7
7
  test :source_location do
8
8
  assert Object.source_location == []
9
9
 
10
- assert Liza::Command.source_location[1] == 2
10
+ assert Liza::Command.source_location[1] == 1
11
11
  assert AppCommand.source_location[1] == 1
12
12
  end
13
13
 
@@ -1,13 +1,10 @@
1
- module Liza
2
- class Test < Unit
1
+ class Liza::Test < Liza::Unit
3
2
 
4
- part :test_assertions
5
- part :test_assertions_advanced
6
- part :test_dsl
7
- part :test_log
8
- part :test_subject
9
- part :test_tree
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
-