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
@@ -1,18 +1,16 @@
1
- class NetSystem
2
- class DatabasePanelTest < Liza::PanelTest
1
+ class NetSystem::DatabasePanelTest < Liza::PanelTest
3
2
 
4
- test :subject_class do
5
- assert subject_class == NetSystem::DatabasePanel
6
- end
3
+ test :subject_class do
4
+ assert subject_class == NetSystem::DatabasePanel
5
+ end
7
6
 
8
- test :settings do
9
- assert subject_class.log_level == :normal
10
- assert subject_class.log_color == :red
11
- end
7
+ test :settings do
8
+ assert subject_class.log_level == :normal
9
+ assert subject_class.log_color == :red
10
+ end
12
11
 
13
- # test :call do
14
- # todo "write this"
15
- # end
12
+ # test :call do
13
+ # todo "write this"
14
+ # end
16
15
 
17
- end
18
16
  end
@@ -1,26 +1,35 @@
1
- class WebSystem
2
- class RackCommand < Liza::Command
1
+ class WebSystem::RackCommand < Liza::Command
3
2
 
4
- def self.call args
5
- log "args #{args}"
3
+ def self.call args
4
+ log "Called #{self}.#{__method__} with args #{args}"
5
+ new.call args
6
+ end
7
+
8
+ # instance methods
6
9
 
7
- strategy = nil
8
- host = nil
9
- port = nil
10
+ def call args
11
+ log "Called #{self}.#{__method__} with args #{args}"
10
12
 
11
- if args.any? && !args[0].include?("=")
12
- strategy = args.shift
13
- end
13
+ strategy = nil
14
+ host = nil
15
+ port = nil
14
16
 
15
- args.each do |arg|
16
- host = arg.split("=")[1] if arg.start_with? "h="
17
- port = arg.split("=")[1] if arg.start_with? "p="
18
- end
17
+ if args.any? && !args[0].include?("=")
18
+ strategy = args.shift
19
+ end
19
20
 
20
- log({strategy:, host:, port:})
21
-
22
- Liza.const(:web_box).rack.call strategy, host, port
21
+ args.each do |arg|
22
+ host = arg.split("=")[1] if arg.start_with? "h="
23
+ port = arg.split("=")[1] if arg.start_with? "p="
23
24
  end
24
25
 
26
+ log({strategy:, host:, port:})
27
+
28
+ rack_panel.call strategy, host, port
25
29
  end
30
+
31
+ def rack_panel
32
+ @rack_panel ||= WebBox[:rack]
33
+ end
34
+
26
35
  end
@@ -56,7 +56,7 @@ class WebSystem::RequestCommand < Liza::Command
56
56
 
57
57
  request_panel.find @env
58
58
 
59
- @request_class = @env["LIZA_REQUEST_CLASS"]
59
+ @request_class = @env["LIZA_REQUEST_CLASS"] || raise("No request class found")
60
60
 
61
61
  puts render "find.txt"
62
62
  end
@@ -90,7 +90,7 @@ class WebSystem::RequestCommand < Liza::Command
90
90
  # helpers
91
91
 
92
92
  def request_panel
93
- Liza.const(:web_box).requests
93
+ @request_panel ||= WebBox[:request]
94
94
  end
95
95
  end
96
96
 
@@ -1,11 +1,9 @@
1
- class WebSystem
2
- class WebCommand < Liza::Command
3
-
4
- def self.call args
5
- log "args #{args}"
6
- log "DEPRECATED: please use `lizarb rack` instead"
7
- RackCommand.call args
8
- end
1
+ class WebSystem::WebCommand < Liza::Command
9
2
 
3
+ def self.call args
4
+ log "args #{args}"
5
+ log "DEPRECATED: please use `lizarb rack` instead"
6
+ RackCommand.call args
10
7
  end
8
+
11
9
  end
@@ -1,8 +1,6 @@
1
- class WebSystem
2
- class Rack < Liza::Controller
1
+ class WebSystem::Rack < Liza::Controller
2
+
3
+ # def self.call rack_app, host, port
4
+ # end
3
5
 
4
- # def self.call rack_app, host, port
5
- # end
6
-
7
- end
8
6
  end
@@ -1,18 +1,16 @@
1
- class WebSystem
2
- class RackTest < Liza::ControllerTest
1
+ class WebSystem::RackTest < Liza::ControllerTest
3
2
 
