lizarb 1.0.3 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (457) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +34 -7
  3. data/Gemfile.lock +179 -18
  4. data/README.md +53 -9
  5. data/Rakefile +38 -0
  6. data/app/dev/commands/color_command.rb +29 -0
  7. data/app/dev/commands/color_command_test.rb +10 -0
  8. data/app/dev/commands/stick_command.rb +102 -0
  9. data/app/dev/commands/stick_command_test.rb +19 -0
  10. data/app/dev_box.rb +54 -20
  11. data/app/happy_box.rb +4 -3
  12. data/app/net/databases/redis_db.rb +1 -1
  13. data/app/net/databases/redis_db_test.rb +5 -5
  14. data/app/net/databases/sqlite_db.rb +1 -1
  15. data/app/net/databases/sqlite_db_test.rb +5 -5
  16. data/app/net/records/app_record.rb +1 -1
  17. data/app/net/records/app_record_test.rb +1 -1
  18. data/app/net/records/post_record_test.rb +1 -1
  19. data/app/net/records/user_record_test.rb +1 -1
  20. data/app/net_box.rb +29 -6
  21. data/app/web/requests/app_request.rb +1 -1
  22. data/app/web/requests/app_request_test.rb +1 -1
  23. data/app/web/requests/foo_request.rb +26 -0
  24. data/app/web/requests/foo_request_test.rb +7 -0
  25. data/app/web_box.rb +17 -9
  26. data/app.rb +41 -10
  27. data/{exe/Gemfile → app_global.gemfile.rb} +2 -0
  28. data/app_global.gemfile.rb.lock +41 -0
  29. data/app_global.rb +5 -0
  30. data/{app → examples/bench/app}/dev/benches/loops_bench.rb +11 -3
  31. data/examples/bench/app/dev/benches/loops_bench_test.rb +11 -0
  32. data/examples/bench/app/dev/benches/objects_bench.rb +48 -0
  33. data/examples/bench/app/dev/benches/objects_bench_test.rb +11 -0
  34. data/examples/bench/app/dev/benches/sorted_bench.rb +74 -0
  35. data/examples/bench/app/dev/benches/sorted_bench_test.rb +11 -0
  36. data/examples/bench/app/dev/benches/variables_bench.rb +61 -0
  37. data/examples/bench/app/dev/benches/variables_bench_test.rb +11 -0
  38. data/examples/client/app/net/clients/news_client.rb +42 -0
  39. data/examples/client/app/net/clients/news_client_test.rb +24 -0
  40. data/{app → examples/command/app}/dev/commands/calculator_command.rb +2 -2
  41. data/{app → examples/command/app}/dev/commands/calculator_command_test.rb +1 -2
  42. data/{app → examples/command/app}/dev/commands/circle_command.rb +2 -2
  43. data/{app → examples/command/app}/dev/commands/circle_command_test.rb +1 -2
  44. data/{app → examples/command/app}/dev/commands/narrative_method_command.rb +8 -10
  45. data/{app → examples/command/app}/dev/commands/narrative_method_command_test.rb +2 -3
  46. data/{app → examples/command/app}/dev/commands/quadratic_command.rb +2 -2
  47. data/{app → examples/command/app}/dev/commands/quadratic_command_test.rb +1 -2
  48. data/examples/command/app/dev_box.rb +3 -0
  49. data/examples/log/app/dev/logs/logger_log.rb +8 -0
  50. data/examples/log/app/dev/logs/logger_log_test.rb +16 -0
  51. data/examples/new/app/dev_box.rb +67 -0
  52. data/examples/new/app.rb +41 -0
  53. data/examples/shell/app/dev/shells/bash_adapter_shell.rb +25 -0
  54. data/examples/shell/app/dev/shells/bash_adapter_shell_test.rb +23 -0
  55. data/examples/shell/app/dev/shells/business_logic_shell.rb +42 -0
  56. data/examples/shell/app/dev/shells/business_logic_shell_test.rb +39 -0
  57. data/examples/shell/app/dev/shells/gem_adapter_shell.rb +33 -0
  58. data/examples/shell/app/dev/shells/gem_adapter_shell_test.rb +23 -0
  59. data/exe/liza +6 -1
  60. data/exe/lizarb +9 -1
  61. data/lib/app.rb +74 -145
  62. data/lib/art_system/art_box.rb +5 -0
  63. data/lib/art_system/art_box_test.rb +8 -0
  64. data/lib/art_system.rb +8 -0
  65. data/lib/crypto_system/crypto_box.rb +5 -0
  66. data/lib/crypto_system/crypto_box_test.rb +8 -0
  67. data/lib/crypto_system.rb +8 -0
  68. data/lib/deep_system/deep_box.rb +5 -0
  69. data/lib/deep_system/deep_box_test.rb +8 -0
  70. data/lib/deep_system.rb +8 -0
  71. data/lib/desk_system/commands/glimmer_command.rb +26 -0
  72. data/lib/desk_system/commands/glimmer_command_test.rb +10 -0
  73. data/lib/desk_system/desk_box.rb +5 -0
  74. data/lib/desk_system/desk_box_test.rb +8 -0
  75. data/lib/desk_system.rb +8 -0
  76. data/lib/dev_system/{dev/controllers/command → commands}/test_command.rb +37 -9
  77. data/lib/dev_system/{dev/controllers/command → commands}/test_command_test.rb +1 -2
  78. data/lib/dev_system/dev_box.rb +79 -0
  79. data/lib/dev_system/dev_box_test.rb +33 -0
  80. data/lib/dev_system/generators/env_generator.rb +87 -0
  81. data/lib/dev_system/generators/env_generator_test.rb +11 -0
  82. data/lib/dev_system/generators/gemfile_generator.rb +47 -0
  83. data/lib/dev_system/generators/gemfile_generator_test.rb +11 -0
  84. data/lib/dev_system/generators/system_generator.rb +70 -0
  85. data/lib/dev_system/generators/system_generator_test.rb +11 -0
  86. data/lib/dev_system/sub/bench/bench.rb +7 -0
  87. data/lib/dev_system/{dev/panels → sub/bench}/bench_panel_test.rb +6 -2
  88. data/lib/dev_system/sub/bench/bench_test.rb +24 -0
  89. data/lib/dev_system/sub/bench/benches/not_found_bench.rb +33 -0
  90. data/lib/dev_system/{dev/controllers/bench → sub/bench/benches}/not_found_bench_test.rb +1 -2
  91. data/lib/dev_system/{dev/controllers/command → sub/bench/commands}/bench_command.rb +2 -7
  92. data/lib/dev_system/{dev/controllers/command → sub/bench/commands}/bench_command_test.rb +1 -2
  93. data/lib/dev_system/sub/bench/generators/bench_generator.rb +70 -0
  94. data/lib/dev_system/sub/bench/generators/bench_generator_test.rb +10 -0
  95. data/lib/dev_system/sub/command/command.rb +28 -0
  96. data/lib/dev_system/sub/command/command_panel.rb +151 -0
  97. data/lib/dev_system/sub/command/command_panel_test.rb +78 -0
  98. data/lib/dev_system/{dev/controllers → sub/command}/command_test.rb +6 -2
  99. data/lib/dev_system/sub/command/commands/base_command.rb +48 -0
  100. data/lib/dev_system/sub/command/commands/base_command_test.rb +11 -0
  101. data/lib/dev_system/{dev/controllers/terminal/irb_terminal.rb → sub/command/commands/irb_command.rb} +4 -2
  102. data/lib/dev_system/sub/command/commands/irb_command_test.rb +11 -0
  103. data/lib/dev_system/sub/command/commands/not_found_command.rb +156 -0
  104. data/lib/dev_system/sub/command/commands/not_found_command_test.rb +11 -0
  105. data/lib/dev_system/sub/command/commands/pry_command.rb +10 -0
  106. data/lib/dev_system/sub/command/commands/pry_command_test.rb +11 -0
  107. data/lib/dev_system/sub/command/commands/simple_command.rb +143 -0
  108. data/lib/dev_system/sub/command/commands/simple_command_test.rb +11 -0
  109. data/lib/dev_system/sub/command/generators/command_generator.rb +90 -0
  110. data/lib/dev_system/sub/command/generators/command_generator_test.rb +11 -0
  111. data/lib/dev_system/sub/command/input_commands/highline_input_command.rb +17 -0
  112. data/lib/dev_system/sub/command/input_commands/highline_input_command_test.rb +19 -0
  113. data/lib/dev_system/sub/command/input_commands/input_command.rb +20 -0
  114. data/lib/dev_system/sub/command/input_commands/input_command_test.rb +19 -0
  115. data/lib/dev_system/sub/command/input_commands/tty_input_command.rb +55 -0
  116. data/lib/dev_system/sub/command/input_commands/tty_input_command_test.rb +19 -0
  117. data/lib/dev_system/sub/generator/commands/generate_command.rb +9 -0
  118. data/lib/dev_system/sub/generator/commands/generate_command_test.rb +11 -0
  119. data/lib/dev_system/sub/generator/commands/new_command.rb +10 -0
  120. data/lib/dev_system/sub/generator/commands/new_command_test.rb +7 -0
  121. data/lib/dev_system/sub/generator/generator.rb +19 -0
  122. data/lib/dev_system/sub/generator/generator_panel.rb +98 -0
  123. data/lib/dev_system/sub/generator/generator_panel_test.rb +79 -0
  124. data/lib/dev_system/{dev/controllers → sub/generator}/generator_test.rb +6 -2
  125. data/lib/dev_system/sub/generator/generators/base_generator.rb +64 -0
  126. data/lib/dev_system/sub/generator/generators/base_generator_test.rb +11 -0
  127. data/lib/dev_system/sub/generator/generators/generator_generator.rb +71 -0
  128. data/lib/dev_system/sub/generator/generators/generator_generator_test.rb +11 -0
  129. data/lib/dev_system/sub/generator/generators/new_generator.rb +74 -0
  130. data/lib/dev_system/sub/generator/generators/new_generator_test.rb +11 -0
  131. data/lib/dev_system/sub/generator/generators/not_found_generator.rb +155 -0
  132. data/lib/dev_system/sub/generator/generators/not_found_generator_test.rb +11 -0
  133. data/lib/dev_system/sub/generator/generators/simple_generator.rb +257 -0
  134. data/lib/dev_system/sub/generator/generators/simple_generator_test.rb +38 -0
  135. data/lib/dev_system/sub/log/commands/log_command.rb +11 -0
  136. data/lib/dev_system/sub/log/commands/log_command_test.rb +11 -0
  137. data/lib/dev_system/sub/log/generators/log_generator.rb +54 -0
  138. data/lib/dev_system/sub/log/generators/log_generator_test.rb +10 -0
  139. data/lib/dev_system/sub/log/log.rb +3 -0
  140. data/lib/dev_system/sub/log/log_panel.rb +47 -0
  141. data/lib/dev_system/sub/log/log_panel_test.rb +50 -0
  142. data/lib/dev_system/sub/log/log_test.rb +16 -0
  143. data/lib/dev_system/sub/log/logs/output_log.rb +74 -0
  144. data/lib/dev_system/sub/log/logs/output_log_test.rb +47 -0
  145. data/lib/dev_system/sub/log/logs/stick_log.rb +79 -0
  146. data/lib/dev_system/sub/log/logs/stick_log_test.rb +88 -0
  147. data/lib/dev_system/sub/shell/commands/convert_command.rb +27 -0
  148. data/lib/dev_system/sub/shell/commands/convert_command_test.rb +10 -0
  149. data/lib/dev_system/sub/shell/commands/format_command.rb +25 -0
  150. data/lib/dev_system/sub/shell/commands/format_command_test.rb +10 -0
  151. data/lib/dev_system/sub/shell/commands/loc_command.rb +211 -0
  152. data/lib/dev_system/sub/shell/commands/loc_command_test.rb +10 -0
  153. data/lib/dev_system/sub/shell/commands/shell_command.rb +45 -0
  154. data/lib/dev_system/sub/shell/commands/shell_command_test.rb +11 -0
  155. data/lib/dev_system/sub/shell/converter_shells/coffee_converter_shell.rb +21 -0
  156. data/lib/dev_system/sub/shell/converter_shells/coffee_converter_shell_test.rb +41 -0
  157. data/lib/dev_system/sub/shell/converter_shells/converter_shell.rb +13 -0
  158. data/lib/dev_system/sub/shell/converter_shells/converter_shell_test.rb +19 -0
  159. data/lib/dev_system/sub/shell/converter_shells/haml_converter_shell.rb +30 -0
  160. data/lib/dev_system/sub/shell/converter_shells/haml_converter_shell_test.rb +34 -0
  161. data/lib/dev_system/sub/shell/converter_shells/md_converter_shell.rb +21 -0
  162. data/lib/dev_system/sub/shell/converter_shells/md_converter_shell_test.rb +38 -0
  163. data/lib/dev_system/sub/shell/converter_shells/scss_converter_shell.rb +59 -0
  164. data/lib/dev_system/sub/shell/converter_shells/scss_converter_shell_test.rb +59 -0
  165. data/lib/dev_system/sub/shell/formatter_shells/formatter_shell.rb +13 -0
  166. data/lib/dev_system/sub/shell/formatter_shells/formatter_shell_test.rb +19 -0
  167. data/lib/dev_system/sub/shell/formatter_shells/html_formatter_shell.rb +20 -0
  168. data/lib/dev_system/sub/shell/formatter_shells/html_formatter_shell_test.rb +51 -0
  169. data/lib/dev_system/sub/shell/generators/shell_generator.rb +68 -0
  170. data/lib/dev_system/sub/shell/generators/shell_generator_test.rb +10 -0
  171. data/lib/dev_system/{dev/controllers → sub/shell}/shell.rb +22 -0
  172. data/lib/dev_system/sub/shell/shell_panel.rb +98 -0
  173. data/lib/dev_system/sub/shell/shell_panel_test.rb +18 -0
  174. data/lib/dev_system/{dev/controllers → sub/shell}/shell_test.rb +31 -2
  175. data/lib/dev_system/sub/shell/shells/app_shell.rb +185 -0
  176. data/lib/dev_system/sub/shell/shells/app_shell_test.rb +26 -0
  177. data/lib/dev_system/{dev/controllers/shell → sub/shell/shells}/bin_shell_test.rb +1 -2
  178. data/lib/dev_system/sub/shell/shells/color_shell.rb +389 -0
  179. data/lib/dev_system/sub/shell/shells/color_shell_test.rb +27 -0
  180. data/lib/dev_system/sub/shell/shells/controller_shell.rb +20 -0
  181. data/lib/dev_system/sub/shell/shells/controller_shell_test.rb +16 -0
  182. data/lib/dev_system/sub/shell/shells/dir_shell.rb +27 -0
  183. data/lib/dev_system/{dev/controllers/shell → sub/shell/shells}/dir_shell_test.rb +1 -5
  184. data/lib/dev_system/{dev/controllers/shell → sub/shell/shells}/file_shell.rb +4 -4
  185. data/lib/dev_system/{dev/controllers/shell → sub/shell/shells}/file_shell_test.rb +1 -2
  186. data/lib/dev_system/sub/shell/shells/gem_shell.rb +21 -0
  187. data/lib/dev_system/sub/shell/shells/gem_shell_test.rb +28 -0
  188. data/lib/dev_system/sub/shell/shells/kernel_shell.rb +22 -0
  189. data/lib/dev_system/sub/shell/shells/kernel_shell_test.rb +10 -0
  190. data/lib/dev_system/sub/shell/shells/line_diff_shell.rb +26 -0
  191. data/lib/dev_system/sub/shell/shells/line_diff_shell_test.rb +11 -0
  192. data/lib/dev_system/sub/shell/shells/line_shell.rb +56 -0
  193. data/lib/dev_system/sub/shell/shells/line_shell_test.rb +70 -0
  194. data/lib/dev_system/sub/shell/shells/method_shell.rb +52 -0
  195. data/lib/dev_system/sub/shell/shells/method_shell_test.rb +34 -0
  196. data/lib/dev_system/sub/shell/shells/text_file_shell.rb +14 -0
  197. data/lib/dev_system/sub/shell/shells/text_file_shell_test.rb +11 -0
  198. data/lib/dev_system/sub/shell/shells/text_shell.rb +65 -0
  199. data/lib/dev_system/{dev/controllers/shell → sub/shell/shells}/text_shell_test.rb +1 -2
  200. data/lib/dev_system.rb +8 -2
  201. data/lib/happy_system/happy_box.rb +9 -0
  202. data/lib/happy_system/happy_box_test.rb +24 -0
  203. data/lib/happy_system/sub/axo/axo.rb +10 -0
  204. data/lib/happy_system/sub/axo/axo_panel.rb +9 -0
  205. data/lib/happy_system/sub/axo/axo_panel_test.rb +16 -0
  206. data/lib/happy_system/sub/axo/axo_test.rb +16 -0
  207. data/lib/happy_system/sub/axo/commands/axo_command.rb +40 -0
  208. data/lib/happy_system/sub/axo/commands/axo_command_test.rb +8 -0
  209. data/lib/happy_system/sub/axo/generators/axo_generator.rb +79 -0
  210. data/lib/happy_system/sub/axo/generators/axo_generator_test.rb +11 -0
  211. data/lib/happy_system.rb +4 -2
  212. data/lib/lab_system/clients/kroki_client.rb +134 -0
  213. data/lib/lab_system/clients/kroki_client_test.rb +32 -0
  214. data/lib/lab_system/clients/liza_kroki_client.rb +176 -0
  215. data/lib/lab_system/clients/liza_kroki_client_test.rb +32 -0
  216. data/lib/lab_system/commands/docker_command.rb +61 -0
  217. data/lib/lab_system/commands/docker_command_test.rb +11 -0
  218. data/lib/lab_system/lab_box.rb +5 -0
  219. data/lib/lab_system/lab_box_test.rb +8 -0
  220. data/lib/lab_system/requests/kroki_request.rb +182 -0
  221. data/lib/lab_system/requests/kroki_request_test.rb +11 -0
  222. data/lib/lab_system/shells/docker_shell.rb +60 -0
  223. data/lib/lab_system/shells/docker_shell_test.rb +61 -0
  224. data/lib/lab_system/shells/kroki_docker_shell.rb +20 -0
  225. data/lib/lab_system/shells/kroki_docker_shell_test.rb +11 -0
  226. data/lib/lab_system.rb +8 -0
  227. data/lib/lerb.rb +95 -49
  228. data/lib/liza/base/controller.rb +14 -15
  229. data/lib/liza/base/controller_test.rb +28 -2
  230. data/lib/liza/base/panel.rb +64 -24
  231. data/lib/liza/base/panel_test.rb +168 -3
  232. data/lib/liza/base_parts/controller_subsystem_part.rb +93 -0
  233. data/lib/liza/base_parts/panel_rescuer_part.rb +129 -0
  234. data/lib/liza/meta/box.rb +24 -0
  235. data/lib/liza/meta/box_test.rb +20 -0
  236. data/lib/liza/meta/part_test.rb +6 -1
  237. data/lib/liza/meta/system.rb +50 -7
  238. data/lib/liza/meta/system_test.rb +6 -2
  239. data/lib/liza/ruby_tests/app_test.rb +39 -0
  240. data/lib/liza/ruby_tests/class_test.rb +20 -0
  241. data/lib/liza/ruby_tests/module_test.rb +4 -4
  242. data/lib/liza/{ruby_test.rb → ruby_tests/object_test.rb} +1 -1
  243. data/lib/liza/ruby_tests/string_test.rb +3 -1
  244. data/lib/liza/{test → safety}/test.rb +9 -0
  245. data/lib/liza/{test → safety}/test_test.rb +44 -7
  246. data/lib/liza/{test_parts → safety_parts}/test_assertions_advanced_part.rb +1 -1
  247. data/lib/liza/{test_parts → safety_parts}/test_assertions_part.rb +1 -1
  248. data/lib/liza/{test_parts → safety_parts}/test_dsl_part.rb +3 -3
  249. data/lib/liza/{test_parts → safety_parts}/test_log_part.rb +20 -0
  250. data/lib/liza/{test_parts → safety_parts}/test_subject_part.rb +10 -0
  251. data/lib/liza/safety_parts/test_tree_part.rb +87 -0
  252. data/lib/liza/unit.rb +64 -120
  253. data/lib/liza/unit_parts/unit_classes_part.rb +37 -0
  254. data/lib/liza/unit_parts/unit_classes_part_test.rb +3 -0
  255. data/lib/liza/unit_parts/unit_logging_part.rb +139 -0
  256. data/lib/liza/unit_parts/unit_logging_part_test.rb +3 -0
  257. data/lib/liza/unit_parts/unit_methods_part.rb +35 -0
  258. data/lib/liza/unit_parts/unit_methods_part_test.rb +3 -0
  259. data/lib/liza/unit_parts/unit_procedure_part.rb +2 -2
  260. data/lib/liza/unit_parts/unit_procedure_part_test.rb +9 -9
  261. data/lib/liza/unit_parts/unit_renderer_part.rb +171 -0
  262. data/lib/liza/unit_parts/unit_renderer_part_test.rb +15 -0
  263. data/lib/liza/unit_parts/unit_settings_part.rb +84 -0
  264. data/lib/liza/unit_parts/unit_settings_part_test.rb +3 -0
  265. data/lib/liza/unit_test.rb +114 -5
  266. data/lib/liza.rb +11 -2
  267. data/lib/lizarb/ruby/class.rb +9 -1
  268. data/lib/lizarb/ruby/module.rb +1 -1
  269. data/lib/lizarb/ruby/string.rb +3 -1
  270. data/lib/lizarb/version.rb +1 -1
  271. data/lib/lizarb.rb +404 -29
  272. data/lib/micro_system/micro_box.rb +5 -0
  273. data/lib/micro_system/micro_box_test.rb +8 -0
  274. data/lib/micro_system.rb +8 -0
  275. data/lib/net_system/net_box.rb +21 -0
  276. data/lib/net_system/{net/net_box_test.rb → net_box_test.rb} +1 -2
  277. data/lib/net_system/{net/panels → sub/client}/client_panel_test.rb +1 -2
  278. data/lib/net_system/{net/controllers → sub/client}/client_test.rb +1 -2
  279. data/lib/net_system/sub/client/generators/client_generator.rb +88 -0
  280. data/lib/net_system/sub/client/generators/client_generator_test.rb +10 -0
  281. data/lib/net_system/sub/database/clients/mongo_client.rb +33 -0
  282. data/lib/net_system/sub/database/clients/mongo_client_test.rb +20 -0
  283. data/lib/net_system/sub/database/clients/mysql_client.rb +29 -0
  284. data/lib/net_system/sub/database/clients/mysql_client_test.rb +23 -0
  285. data/lib/net_system/sub/database/clients/pgsql_client.rb +29 -0
  286. data/lib/net_system/sub/database/clients/pgsql_client_test.rb +25 -0
  287. data/lib/net_system/{net/controllers/client → sub/database/clients}/redis_client.rb +5 -2
  288. data/lib/net_system/{net/controllers/client → sub/database/clients}/redis_client_test.rb +2 -2
  289. data/lib/net_system/{net/controllers/client → sub/database/clients}/sqlite_client.rb +5 -2
  290. data/lib/net_system/{net/controllers/client → sub/database/clients}/sqlite_client_test.rb +2 -2
  291. data/lib/net_system/sub/database/commands/database_command.rb +32 -0
  292. data/lib/net_system/sub/database/commands/database_command_test.rb +11 -0
  293. data/lib/net_system/{net/panels → sub/database}/database_panel_test.rb +1 -2
  294. data/lib/net_system/{net/controllers → sub/database}/database_test.rb +1 -2
  295. data/lib/net_system/sub/database/databases/mongo_db.rb +8 -0
  296. data/lib/net_system/sub/database/databases/mongo_db_test.rb +21 -0
  297. data/lib/net_system/sub/database/databases/mysql_db.rb +8 -0
  298. data/lib/net_system/sub/database/databases/mysql_db_test.rb +21 -0
  299. data/lib/net_system/sub/database/databases/pgsql_db.rb +8 -0
  300. data/lib/net_system/sub/database/databases/pgsql_db_test.rb +21 -0
  301. data/lib/net_system/{net/controllers/database → sub/database/databases}/redis_db_test.rb +1 -1
  302. data/lib/net_system/{net/controllers/database → sub/database/databases}/sqlite_db_test.rb +1 -1
  303. data/lib/net_system/sub/record/generators/record_generator.rb +33 -0
  304. data/lib/net_system/sub/record/generators/record_generator_test.rb +11 -0
  305. data/lib/net_system/sub/record/record_panel.rb +3 -0
  306. data/lib/net_system/sub/record/record_panel_test.rb +11 -0
  307. data/lib/net_system/{net/controllers → sub/record}/record_test.rb +1 -2
  308. data/lib/net_system.rb +8 -1
  309. data/lib/web_system/sub/rack/commands/rack_command.rb +30 -0
  310. data/lib/web_system/sub/rack/commands/rack_command_test.rb +11 -0
  311. data/lib/web_system/sub/rack/middle_racks/first_middle_rack.rb +8 -0
  312. data/lib/web_system/sub/rack/middle_racks/first_middle_rack_test.rb +11 -0
  313. data/lib/web_system/sub/rack/middle_racks/last_middle_rack.rb +3 -0
  314. data/lib/web_system/sub/rack/middle_racks/last_middle_rack_test.rb +11 -0
  315. data/lib/web_system/sub/rack/middle_racks/middle_rack.rb +18 -0
  316. data/lib/web_system/sub/rack/middle_racks/middle_rack_test.rb +11 -0
  317. data/lib/web_system/sub/rack/middle_racks/zeitwerk_middle_rack.rb +11 -0
  318. data/lib/web_system/sub/rack/middle_racks/zeitwerk_middle_rack_test.rb +11 -0
  319. data/lib/web_system/sub/rack/rack_panel.rb +52 -0
  320. data/lib/web_system/{web/panels → sub/rack}/rack_panel_test.rb +1 -2
  321. data/lib/web_system/{web/controllers → sub/rack}/rack_test.rb +1 -2
  322. data/lib/web_system/sub/rack/server_racks/agoo_server_rack.rb +53 -0
  323. data/lib/web_system/sub/rack/server_racks/agoo_server_rack_test.rb +11 -0
  324. data/lib/web_system/sub/rack/server_racks/falcon_server_rack.rb +46 -0
  325. data/lib/web_system/sub/rack/server_racks/falcon_server_rack_test.rb +11 -0
  326. data/lib/web_system/sub/rack/server_racks/iodine_server_rack.rb +47 -0
  327. data/lib/web_system/sub/rack/server_racks/iodine_server_rack_test.rb +11 -0
  328. data/lib/web_system/sub/rack/server_racks/puma_server_rack.rb +48 -0
  329. data/lib/web_system/sub/rack/server_racks/puma_server_rack_test.rb +11 -0
  330. data/lib/web_system/sub/rack/server_racks/server_rack.rb +12 -0
  331. data/lib/web_system/sub/rack/server_racks/server_rack_test.rb +11 -0
  332. data/lib/web_system/sub/rack/server_racks/thin_server_rack.rb +85 -0
  333. data/lib/web_system/sub/rack/server_racks/thin_server_rack_test.rb +11 -0
  334. data/lib/web_system/sub/request/commands/request_command.rb +125 -0
  335. data/lib/web_system/sub/request/commands/request_command_test.rb +11 -0
  336. data/lib/web_system/sub/request/generators/request_generator.rb +96 -0
  337. data/lib/web_system/sub/request/generators/request_generator_test.rb +11 -0
  338. data/lib/web_system/sub/request/request_panel.rb +69 -0
  339. data/lib/web_system/sub/request/request_panel_test.rb +54 -0
  340. data/lib/web_system/{web/controllers → sub/request}/request_test.rb +1 -2
  341. data/lib/web_system/sub/request/requests/simple_request.rb +95 -0
  342. data/lib/web_system/sub/request/requests/simple_request_test.rb +11 -0
  343. data/lib/web_system/sub/request/router_requests/router_request.rb +7 -0
  344. data/lib/web_system/sub/request/router_requests/router_request_test.rb +11 -0
  345. data/lib/web_system/sub/request/router_requests/simple_router_request.rb +24 -0
  346. data/lib/web_system/sub/request/router_requests/simple_router_request_test.rb +11 -0
  347. data/lib/web_system/web_box.rb +17 -0
  348. data/lib/web_system/{web/web_box_test.rb → web_box_test.rb} +1 -2
  349. data/lib/web_system.rb +9 -3
  350. data/lib/work_system/work_box.rb +5 -0
  351. data/lib/work_system/work_box_test.rb +8 -0
  352. data/lib/work_system.rb +8 -0
  353. data/lizarb.gemspec +14 -8
  354. metadata +375 -168
  355. data/.ruby-version +0 -1
  356. data/app/dev/benches/app_bench.rb +0 -5
  357. data/app/dev/benches/app_bench_test.rb +0 -7
  358. data/app/dev/benches/loops_bench_test.rb +0 -11
  359. data/app/dev/commands/app_command.rb +0 -5
  360. data/app/dev/commands/app_command_test.rb +0 -7
  361. data/app/dev/commands/new_command.rb +0 -9
  362. data/app/dev/commands/new_command_test.rb +0 -7
  363. data/app/dev/generators/bench_generator/bench.rb.erb +0 -24
  364. data/app/dev/generators/bench_generator/bench_test.rb.erb +0 -12
  365. data/app/dev/generators/bench_generator.rb +0 -18
  366. data/app/dev/generators/bench_generator_test.rb +0 -12
  367. data/app/dev/generators/command_generator/command.rb.erb +0 -26
  368. data/app/dev/generators/command_generator/command_test.rb.erb +0 -12
  369. data/app/dev/generators/command_generator.rb +0 -18
  370. data/app/dev/generators/command_generator_test.rb +0 -12
  371. data/app/dev/generators/record_generator.rb +0 -46
  372. data/app/dev/generators/record_generator_test.rb +0 -12
  373. data/app/dev/generators/request_generator.rb +0 -63
  374. data/app/dev/generators/request_generator_test.rb +0 -12
  375. data/app/happy/axos/axo.rb +0 -50
  376. data/exe/Gemfile.lock +0 -13
  377. data/exe/lrb +0 -3
  378. data/lib/dev_system/dev/controllers/bench/not_found_bench.rb +0 -27
  379. data/lib/dev_system/dev/controllers/bench.rb +0 -9
  380. data/lib/dev_system/dev/controllers/bench_dsl_main_part.rb +0 -58
  381. data/lib/dev_system/dev/controllers/bench_test.rb +0 -12
  382. data/lib/dev_system/dev/controllers/command/echo_command.rb +0 -9
  383. data/lib/dev_system/dev/controllers/command/echo_command_test.rb +0 -12
  384. data/lib/dev_system/dev/controllers/command/generate_command.rb +0 -33
  385. data/lib/dev_system/dev/controllers/command/generate_command_test.rb +0 -12
  386. data/lib/dev_system/dev/controllers/command/not_found_command.rb +0 -27
  387. data/lib/dev_system/dev/controllers/command/not_found_command_test.rb +0 -12
  388. data/lib/dev_system/dev/controllers/command/terminal_command.rb +0 -22
  389. data/lib/dev_system/dev/controllers/command/terminal_command_test.rb +0 -12
  390. data/lib/dev_system/dev/controllers/command/version_command.rb +0 -7
  391. data/lib/dev_system/dev/controllers/command/version_command_test.rb +0 -12
  392. data/lib/dev_system/dev/controllers/command.rb +0 -17
  393. data/lib/dev_system/dev/controllers/generator.rb +0 -9
  394. data/lib/dev_system/dev/controllers/generator_dsl_main_part.rb +0 -52
  395. data/lib/dev_system/dev/controllers/generators/app_generator.rb +0 -146
  396. data/lib/dev_system/dev/controllers/generators/app_generator_test.rb +0 -12
  397. data/lib/dev_system/dev/controllers/generators/generator_generator/generator.rb.erb +0 -18
  398. data/lib/dev_system/dev/controllers/generators/generator_generator/generator_test.rb.erb +0 -12
  399. data/lib/dev_system/dev/controllers/generators/generator_generator/template.rb.erb +0 -9
  400. data/lib/dev_system/dev/controllers/generators/generator_generator/template_test.rb.erb +0 -12
  401. data/lib/dev_system/dev/controllers/generators/generator_generator.rb +0 -30
  402. data/lib/dev_system/dev/controllers/generators/generator_generator_test.rb +0 -12
  403. data/lib/dev_system/dev/controllers/generators/not_found_generator.rb +0 -27
  404. data/lib/dev_system/dev/controllers/generators/not_found_generator_test.rb +0 -12
  405. data/lib/dev_system/dev/controllers/shell/dir_shell.rb +0 -27
  406. data/lib/dev_system/dev/controllers/shell/text_shell.rb +0 -23
  407. data/lib/dev_system/dev/controllers/terminal/irb_terminal_test.rb +0 -12
  408. data/lib/dev_system/dev/controllers/terminal/pry_terminal.rb +0 -10
  409. data/lib/dev_system/dev/controllers/terminal/pry_terminal_test.rb +0 -12
  410. data/lib/dev_system/dev/controllers/terminal.rb +0 -17
  411. data/lib/dev_system/dev/controllers/terminal_test.rb +0 -12
  412. data/lib/dev_system/dev/dev_box.rb +0 -39
  413. data/lib/dev_system/dev/dev_box_test.rb +0 -17
  414. data/lib/dev_system/dev/panels/command_panel.rb +0 -28
  415. data/lib/dev_system/dev/panels/command_panel_test.rb +0 -21
  416. data/lib/dev_system/dev/panels/generator_panel.rb +0 -3
  417. data/lib/dev_system/dev/panels/generator_panel_test.rb +0 -12
  418. data/lib/dev_system/dev/panels/log_panel.rb +0 -13
  419. data/lib/dev_system/dev/panels/log_panel_test.rb +0 -16
  420. data/lib/dev_system/dev/panels/shell_panel.rb +0 -3
  421. data/lib/dev_system/dev/panels/shell_panel_test.rb +0 -12
  422. data/lib/dev_system/dev/panels/terminal_panel.rb +0 -3
  423. data/lib/dev_system/dev/panels/terminal_panel_test.rb +0 -12
  424. data/lib/happy_system/dev/happy_command.rb +0 -11
  425. data/lib/happy_system/happy/controllers/axo.rb +0 -7
  426. data/lib/happy_system/happy/happy_box.rb +0 -9
  427. data/lib/happy_system/happy/happy_box_test.rb +0 -16
  428. data/lib/happy_system/happy/panels/axo_panel.rb +0 -3
  429. data/lib/liza/base/box.rb +0 -85
  430. data/lib/liza/base/box_test.rb +0 -10
  431. data/lib/liza/base_parts/controller_renderer_part.rb +0 -140
  432. data/lib/liza/base_parts/controller_renderer_part_test.rb +0 -16
  433. data/lib/liza/meta/part_extension.rb +0 -16
  434. data/lib/liza/test_parts/test_tree_part.rb +0 -137
  435. data/lib/net_system/dev/net_command.rb +0 -22
  436. data/lib/net_system/net/net_box.rb +0 -15
  437. data/lib/web_system/dev/rack_command.rb +0 -35
  438. data/lib/web_system/dev/request_command.rb +0 -143
  439. data/lib/web_system/dev/web_command.rb +0 -9
  440. data/lib/web_system/web/panels/rack_panel.rb +0 -42
  441. data/lib/web_system/web/panels/request_panel.rb +0 -72
  442. data/lib/web_system/web/panels/request_panel_test.rb +0 -33
  443. data/lib/web_system/web/web_box.rb +0 -20
  444. /data/lib/dev_system/{dev/panels → sub/bench}/bench_panel.rb +0 -0
  445. /data/lib/dev_system/{dev/controllers/shell → sub/shell/shells}/bin_shell.rb +0 -0
  446. /data/lib/net_system/{net/controllers → sub/client}/client.rb +0 -0
  447. /data/lib/net_system/{net/panels → sub/client}/client_panel.rb +0 -0
  448. /data/lib/net_system/{net/controllers → sub/database}/database.rb +0 -0
  449. /data/lib/net_system/{net/panels → sub/database}/database_panel.rb +0 -0
  450. /data/lib/net_system/{net/controllers/database → sub/database/databases}/redis_db.rb +0 -0
  451. /data/lib/net_system/{net/controllers/database → sub/database/databases}/sqlite_db.rb +0 -0
  452. /data/lib/net_system/{net/controllers → sub/record}/record.rb +0 -0
  453. /data/lib/web_system/{web/controllers → sub/rack}/rack.rb +0 -0
  454. /data/lib/web_system/{web/controllers → sub/request}/request.rb +0 -0
  455. /data/lib/web_system/{web/controllers/request → sub/request/requests}/client_error_request.rb +0 -0
  456. /data/lib/web_system/{web/controllers/request → sub/request/requests}/not_found_request.rb +0 -0
  457. /data/lib/web_system/{web/controllers/request → sub/request/requests}/server_error_request.rb +0 -0
