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
@@ -1,18 +1,16 @@
|
|
1
|
-
class NetSystem
|
2
|
-
class DatabasePanelTest < Liza::PanelTest
|
1
|
+
class NetSystem::DatabasePanelTest < Liza::PanelTest
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
test :subject_class do
|
4
|
+
assert subject_class == NetSystem::DatabasePanel
|
5
|
+
end
|
7
6
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
7
|
+
test :settings do
|
8
|
+
assert subject_class.log_level == :normal
|
9
|
+
assert subject_class.log_color == :red
|
10
|
+
end
|
12
11
|
|
13
|
-
|
14
|
-
|
15
|
-
|
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
|
-
|
5
|
-
|
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
|
-
|
8
|
-
|
9
|
-
port = nil
|
10
|
+
def call args
|
11
|
+
log "Called #{self}.#{__method__} with args #{args}"
|
10
12
|
|
11
|
-
|
12
|
-
|
13
|
-
|
13
|
+
strategy = nil
|
14
|
+
host = nil
|
15
|
+
port = nil
|
14
16
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
end
|
17
|
+
if args.any? && !args[0].include?("=")
|
18
|
+
strategy = args.shift
|
19
|
+
end
|
19
20
|
|
20
|
-
|
21
|
-
|
22
|
-
|
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
|
-
|
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,18 +1,16 @@
|
|
1
|
-
class WebSystem
|
2
|
-
class RackTest < Liza::ControllerTest
|
1
|
+
class WebSystem::RackTest < Liza::ControllerTest
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
test :subject_class do
|
4
|
+
assert subject_class == WebSystem::Rack
|
5
|
+
end
|
7
6
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
7
|
+
test :settings do
|
8
|
+
assert subject_class.log_level == :normal
|
9
|
+
assert subject_class.log_color == :blue
|
10
|
+
end
|
12
11
|
|
13
|
-
|
14
|
-
|
15
|
-
|
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
|
-
|
5
|
-
|
3
|
+
def self.call env
|
4
|
+
status = 400
|
6
5
|
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
headers = {
|
7
|
+
"Framework" => "Liza #{Lizarb::VERSION}"
|
8
|
+
}
|
10
9
|
|
11
|
-
|
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
|
-
|
5
|
-
|
3
|
+
def self.call env
|
4
|
+
status = 404
|
6
5
|
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
headers = {
|
7
|
+
"Framework" => "Liza #{Lizarb::VERSION}"
|
8
|
+
}
|
10
9
|
|
11
|
-
|
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
|
-
|
5
|
-
|
3
|
+
def self.call env
|
4
|
+
status = 500
|
6
5
|
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
headers = {
|
7
|
+
"Framework" => "Liza #{Lizarb::VERSION}"
|
8
|
+
}
|
10
9
|
|
11
|
-
|
10
|
+
e = env["LIZA_ERROR"]
|
12
11
|
|
13
|
-
|
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,18 +1,16 @@
|
|
1
|
-
class WebSystem
|
2
|
-
class RequestTest < Liza::ControllerTest
|
1
|
+
class WebSystem::RequestTest < Liza::ControllerTest
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
test :subject_class do
|
4
|
+
assert subject_class == WebSystem::Request
|
5
|
+
end
|
7
6
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
7
|
+
test :settings do
|
8
|
+
assert subject_class.log_level == :normal
|
9
|
+
assert subject_class.log_color == :blue
|
10
|
+
end
|
12
11
|
|
13
|
-
|
14
|
-
|
15
|
-
|
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
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
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
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
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
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
3
|
+
test :settings do
|
4
|
+
assert subject_class.log_level == :normal
|
5
|
+
assert subject_class.log_color == :blue
|
6
|
+
end
|
8
7
|
|
9
|
-
|
10
|
-
|
11
|
-
|
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
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
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
|
-
|
24
|
-
_prepare env
|
20
|
+
#
|
25
21
|
|
26
|
-
|
22
|
+
def find env
|
23
|
+
_prepare env
|
27
24
|
|
28
|
-
|
29
|
-
request = segments.shift || "root"
|
30
|
-
action = segments.shift || "index"
|
25
|
+
path = env["LIZA_PATH"]
|
31
26
|
|
32
|
-
|
33
|
-
|
34
|
-
|
27
|
+
segments = env["LIZA_SEGMENTS"].dup
|
28
|
+
request = segments.shift || "root"
|
29
|
+
action = segments.shift || "index"
|
35
30
|
|
36
|
-
|
31
|
+
env["LIZA_REQUEST"] = request
|
32
|
+
env["LIZA_ACTION"] = action
|
33
|
+
format = env["LIZA_FORMAT"]
|
37
34
|
|
38
|
-
|
39
|
-
end
|
35
|
+
log({request:, action:, format:})
|
40
36
|
|
41
|
-
|
42
|
-
|
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
|
-
|
50
|
-
return unless defined? HtmlBeautifier
|
51
|
-
return unless env["LIZA_FORMAT"] == "html"
|
46
|
+
#
|
52
47
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
end
|
48
|
+
def _html_beautify env, ret
|
49
|
+
return unless defined? HtmlBeautifier
|
50
|
+
return unless env["LIZA_FORMAT"] == "html"
|
57
51
|
|
58
|
-
|
59
|
-
|
52
|
+
body = ret[2].first
|
53
|
+
body = HtmlBeautifier.beautify body
|
54
|
+
ret[2] = [body]
|
55
|
+
end
|
60
56
|
|
61
|
-
|
57
|
+
def _prepare env
|
58
|
+
log "#{env["REQUEST_METHOD"]} #{env["REQUEST_PATH"]}"
|
62
59
|
|
63
|
-
|
64
|
-
format = "html" if format.empty?
|
60
|
+
path = env["REQUEST_PATH"]
|
65
61
|
|
66
|
-
|
62
|
+
path, _sep, format = path.lpartition "."
|
63
|
+
format = "html" if format.empty?
|
67
64
|
|
68
|
-
|
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
|
@@ -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
|
-
|
9
|
-
|
10
|
-
|
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
|
-
|
18
|
-
|
19
|
-
|
7
|
+
set :files, App.root.join("web_files")
|
8
|
+
set :host, "localhost"
|
9
|
+
set :port, 3000
|
10
|
+
end
|
20
11
|
|
21
|
-
|
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
|
-
|
5
|
-
|
6
|
-
|
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
|
-
|
14
|
-
|
15
|
-
|
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.
|
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-
|
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