4
- test :subject_class do
5
- assert subject_class == WebSystem::Rack
6
- end
3
+ test :subject_class do
4
+ assert subject_class == WebSystem::Rack
5
+ end
7
6
 
8
- test :settings do
9
- assert subject_class.log_level == :normal
10
- assert subject_class.log_color == :blue
11
- end
7
+ test :settings do
8
+ assert subject_class.log_level == :normal
9
+ assert subject_class.log_color == :blue
10
+ end
12
11
 
13
- # test :call do
14
- # todo "write this"
15
- # end
12
+ # test :call do
13
+ # todo "write this"
14
+ # end
16
15
 
17
- end
18
16
  end
@@ -1,17 +1,15 @@
1
- class WebSystem
2
- class ClientErrorRequest < Request
1
+ class WebSystem::ClientErrorRequest < WebSystem::Request
3
2
 
4
- def self.call env
5
- status = 400
3
+ def self.call env
4
+ status = 400
6
5
 
7
- headers = {
8
- "Framework" => "Liza #{Lizarb::VERSION}"
9
- }
6
+ headers = {
7
+ "Framework" => "Liza #{Lizarb::VERSION}"
8
+ }
10
9
 
11
- body = "Client Error #{status} - #{env["LIZA_PATH"]}"
12
-
13
- [status, headers, [body]]
14
- end
10
+ body = "Client Error #{status} - #{env["LIZA_PATH"]}"
15
11
 
12
+ [status, headers, [body]]
16
13
  end
14
+
17
15
  end
@@ -1,17 +1,15 @@
1
- class WebSystem
2
- class NotFoundRequest < Request
1
+ class WebSystem::NotFoundRequest < WebSystem::Request
3
2
 
4
- def self.call env
5
- status = 404
3
+ def self.call env
4
+ status = 404
6
5
 
7
- headers = {
8
- "Framework" => "Liza #{Lizarb::VERSION}"
9
- }
6
+ headers = {
7
+ "Framework" => "Liza #{Lizarb::VERSION}"
8
+ }
10
9
 
11
- body = "Client Error #{status} - #{env["LIZA_PATH"]}"
12
-
13
- [status, headers, [body]]
14
- end
10
+ body = "Client Error #{status} - #{env["LIZA_PATH"]}"
15
11
 
12
+ [status, headers, [body]]
16
13
  end
14
+
17
15
  end
@@ -1,19 +1,17 @@
1
- class WebSystem
2
- class ServerErrorRequest < Request
1
+ class WebSystem::ServerErrorRequest < WebSystem::Request
3
2
 
4
- def self.call env
5
- status = 500
3
+ def self.call env
4
+ status = 500
6
5
 
7
- headers = {
8
- "Framework" => "Liza #{Lizarb::VERSION}"
9
- }
6
+ headers = {
7
+ "Framework" => "Liza #{Lizarb::VERSION}"
8
+ }
10
9
 
11
- e = env["LIZA_ERROR"]
10
+ e = env["LIZA_ERROR"]
12
11
 
13
- body = "Server Error #{status} - #{e.class} - #{e.message}"
14
-
15
- [status, headers, [body]]
16
- end
12
+ body = "Server Error #{status} - #{e.class} - #{e.message}"
17
13
 
14
+ [status, headers, [body]]
18
15
  end
16
+
19
17
  end
@@ -1,5 +1,3 @@
1
- class WebSystem
2
- class Request < Liza::Controller
1
+ class WebSystem::Request < Liza::Controller
3
2
 
4
- end
5
3
  end
@@ -1,18 +1,16 @@
1
- class WebSystem
2
- class RequestTest < Liza::ControllerTest
1
+ class WebSystem::RequestTest < Liza::ControllerTest
3
2
 
4
- test :subject_class do
5
- assert subject_class == WebSystem::Request
6
- end
3
+ test :subject_class do
4
+ assert subject_class == WebSystem::Request
5
+ end
7
6
 
8
- test :settings do
9
- assert subject_class.log_level == :normal
10
- assert subject_class.log_color == :blue
11
- end
7
+ test :settings do
8
+ assert subject_class.log_level == :normal
9
+ assert subject_class.log_color == :blue
10
+ end
12
11
 