@@ -0,0 +1,20 @@
1
+ class Liza::ClassTest < Liza::ObjectTest
2
+
3
+ test :subject_class do
4
+ assert_equality subject_class, Class
5
+ end
6
+
7
+ test :ancestors_until do
8
+ assert_equality [Object], Object.ancestors_until(BasicObject)
9
+ assert_equality [Integer], Integer.ancestors_until(Object)
10
+ assert_equality [Symbol], Symbol.ancestors_until(Object)
11
+ assert_equality [String], String.ancestors_until(Object)
12
+ assert_equality [Array], Array.ancestors_until(Object)
13
+ assert_equality [Hash], Hash.ancestors_until(Object)
14
+
15
+ assert_equality [IrbCommand, Command], IrbCommand.ancestors_until(Command)
16
+ assert_equality [PryCommand, Command], PryCommand.ancestors_until(Command)
17
+ assert_equality [TestCommand, Command], TestCommand.ancestors_until(Command)
18
+ end
19
+
20
+ end
@@ -1,4 +1,4 @@
1
- class Liza::ModuleTest < Liza::RubyTest
1
+ class Liza::ModuleTest < Liza::ObjectTest
2
2
 
3
3
  test :subject_class do
4
4
  assert subject_class == Module
@@ -8,14 +8,14 @@ class Liza::ModuleTest < Liza::RubyTest
8
8
  assert Object.source_location == []