13
- # test :call do
14
- # todo "write this"
15
- # end
12
+ # test :call do
13
+ # todo "write this"
14
+ # end
16
15
 
17
- end
18
16
  end
@@ -1,44 +1,42 @@
1
- class WebSystem
2
- class RackPanel < Liza::Panel
3
-
4
- def call strategy, host, port
5
- puts
6
- log({strategy:, host:, port:})
7
-
8
- strategy ||= get :strategy
9
- host ||= get :host
10
- port ||= 3000
11
- files ||= get :files
12
-
13
- log({strategy:, host:, port:})
14
-
15
- x = App.mode == :code ? "development" : "production"
16
- ENV["RACK_ENV"] = x
17
- rack_app = send "get_rack_app_#{x}"
18
-
19
- rack_files = Object::Rack::Files.new files
20
- rack_app = Object::Rack::Cascade.new [rack_files, rack_app]
21
-
22
- # TODO: PumaRack
23
- # handler = Liza.const(:"#{strategy}_rack")
24
-
25
- require "rack/handler/puma"
26
- handler = Object::Rack::Handler::Puma
27
- handler.run rack_app, Host: host, Port: port
28
- end
1
+ class WebSystem::RackPanel < Liza::Panel
2
+
3
+ def call strategy, host, port
4
+ puts
5
+ log({strategy:, host:, port:})
6
+
7
+ strategy ||= get :strategy
8
+ host ||= get :host
9
+ port ||= 3000
10
+ files ||= get :files
11
+
12
+ log({strategy:, host:, port:})
13
+
14
+ x = App.mode == :code ? "development" : "production"
15
+ ENV["RACK_ENV"] = x
16
+ rack_app = send "get_rack_app_#{x}"
17
+
18
+ rack_files = Object::Rack::Files.new files
19
+ rack_app = Object::Rack::Cascade.new [rack_files, rack_app]
29
20
 
30
- def get_rack_app_production()= Liza.const(:web_box).requests
31
-
32
- def get_rack_app_development
33
- Proc.new do |env|
34
- ret = nil
35
- App.reload do
36
- log "reloading"
37
- ret = get_rack_app_production.call env
38
- end
39
- ret
21
+ # TODO: PumaRack
22
+ # handler = Liza.const(:"#{strategy}_rack")
23
+
24
+ require "rack/handler/puma"
25
+ handler = Object::Rack::Handler::Puma
26
+ handler.run rack_app, Host: host, Port: port
27
+ end
28
+
29
+ def get_rack_app_production()= WebBox[:request]
30
+
31
+ def get_rack_app_development
32
+ Proc.new do |env|
33
+ ret = nil
34
+ App.reload do
35
+ log "reloading"
36
+ ret = get_rack_app_production.call env
40
37
  end
38
+ ret
41
39
  end
42
-
43
40
  end
41
+
44
42
  end
@@ -1,14 +1,12 @@
1
- class WebSystem
2
- class RackPanelTest < Liza::PanelTest
1
+ class WebSystem::RackPanelTest < Liza::PanelTest
3
2
 
4
- test :settings do
5
- assert subject_class.log_level == :normal
6
- assert subject_class.log_color == :blue
7
- end
3
+ test :settings do
4
+ assert subject_class.log_level == :normal
5
+ assert subject_class.log_color == :blue
6
+ end
8
7
 
9
- # test :call do
10
- # todo "write this"
11
- # end
8
+ # test :call do
9
+ # todo "write this"
10
+ # end
12
11
 
13
- end
14
12
  end
@@ -1,74 +1,72 @@
1
- class WebSystem
2
- class RequestPanel < Liza::Panel
3
-
4
- def call env
5
- t = Time.now
6
- request_klass = find env
7
- ret = request_klass.call env
8
- _html_beautify env, ret
9
- ret
10
- rescue => e
11
- request_klass = ServerErrorRequest
12
- env["LIZA_ERROR"] = e
13
-
14
- ret = request_klass.call env
15
- ensure
16
- log "#{ret[0]} with #{ret[2].first.size} bytes in #{t.diff}s"
17
- puts
18
- ret
19
- end
20
-
21
- #
1
+ class WebSystem::RequestPanel < Liza::Panel
2
+
3
+ def call env
4
+ t = Time.now
5
+ request_klass = find env
6
+ ret = request_klass.call env
7
+ _html_beautify env, ret
8
+ ret
9
+ rescue => e
10
+ request_klass = WebSystem::ServerErrorRequest
11
+ env["LIZA_ERROR"] = e
12
+
13
+ ret = request_klass.call env
14
+ ensure
15
+ log "#{ret[0]} with #{ret[2].first.size} bytes in #{t.diff}s"
16
+ puts
17
+ ret
18
+ end
22
19
 