9
9
 
10
10
  assert Liza::Command.source_location[1] == 1
11
- assert AppCommand.source_location[1] == 1
11
+ assert IrbCommand.source_location[1] == 1
12
12
  end
13
13
 
14
14
  test :source_location_radical do
15
15
  assert Object.source_location_radical == nil
16
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"
17
+ assert Liza::Command.source_location_radical.end_with? "/lib/dev_system/sub/command/command"
18
+ assert IrbCommand.source_location_radical.end_with? "/lib/dev_system/sub/command/commands/irb_command"
19
19
  end
20
20
 
21
21
  end
@@ -1,4 +1,4 @@
1
- class Liza::RubyTest < Liza::Test
1
+ class Liza::ObjectTest < Liza::Test
2
2
 
3
3
  def self.subject_class
4
4
  @subject_class ||= Object.const_get last_namespace[0..-5]
@@ -1,4 +1,4 @@
1
- class Liza::StringTest < Liza::RubyTest
1
+ class Liza::StringTest < Liza::ObjectTest
2
2
 
3
3
  test :subject_class do
4
4
  assert subject_class == String
@@ -38,6 +38,8 @@ class Liza::StringTest < Liza::RubyTest
38
38
  assert "ab" == "Ab".snakecase
39
39
  assert "ab_c" == "AbC".snakecase
40
40
  assert "ab_cd" == "AbCd".snakecase
41
+ assert "ab" == "ab".snakecase
42
+ assert "cd" == "cd".snakecase
41
43
  end
42
44
 
43
45
  test :rjust_blanks do
@@ -7,4 +7,13 @@ class Liza::Test < Liza::Unit
7
7
  part :test_subject
8
8
  part :test_tree
9
9
 
10
+ def self.subsystem
11
+ subject_class.subsystem
12
+ end
13
+
14
+ # color
15
+
16
+ def self.color
17
+ subject_class.color
18
+ end
10
19
  end
@@ -1,9 +1,40 @@
1
1
 
2
- class Liza::TestTest < Liza::Test
2
+ class Liza::TestTest < Liza::UnitTest
3
3
 
4
4
  test :settings do
5
- assert subject_class.log_level == :normal
6
- assert subject_class.log_color == :white
5
+ assert_equality subject_class.log_level, 0
6
+ end
7
+
8
+ test_methods_defined do
9
+ on_self \
10
+ :after, :after_stack,
11
+ :before, :before_stack,
12
+ :call, :color,
13
+ :group,
14
+ :log_test_building, :log_test_building?,
15
+ :subject_class,
16
+ :subsystem,
17
+ :test, :test_node, :test_tree,
18
+ :totals
19
+ on_instance \
20
+ :assert, :assert!,
21
+ :assert_equality, :assert_equality!,
22
+ :assert_raises, :assert_raises!,
23
+ :assertions, :assertions=,
24
+ :call,
25
+ :critical,
26
+ :division,
27
+ :group,
28
+ :log_test_assertion, :log_test_assertion?,
29
+ :log_test_assertion_message, :log_test_assertion_message?,
30
+ :log_test_assertion_result, :log_test_building?,
31
+ :log_test_call, :log_test_call_block?, :log_test_call_rescue,
32
+ :refute, :refute!,
33
+ :refute_equality, :refute_equality!,
34
+ :refute_raises, :refute_raises!,
35
+ :subject, :subject_class,
36
+ :test_words,
37
+ :todo
7
38
  end