23
- def find env
24
- _prepare env
20
+ #
25
21
 
26
- path = env["LIZA_PATH"]
22
+ def find env
23
+ _prepare env
27
24
 
28
- segments = env["LIZA_SEGMENTS"].dup
29
- request = segments.shift || "root"
30
- action = segments.shift || "index"
25
+ path = env["LIZA_PATH"]
31
26
 
32
- env["LIZA_REQUEST"] = request
33
- env["LIZA_ACTION"] = action
34
- format = env["LIZA_FORMAT"]
27
+ segments = env["LIZA_SEGMENTS"].dup
28
+ request = segments.shift || "root"
29
+ action = segments.shift || "index"
35
30
 
36
- log({request:, action:, format:})
31
+ env["LIZA_REQUEST"] = request
32
+ env["LIZA_ACTION"] = action
33
+ format = env["LIZA_FORMAT"]
37
34
 
38
- env["LIZA_REQUEST_CLASS"] = _find_request_class request
39
- end
35
+ log({request:, action:, format:})
40
36
 
41
- def _find_request_class request
42
- Liza.const "#{request}_request"
43
- rescue NameError
44
- NotFoundRequest
45
- end
37
+ env["LIZA_REQUEST_CLASS"] = _find_request_class request
38
+ end
46
39
 
47
- #
40
+ def _find_request_class request
41
+ Liza.const "#{request}_request"
42
+ rescue NameError
43
+ WebSystem::NotFoundRequest
44
+ end
48
45
 
49
- def _html_beautify env, ret
50
- return unless defined? HtmlBeautifier
51
- return unless env["LIZA_FORMAT"] == "html"
46
+ #
52
47
 
53
- body = ret[2].first
54
- body = HtmlBeautifier.beautify body
55
- ret[2] = [body]
56
- end
48
+ def _html_beautify env, ret
49
+ return unless defined? HtmlBeautifier
50
+ return unless env["LIZA_FORMAT"] == "html"
57
51
 
58
- def _prepare env
59
- log "#{env["REQUEST_METHOD"]} #{env["REQUEST_PATH"]}"
52
+ body = ret[2].first
53
+ body = HtmlBeautifier.beautify body
54
+ ret[2] = [body]
55
+ end
60
56
 
61
- path = env["REQUEST_PATH"]
57
+ def _prepare env
58
+ log "#{env["REQUEST_METHOD"]} #{env["REQUEST_PATH"]}"
62
59
 
63
- path, _sep, format = path.lpartition "."
64
- format = "html" if format.empty?
60
+ path = env["REQUEST_PATH"]
65
61
 
66
- segments = Array path.split("/")[1..-1]
62
+ path, _sep, format = path.lpartition "."
63
+ format = "html" if format.empty?
67
64
 
68
- env["LIZA_PATH"] = path
69
- env["LIZA_FORMAT"] = format
70
- env["LIZA_SEGMENTS"] = segments
71
- end
65
+ segments = Array path.split("/")[1..-1]
72
66
 
67
+ env["LIZA_PATH"] = path
68
+ env["LIZA_FORMAT"] = format
69
+ env["LIZA_SEGMENTS"] = segments
73
70
  end
71
+
74
72
  end
@@ -8,7 +8,7 @@ class WebSystem::RequestPanelTest < Liza::PanelTest
8
8
  #
9
9
 
10
10
  test :_prepare do
11
- subject = WebSystem::WebBox.requests
11
+ subject = WebBox[:request]
12
12
  env = {}
13
13
  env["REQUEST_PATH"] = "/foo/bar/baz"
14
14
  subject._prepare env
@@ -1,24 +1,20 @@
1
- class WebSystem
2
- class WebBox < Liza::Box
3
- has_panel :rack, :rack
4
- has_controller :rack, :rack
5
- has_panel :request, :requests
6
- has_controller :request, :requests
1
+ class WebSystem::WebBox < Liza::Box
7
2
 