8
39
 
9
40
  group :basics do
@@ -74,7 +105,11 @@ class Liza::TestTest < Liza::Test
74
105
 
75
106
  group :instance_variables do
76
107
  test :instance_variables do
77
- assert_equality instance_variables, [:@test_words, :@before_stack, :@after_stack, :@test_block]
108
+ if Shell.jruby?
109
+ todo "jruby!"
110
+ else
111
+ assert_equality instance_variables, [:@test_words, :@before_stack, :@after_stack, :@test_block, :@settings]
112
+ end
78
113
  end
79
114
 
80
115
  test :test_block do
@@ -84,13 +119,15 @@ class Liza::TestTest < Liza::Test
84
119
 
85
120
  group :tree do
86
121
  test :test_tree do
87
- assert_equality self.class.test_tree.class, Liza::TestTreePart::Extension
122
+ assert_equality self.class.test_tree.class, Liza::TestTreePart
88
123
  assert_equality self.class.test_tree, self.class.test_tree.parent
89
124
 
90
- assert_equality 2, self.class.test_tree.tests.count
125
+ assert_equality 4, self.class.test_tree.tests.count
91
126
  assert_equality 5, self.class.test_tree.children.count
92
127
 
93
- assert_equality self.class.test_tree.tests.map(&:first).flatten, [:settings, :instance_groups]
128
+ a = self.class.test_tree.tests.map(&:first).flatten
129
+ b = [:settings, :subject_class, :methods_defined, :subject_class, :instance_methods_defined, :instance_groups]
130
+ assert_equality a, b
94
131
  end
95
132
  end
96
133
 
@@ -16,7 +16,7 @@ class Liza::TestAssertionsAdvancedPart < Liza::Part
16
16
  log_test_assertion __method__, kaller if _groups.empty?
17
17
 
18
18
  if log_test_assertion_message?
19
- msg ||= "#{__method__} #{a}, #{b} (== equality)"
19
+ msg ||= "#{__method__} #{a.inspect}, #{b.inspect} (== equality)"
20
20
  log_test_assertion_message ret, msg
21
21
  end
22
22
 
@@ -56,7 +56,7 @@ class Liza::TestAssertionsPart < Liza::Part
56
56
  block_given? || raise(ArgumentError, "No block given")
57
57
 
58
58
  _groups << block
59
- instance_exec &block
59
+ instance_exec(&block)
60
60
  _groups.pop
61
61
 
62
62
  kaller ||= caller
@@ -40,20 +40,20 @@ class Liza::TestDslPart < Liza::Part
40
40
  log " calling stacked before blocks #{stack.map { |bl| _log_test_block bl }}".magenta if log_test_building?
41
41
  stack.each do |bl|
42
42
  log_test_call "B&", &bl if log_test_call_block?
43
- instance_exec &bl
43
+ instance_exec(&bl)
44
44
  end
45
45
  end