8
- # Set up your rack panel per the DSL in http://guides.lizarb.org/panels/rack.html
9
- rack do
10
- # set :log_level, ENV["web.rack.log_level"]
11
-
12
- set :files, App.root.join("web_files")
13
- set :host, "localhost"
14
- set :port, 3000
15
- end
3
+ # Set up your rack panel per the DSL in http://guides.lizarb.org/panels/rack.html
4
+ panel :rack do
5
+ # set :log_level, ENV["web.rack.log_level"]
16
6
 
17
- # Set up your request panel per the DSL in http://guides.lizarb.org/panels/request.html
18
- requests do
19
- # set :log_level, ENV["web.request.log_level"]
7
+ set :files, App.root.join("web_files")
8
+ set :host, "localhost"
9
+ set :port, 3000
10
+ end
20
11
 
21
- end
12
+ # Set up your request panel per the DSL in http://guides.lizarb.org/panels/request.html
13
+ panel :request do
14
+ # set :log_level, ENV["web.request.log_level"]
22
15
 
23
16
  end
17
+
18
+ has_controller :rack, :rack
19
+ has_controller :request, :request
24
20
  end
@@ -1,18 +1,16 @@
1
- class WebSystem
2
- class WebBoxTest < Liza::BoxTest
1
+ class WebSystem::WebBoxTest < Liza::BoxTest
3
2
 
4
- test :subject_class do
5
- assert subject_class == WebSystem::WebBox
6
- end
7
-
8
- test :settings do
9
- assert subject_class.log_level == :normal
10
- assert subject_class.log_color == :blue
11
- end
3
+ test :subject_class do
4
+ assert subject_class == WebSystem::WebBox
5
+ end
12
6
 
13
- test :panels do
14
- assert subject_class.requests.is_a? RequestPanel
15
- end
7
+ test :settings do
8
+ assert subject_class.log_level == :normal
9
+ assert subject_class.log_color == :blue
10
+ end
16
11
 
12
+ test :panels do
13
+ assert subject_class[:request].is_a? WebSystem::RequestPanel
17
14
  end
15
+
18
16
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lizarb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thiago Pinto
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-02-26 00:00:00.000000000 Z
11
+ date: 2023-03-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize
@@ -140,9 +140,6 @@ files:
140
140
  - app/web/requests/root_request.rb
141
141
  - app/web/requests/root_request_test.rb
142
142
  - app/web_box.rb
143
- - app_new/.gitignore
144
- - app_new/Gemfile
145
- - app_new/Procfile
146
143
  - exe/Gemfile
147
144
  - exe/Gemfile.lock
148
145
  - exe/liza
@@ -202,10 +199,18 @@ files:
202
199
  - lib/dev_system/dev/controllers/terminal_test.rb
203
200
  - lib/dev_system/dev/dev_box.rb
204
201
  - lib/dev_system/dev/dev_box_test.rb
202
+ - lib/dev_system/dev/panels/bench_panel.rb
203
+ - lib/dev_system/dev/panels/bench_panel_test.rb
205
204
  - lib/dev_system/dev/panels/command_panel.rb
206
205
  - lib/dev_system/dev/panels/command_panel_test.rb
206
+ - lib/dev_system/dev/panels/generator_panel.rb
207
+ - lib/dev_system/dev/panels/generator_panel_test.rb
207
208
  - lib/dev_system/dev/panels/log_panel.rb
208
209
  - lib/dev_system/dev/panels/log_panel_test.rb
210
+ - lib/dev_system/dev/panels/shell_panel.rb
211
+ - lib/dev_system/dev/panels/shell_panel_test.rb
212
+ - lib/dev_system/dev/panels/terminal_panel.rb
213
+ - lib/dev_system/dev/panels/terminal_panel_test.rb
209
214
  - lib/happy_system.rb
210
215
  - lib/happy_system/dev/happy_command.rb
211
216
  - lib/happy_system/happy/controllers/axo.rb
data/app_new/.gitignore DELETED
@@ -1,4 +0,0 @@
1
- .gitignore/.bundle/
2
- /tmp/
3
- *.sqlite
4
- *.rdb