46
46
 
47
47
  bl = @test_block
48
48
  log " calling test block #{_log_test_block bl}".magenta if log_test_building?
49
49
  log_test_call "T&", &bl if log_test_call_block?
50
- instance_exec &bl
50
+ instance_exec(&bl)
51
51
 
52
52
  @after_stack.each do |stack|
53
53
  log " calling stacked after blocks #{stack.map { |bl| _log_test_block bl }}".magenta if log_test_building?
54
54
  stack.each do |bl|
55
55
  log_test_call "A&", &bl if log_test_call_block?
56
- instance_exec &bl
56
+ instance_exec(&bl)
57
57
  end
58
58
  end
59
59
  end
@@ -7,6 +7,26 @@ class Liza::TestLogPart < Liza::Part
7
7
  LOG_ASSERTION_MESSAGE = true
8
8
  LOG_CALL_BLOCK = true
9
9
 
10
+ def self.system
11
+ subject_class.system
12
+ rescue
13
+ Liza::System
14
+ end
15
+
16
+ def system
17
+ self.class.system
18
+ end
19
+
20
+ def self.division
21
+ subject_class.division
22
+ rescue
23
+ Liza::Controller
24
+ end
25
+
26
+ def division
27
+ self.class.division
28
+ end
29
+
10
30
  def self.log_test_building?
11
31
  LOG_BUILDING
12
32
  end
@@ -17,6 +17,16 @@ class Liza::TestSubjectPart < Liza::Part
17
17
  def subject
18
18
  @subject ||= subject_class.new
19
19
  end
20
+
21
+ def self.system
22
+ subject_class.system
23
+ rescue
24
+ System
25
+ end
26
+
27
+ def system
28
+ self.class.system
29
+ end
20
30
  end
21
31
 
22
32
  end
@@ -0,0 +1,87 @@
1
+ class Liza::TestTreePart < Liza::Part
2
+
3
+ insertion do
4
+
5
+ @before_stack = []
6
+ @after_stack = []
7
+
8
+ def self.before_stack; @before_stack ||= superclass.before_stack.dup end
9
+ def self.after_stack; @after_stack ||= superclass.after_stack.dup end
10
+
11
+ def self.test_node; @test_node ||= test_tree end
12
+ def self.test_tree; @test_tree ||= Liza::TestTreePart.new nil, before_stack, after_stack end
13
+
14
+ #
15
+
16
+ def self.group *words, &block
17
+ raise ArgumentError, "No block given" unless block_given?
18
+ previous = test_node
19
+ @test_node = test_node.branch_out words
20
+ instance_exec(&block)
21
+ @test_node = previous
22
+ end
23
+
24
+ def self.test *words, &block
25
+ raise ArgumentError, "No block given" unless block_given?
26
+ test_node.add_test words, &block
27
+ end
28
+
29
+ def self.before &block
30
+ raise ArgumentError, "No block given" unless block_given?
31
+ test_node.add_before(&block)
32
+ end
33
+
34
+ def self.after &block
35
+ raise ArgumentError, "No block given" unless block_given?
36
+ test_node.add_after(&block)
37
+ end
38
+
39
+ end
40
+
41
+ #
42
+
43
+ def log_test_building?
44
+ Liza::Test.log_test_building?
45
+ end
46
+
47
+ attr_reader :tests, :parent, :children, :before_stack, :after_stack
48
+
49
+ def initialize parent, before_stack, after_stack
50
+ @tests = []
51
+ initialize_parenting parent
52
+ initialize_filters before_stack, after_stack
53
+ end
54
+
55
+ def initialize_parenting parent
56
+ @parent = parent || self
57
+ @children = []
58
+ @parent.children << self if @parent != self
59
+ end
60
+
61
+ def initialize_filters before_stack, after_stack
62
+ @before_top, @after_top = [], []
63
+ @before_stack = before_stack.push @before_top
64
+ @after_stack = after_stack.unshift @after_top
65
+ end
66
+
67
+ def add_before &block
68
+ log "add_before to ##{object_id} #{block}" if log_test_building?
69
+ @before_top.push block
70
+ end
71
+
72
+ def add_test words, &block
73
+ log "add_test to ##{object_id} #{words} #{block}" if log_test_building?
74
+ tests << [words, block]
75
+ end
76
+
77
+ def add_after &block
78
+ log "add_after to ##{object_id} #{block}" if log_test_building?
79
+ @after_top.push block
80
+ end
81
+
82
+ def branch_out words, &block
83
+ self.class.new self, before_stack.dup, after_stack.dup
84
+ end
85
+
86
+
87
+ end
data/lib/liza/unit.rb CHANGED
@@ -1,155 +1,99 @@
1
1
  class Liza::Unit
2
2
 
3
- # PARTS
4
-
5
- def self.part key, system: nil
6
- App.connect_part self, key, system
7
- end
8
-
9
- def self.const_missing name
10
- Liza.const name
11
- rescue Liza::ConstNotFound => e
12
- raise NameError, "uninitialized constant #{name}", caller[1..], cause: nil
13
- end
14
-
15
- part :unit_procedure
3
+ # ERROR
4
+
5
+ class Error < Liza::Error; end
16
6
 
17
- # SETTINGS
7
+ # PART
18
8
 
19
- def self.settings
20
- @settings ||= {}
9
+ def self.part key, klass = nil, system: nil
10
+ Lizarb.connect_part self, key, klass, system
21
11
  end
22
12
 
23
- def self.get key
24
- return settings[key] if settings.has_key? key
13
+ # CONST MISSING
25
14
 
26
- found = nil
15
+ if Lizarb.ruby_supports_raise_cause?
27
16
 
28
- for klass in ancestors
29
- break unless klass.respond_to? :settings
17
+ def self.const_missing name
18
+ Liza.const name
19
+ rescue Liza::ConstNotFound
20
+ raise NameError, "uninitialized constant #{name}", caller[1..], cause: nil
21
+ end
30
22
 
31
- if klass.settings.has_key? key
32
- found = klass.settings[key]
23
+ else
33
24
 
34
- break
35
- end
25
+ def self.const_missing name
26
+ Liza.const name
27
+ rescue Liza::ConstNotFound
28
+ raise NameError, "uninitialized constant #{name}", caller[1..]
36
29
  end
37
30
 
38
- found = settings[key] = found.dup if found.is_a? Enumerable
39
-
40
- found
41
31
  end
42
32
 
43
- def self.set key, value
44
- settings[key] = value
45
- value
46
- end
33
+ # PARTS
47
34
 
48
- def self.add list, key = nil, value
49
- if key
50
- fetch(list) { Hash.new }[key] = value
51
- else
52
- fetch(list) { Set.new } << value
53
- end
54
- end
35
+ part :unit_classes
55
36
 
56
- def self.fetch key, &block
57
- x = get key
58
- x ||= set key, instance_eval(&block)
59
- x
60
- end
37
+ part :unit_logging
38
+
39
+ part :unit_methods
61
40
 
62
- def settings
63
- @settings ||= {}
41
+ part :unit_procedure
42
+
43
+ class RenderError < Error; end
44
+ class RendererNotFound < RenderError; end
45
+ class RenderStackIsFull < RenderError; end
46
+ class RenderStackIsEmpty < RenderError; end
47
+ part :unit_renderer
48
+
49
+ part :unit_settings
50
+
51
+ # TEST
52
+
53
+ def self.test_class
54
+ @test_class ||=
55
+ if first_namespace == "Liza"
56
+ Liza.const_get "#{last_namespace}Test"
57
+ else
58
+ Object.const_get "#{name}Test"
59
+ end
64
60
  end
65
61
 
66
- def get key
67
- return settings[key] if settings.has_key? key
62
+ # CONTROLLER
68
63
 
69
- self.class.get key
64
+ def self.division
65
+ Liza::Controller
70
66
  end
71
67
 
72
- def set key, value
73
- settings[key] = value
74
- end
68
+ # SYSTEM
75
69
 
76
- def add list, key = nil, value
77
- if key
78
- fetch(list) { Hash.new }[key] = value
70
+ def self.system
71
+ if name&.include? "::"
72
+ return System if first_namespace == "Liza"
73
+ Object.const_get first_namespace
79
74
  else
80
- fetch(list) { Set.new } << value
75
+ superclass.system
81
76
  end
82
77
  end
83
78
 
84
- def fetch key, &block
85
- x = get key
86
- x ||= set key, eval(&block)
87
- x
88
- end
89
-
90
- # LOG
79
+ singleton_class.send :public, :system
91
80
 
92
- LOG_LEVELS = {
93
- :higher => 2,
94
- :high => 1,
95
- :normal => 0,
96
- :low => -1,
97
- :lower => -2,
98
- }
99
-
100
- set :log_level, :normal
101
- set :log_color, :white
102
-
103
- #
104
-
105
- LOG_JUST = 40
106
-
107
- def self.log log_level = :normal, string
108
- raise "invalid log_level `#{log_level}`" unless LOG_LEVELS.keys.include? log_level
109
- return unless log_level? log_level
110
-
111
- source = (self.is_a? Class) ? self : self.class
112
- source = source.to_s.ljust(LOG_JUST).bold.colorize(source.log_color)
113
-
114
- string = "#{source} #{string}"
115
-
116
- DevBox[:log].call string
81
+ def system
82
+ self.class.system
117
83
  end
118
84
 
119
- def self.log_level
120
- get(:log_level) || :normal
121
- end
85
+ public :system
122
86
 
123
- def self.log_level? log_level = :normal
124
- # TODO
125
- true
126
- end
87
+ #
127
88
 
128
- def self.log_color
129
- (get(:system) || self).get :log_color
89
+ App.settings.each do |k, v|
90
+ set k, v
130
91
  end
92
+ set :division, Liza::Controller
93
+
94
+ end
131
95
 
132
- def self.log?(log_level = :normal)= log_level? log_level
133
- def log(...)= self.class.log(...)
134
- def log_level(...)= self.class.log_level(...)
135
- def log?(...)= self.class.log?(...)
136
- def log_level?(...)= self.class.log_level?(...)
137
- def log_color(...)= self.class.log_color(...)
138
-
139
- # SYSTEM
140
-
141
- def self.inherited_explicitly_sets_system
142
-
143
- def self.inherited sub
144
- super
145
-
146
- return unless sub.name.to_s.include? "::"
147
-
148
- system = Object.const_get sub.first_namespace
149
-
150
- sub.set :system, system
151
- end
96
+ __END__
152
97
 
153
- end
154
-
155
- end
98
+ # view render.txt.erb
99
+ <%= render if render_stack.any? -%>
@@ -0,0 +1,37 @@
1
+ class Liza::UnitClassesPart < Liza::Part
2
+
3
+ insertion do
4
+
5
+ def self.subclasses_select system:
6
+ subclasses.select { _1.system? system }
7
+ end
8
+
9
+ def self.descendants_select system:
10
+ descendants.select { _1.system? system }
11
+ end
12
+
13
+ def self.namespace
14
+ return @namespace if defined? @namespace
15
+
16
+ @namespace ||= Object unless to_s.include? "::"
17
+ @namespace ||= Liza if to_s.start_with? "Liza::"
18
+ @namespace ||= system
19
+ @namespace
20
+ end
21
+
22
+ def self.system? system
23
+ system = Liza.const "#{system}_system" if system.is_a? Symbol
24
+ system == get(:system)
25
+ end
26
+
27
+ def self.reload!
28
+ Lizarb.reload
29
+ end
30
+
31
+ def reload!
32
+ Lizarb.reload
33
+ end
34
+
35
+ end
36
+
37
+ end
@@ -0,0 +1,3 @@
1
+ class Liza::UnitClassesPartTest < Liza::UnitTest
2
+
3
+ end