lizarb 1.0.2 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +12 -13
- data/Rakefile +38 -0
- data/app/dev_box.rb +26 -4
- data/app/happy_box.rb +2 -2
- 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 +9 -9
- data/app/web_box.rb +4 -4
- data/app.rb +6 -7
- data/{exe/Gemfile → app_global.gemfile.rb} +2 -0
- data/app_global.gemfile.rb.lock +19 -0
- data/app_global.rb +4 -0
- data/{app → app_new}/dev/benches/loops_bench.rb +3 -2
- data/{app/dev/generators/bench_generator_test.rb → app_new/dev/benches/loops_bench_test.rb} +2 -2
- data/app_new/dev/benches/objects_bench.rb +83 -0
- data/{app/dev/generators/record_generator_test.rb → app_new/dev/benches/objects_bench_test.rb} +2 -2
- data/app_new/dev/benches/sorted_bench.rb +54 -0
- data/app_new/dev/benches/sorted_bench_test.rb +12 -0
- data/app_new/dev/benches/variables_bench.rb +55 -0
- data/{app/dev/generators/command_generator_test.rb → app_new/dev/benches/variables_bench_test.rb} +2 -2
- data/{app → app_new}/dev/commands/calculator_command.rb +1 -1
- data/{app → app_new}/dev/commands/circle_command.rb +1 -1
- data/{app → app_new}/dev/commands/narrative_method_command.rb +5 -7
- data/{app → app_new}/dev/commands/quadratic_command.rb +1 -1
- data/app_new/dev_box.rb +14 -0
- data/app_new.rb +15 -0
- data/exe/lizarb +9 -1
- data/lib/app.rb +27 -95
- data/lib/dev_system/dev/controllers/bench/not_found_bench.rb +23 -18
- data/lib/dev_system/dev/controllers/bench/not_found_bench_test.rb +9 -11
- data/lib/dev_system/dev/controllers/bench.rb +1 -9
- data/lib/dev_system/dev/controllers/bench_test.rb +8 -10
- data/lib/dev_system/dev/controllers/command/bench_command.rb +19 -22
- data/lib/dev_system/dev/controllers/command/bench_command_test.rb +8 -10
- data/lib/dev_system/dev/controllers/command/generate_command.rb +5 -31
- data/lib/dev_system/dev/controllers/command/generate_command_test.rb +8 -10
- data/lib/dev_system/dev/controllers/command/new_command.rb +9 -0
- data/lib/dev_system/dev/controllers/command/new_command_test.rb +7 -0
- data/lib/dev_system/dev/controllers/command/not_found_command.rb +37 -18
- 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.rb +9 -15
- 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 +33 -37
- data/lib/dev_system/dev/controllers/generator_test.rb +8 -10
- data/{app/dev/generators/bench_generator/bench.rb.erb → lib/dev_system/dev/controllers/generators/bench_generator/controller.rb.erb} +1 -2
- data/{app/dev/generators/bench_generator/bench_test.rb.erb → lib/dev_system/dev/controllers/generators/bench_generator/controller_test.rb.erb} +2 -2
- data/lib/dev_system/dev/controllers/generators/bench_generator.rb +12 -0
- data/lib/dev_system/dev/controllers/generators/bench_generator_test.rb +12 -0
- data/lib/dev_system/dev/controllers/generators/command_generator/controller.rb.erb +41 -0
- data/{app/dev/generators/command_generator/command_test.rb.erb → lib/dev_system/dev/controllers/generators/command_generator/controller_test.rb.erb} +2 -2
- data/lib/dev_system/dev/controllers/generators/command_generator.rb +19 -0
- data/lib/dev_system/dev/controllers/generators/command_generator_test.rb +12 -0
- data/lib/dev_system/dev/controllers/generators/controller_generator.rb +97 -0
- data/lib/dev_system/dev/controllers/generators/controller_generator_test.rb +12 -0
- data/lib/dev_system/dev/controllers/generators/generator_generator/template.rb.erb +1 -1
- data/lib/dev_system/dev/controllers/generators/new_generator.rb +117 -0
- data/lib/dev_system/dev/controllers/generators/new_generator_test.rb +12 -0
- data/lib/dev_system/dev/controllers/generators/not_found_generator.rb +27 -17
- data/lib/dev_system/dev/controllers/generators/not_found_generator_test.rb +8 -10
- data/{app/dev → lib/dev_system/dev/controllers}/generators/record_generator.rb +1 -1
- data/lib/dev_system/dev/controllers/generators/record_generator_test.rb +12 -0
- data/{app/dev → lib/dev_system/dev/controllers}/generators/request_generator.rb +2 -2
- data/lib/dev_system/dev/controllers/generators/request_generator_test.rb +12 -0
- data/lib/dev_system/dev/controllers/log.rb +3 -0
- data/{app/dev/generators/request_generator_test.rb → lib/dev_system/dev/controllers/log_test.rb} +2 -2
- data/lib/dev_system/dev/controllers/shell.rb +22 -0
- data/lib/dev_system/dev/controllers/shell_test.rb +25 -0
- data/lib/dev_system/dev/controllers/terminal/irb_terminal.rb +15 -11
- 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 +27 -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 +59 -18
- data/lib/dev_system/dev/panels/command_panel_test.rb +43 -20
- data/lib/dev_system/dev/panels/generator_panel.rb +73 -0
- data/lib/dev_system/dev/panels/generator_panel_test.rb +46 -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 +5 -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/lerb.rb +95 -49
- data/lib/liza/base/box.rb +76 -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 +40 -27
- data/lib/liza/base/panel_test.rb +36 -12
- data/lib/liza/base_parts/controller_renderer_part.rb +1 -1
- 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 +3 -3
- data/lib/liza/test/test.rb +7 -10
- data/lib/liza/test/test_test.rb +160 -157
- 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 +73 -120
- data/lib/liza/unit.rb +105 -107
- data/lib/liza/unit_parts/unit_procedure_part_test.rb +9 -9
- data/lib/liza/unit_parts/unit_settings_part.rb +76 -0
- data/lib/liza/unit_parts/unit_settings_part_test.rb +3 -0
- data/lib/liza/unit_test.rb +80 -71
- data/lib/liza.rb +10 -1
- data/lib/lizarb/ruby/module.rb +1 -1
- data/lib/lizarb/version.rb +1 -1
- data/lib/lizarb.rb +247 -23
- data/lib/net_system/dev/net_command.rb +15 -17
- 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 +9 -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 +20 -18
- data/lib/web_system/dev/request_command.rb +8 -22
- 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 +53 -57
- data/lib/web_system/web/panels/request_panel_test.rb +1 -1
- data/lib/web_system/web/web_box.rb +12 -18
- data/lib/web_system/web/web_box_test.rb +11 -13
- data/lizarb.gemspec +1 -1
- metadata +54 -44
- data/.ruby-version +0 -1
- data/app/dev/benches/app_bench.rb +0 -5
- data/app/dev/benches/app_bench_test.rb +0 -7
- data/app/dev/benches/loops_bench_test.rb +0 -11
- data/app/dev/commands/app_command.rb +0 -5
- data/app/dev/commands/app_command_test.rb +0 -7
- data/app/dev/commands/new_command.rb +0 -9
- data/app/dev/commands/new_command_test.rb +0 -7
- data/app/dev/generators/bench_generator.rb +0 -18
- data/app/dev/generators/command_generator/command.rb.erb +0 -26
- data/app/dev/generators/command_generator.rb +0 -18
- data/app_new/.gitignore +0 -4
- data/app_new/Gemfile +0 -31
- data/app_new/Procfile +0 -3
- data/exe/Gemfile.lock +0 -13
- data/lib/dev_system/dev/controllers/bench_dsl_main_part.rb +0 -60
- data/lib/dev_system/dev/controllers/command/echo_command.rb +0 -11
- data/lib/dev_system/dev/controllers/command/echo_command_test.rb +0 -14
- data/lib/dev_system/dev/controllers/command/version_command.rb +0 -9
- data/lib/dev_system/dev/controllers/command/version_command_test.rb +0 -14
- data/lib/dev_system/dev/controllers/generators/app_generator.rb +0 -96
- data/lib/dev_system/dev/controllers/generators/app_generator_test.rb +0 -14
- /data/{app → app_new}/dev/commands/calculator_command_test.rb +0 -0
- /data/{app → app_new}/dev/commands/circle_command_test.rb +0 -0
- /data/{app → app_new}/dev/commands/narrative_method_command_test.rb +0 -0
- /data/{app → app_new}/dev/commands/quadratic_command_test.rb +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d65d5afa1b18cd8fa2dee6e92af9e1dff3f29d17c34ccc1d76f5ac5137d4b4d8
|
4
|
+
data.tar.gz: 5c38cb0eaa603cba1050fa4ecc38ecf2004a5155ba47a68e65af24a199d7005c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe4544def7e3a7a085427efb77707d78071e50848fdf8941ab9490fb8a131cf60594439ce5c46f556c0ae2b20ecaa5dadadd81a224bb98e082513355e25ef1ed
|
7
|
+
data.tar.gz: 50e1451cfcd9f5b6981b343a1e400fdb77c1db761c1581e1ad0c49e062225a8e45a82229ae55dbca7b69f8bb50e6791f0f5e10d4147d69aaee543253e1e08179
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
lizarb (1.0.
|
4
|
+
lizarb (1.0.4)
|
5
5
|
colorize (~> 0.8)
|
6
6
|
dotenv (~> 2.8)
|
7
7
|
zeitwerk (~> 2.6)
|
@@ -11,30 +11,29 @@ GEM
|
|
11
11
|
specs:
|
12
12
|
coderay (1.1.3)
|
13
13
|
colorize (0.8.1)
|
14
|
-
connection_pool (2.
|
14
|
+
connection_pool (2.4.0)
|
15
15
|
dotenv (2.8.1)
|
16
16
|
htmlbeautifier (1.4.2)
|
17
17
|
method_source (1.0.0)
|
18
|
-
|
19
|
-
|
20
|
-
pry (0.14.1)
|
18
|
+
nio4r (2.5.9)
|
19
|
+
pry (0.14.2)
|
21
20
|
coderay (~> 1.1)
|
22
21
|
method_source (~> 1.0)
|
23
22
|
puma (5.6.5)
|
24
23
|
nio4r (~> 2.0)
|
25
|
-
rack (3.0.
|
26
|
-
rackup (0.2.
|
24
|
+
rack (3.0.7)
|
25
|
+
rackup (0.2.3)
|
27
26
|
rack (>= 3.0.0.beta1)
|
28
27
|
webrick
|
29
28
|
rake (13.0.6)
|
30
|
-
redis (5.0.
|
29
|
+
redis (5.0.6)
|
31
30
|
redis-client (>= 0.9.0)
|
32
|
-
redis-client (0.
|
31
|
+
redis-client (0.14.1)
|
33
32
|
connection_pool
|
34
|
-
sqlite3 (1.
|
35
|
-
|
36
|
-
webrick (1.
|
37
|
-
zeitwerk (2.6.
|
33
|
+
sqlite3 (1.6.3-arm64-darwin)
|
34
|
+
sqlite3 (1.6.3-x86_64-linux)
|
35
|
+
webrick (1.8.1)
|
36
|
+
zeitwerk (2.6.8)
|
38
37
|
|
39
38
|
PLATFORMS
|
40
39
|
arm64-darwin-21
|
data/Rakefile
CHANGED
@@ -1,6 +1,44 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "bundler/gem_tasks"
|
4
|
+
|
5
|
+
# Replaced tasks
|
6
|
+
|
4
7
|
task default: %i[] do
|
5
8
|
system "lizarb test"
|
6
9
|
end
|
10
|
+
|
11
|
+
# Custom tasks
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
# Custom prerequisite tasks
|
16
|
+
|
17
|
+
task :custom_gemfiles do
|
18
|
+
puts "... Bundling app_global.gemfile.rb"
|
19
|
+
system "VERBOSE=1 BUNDLE_GEMFILE=app_global.gemfile.rb bundle update"
|
20
|
+
|
21
|
+
puts "... Bundling Gemfile"
|
22
|
+
system "VERBOSE=1 BUNDLE_GEMFILE=Gemfile bundle"
|
23
|
+
|
24
|
+
puts "... Installing lizarb"
|
25
|
+
end
|
26
|
+
|
27
|
+
# Custom post-requisite tasks
|
28
|
+
|
29
|
+
task :custom_post_task do
|
30
|
+
puts "! Done"
|
31
|
+
# Add your custom behavior here
|
32
|
+
end
|
33
|
+
|
34
|
+
# Enhance
|
35
|
+
|
36
|
+
# Enhance the existing `build` task with the prerequisite
|
37
|
+
|
38
|
+
Rake::Task["build"].enhance [:custom_gemfiles]
|
39
|
+
|
40
|
+
# Enhance the existing `install` task with the post-requisite
|
41
|
+
|
42
|
+
Rake::Task["install"].enhance do
|
43
|
+
Rake.application.invoke_task :custom_post_task
|
44
|
+
end
|
data/app/dev_box.rb
CHANGED
@@ -1,13 +1,35 @@
|
|
1
1
|
class DevBox < Liza::DevBox
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
# Configure your bench panel per the DSL in http://guides.lizarb.org/panels/bench.html
|
4
|
+
configure :bench do
|
5
|
+
# set :log_level, ENV["dev.bench.log_level"]
|
6
|
+
end
|
7
|
+
|
8
|
+
# Configure your command panel per the DSL in http://guides.lizarb.org/panels/command.html
|
9
|
+
configure :command do
|
10
|
+
# set :log_level, ENV["dev.command.log_level"]
|
11
|
+
set :log_details, false
|
12
|
+
end
|
5
13
|
|
14
|
+
# Configure your generator panel per the DSL in http://guides.lizarb.org/panels/generator.html
|
15
|
+
configure :generator do
|
16
|
+
# set :log_level, ENV["dev.generator.log_level"]
|
17
|
+
set :log_details, false
|
6
18
|
end
|
7
19
|
|
8
|
-
|
9
|
-
|
20
|
+
# Configure your command panel per the DSL in http://guides.lizarb.org/panels/log.html
|
21
|
+
configure :log do
|
22
|
+
# set :log_level, ENV["dev.log.log_level"]
|
23
|
+
end
|
24
|
+
|
25
|
+
# Configure your shell panel per the DSL in http://guides.lizarb.org/panels/shell.html
|
26
|
+
configure :shell do
|
27
|
+
# set :log_level, ENV["dev.shell.log_level"]
|
28
|
+
end
|
10
29
|
|
30
|
+
# Configure your terminal panel per the DSL in http://guides.lizarb.org/panels/terminal.html
|
31
|
+
configure :terminal do
|
32
|
+
# set :log_level, ENV["dev.terminal.log_level"]
|
11
33
|
end
|
12
34
|
|
13
35
|
end
|
data/app/happy_box.rb
CHANGED
@@ -2,11 +2,11 @@ class SqliteDbTest < Liza::SqliteDbTest
|
|
2
2
|
|
3
3
|
test :subject_class do
|
4
4
|
assert subject_class == SqliteDb
|
5
|
-
assert SqliteDb.current.class == SqliteDb
|
6
|
-
assert Liza::SqliteDb.current.class == SqliteDb
|
7
|
-
assert SqliteDb.current == Liza::SqliteDb.current
|
8
|
-
assert SqliteDb.current.client == Liza::SqliteDb.current.client
|
9
|
-
assert SqliteDb.current.client.conn == Liza::SqliteDb.current.client.conn
|
5
|
+
# assert SqliteDb.current.class == SqliteDb
|
6
|
+
# assert Liza::SqliteDb.current.class == SqliteDb
|
7
|
+
# assert SqliteDb.current == Liza::SqliteDb.current
|
8
|
+
# assert SqliteDb.current.client == Liza::SqliteDb.current.client
|
9
|
+
# assert SqliteDb.current.client.conn == Liza::SqliteDb.current.client.conn
|
10
10
|
end
|
11
11
|
|
12
12
|
end
|
data/app/net_box.rb
CHANGED
@@ -1,20 +1,20 @@
|
|
1
1
|
class NetBox < Liza::NetBox
|
2
2
|
|
3
|
-
|
4
|
-
#
|
3
|
+
configure :client do
|
4
|
+
# Configure your client panel per the DSL in http://guides.lizarb.org/panels/client.html
|
5
5
|
|
6
6
|
set :redis_url, "redis://localhost:6379/15"
|
7
|
-
set :
|
8
|
-
set :
|
7
|
+
set :sqlite_path, "tmp/app.#{Time.now.to_i}.sqlite" if App.mode == :code
|
8
|
+
set :sqlite_path, "app.#{App.mode}.sqlite"
|
9
9
|
|
10
10
|
end
|
11
11
|
|
12
|
-
|
13
|
-
#
|
12
|
+
configure :database do
|
13
|
+
# Configure your database panel per the DSL in http://guides.lizarb.org/panels/database.html
|
14
14
|
|
15
|
-
define :redis, RedisDb
|
16
|
-
define :sql, SqliteDb
|
17
|
-
define :sqlite, SqliteDb
|
15
|
+
define :redis, RedisDb
|
16
|
+
define :sql, SqliteDb
|
17
|
+
define :sqlite, SqliteDb
|
18
18
|
|
19
19
|
end
|
20
20
|
|
data/app/web_box.rb
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
class WebBox < Liza::WebBox
|
2
2
|
|
3
|
-
rack do
|
4
|
-
#
|
3
|
+
configure :rack do
|
4
|
+
# Configure your rack panel per the DSL in http://guides.lizarb.org/panels/rack.html
|
5
5
|
|
6
6
|
# set :files, App.root.join("web_files")
|
7
7
|
# set :host, "localhost"
|
8
8
|
# set :port, 3000
|
9
9
|
end
|
10
10
|
|
11
|
-
|
12
|
-
#
|
11
|
+
configure :request do
|
12
|
+
# Configure your request panel per the DSL in http://guides.lizarb.org/panels/request.html
|
13
13
|
|
14
14
|
end
|
15
15
|
|
data/app.rb
CHANGED
@@ -1,17 +1,16 @@
|
|
1
|
-
App
|
1
|
+
class App
|
2
2
|
|
3
|
+
# Modes help you organize your application's behavior and settings.
|
4
|
+
|
5
|
+
mode :code
|
6
|
+
mode :demo
|
7
|
+
|
3
8
|
# Systems help you organize your application's dependencies and RAM memory usage.
|
4
|
-
# Learn more: http://guides.lizarb.org/systems.html
|
5
9
|
|
6
10
|
system :dev
|
7
11
|
system :happy
|
8
12
|
system :net
|
9
13
|
system :web
|
10
14
|
|
11
|
-
# Modes help you organize your application's behavior and settings.
|
12
|
-
# Learn more: http://guides.lizarb.org/modes.html
|
13
|
-
|
14
|
-
mode :code
|
15
|
-
mode :demo
|
16
15
|
|
17
16
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
GEM
|
2
|
+
remote: https://rubygems.org/
|
3
|
+
specs:
|
4
|
+
colorize (0.8.1)
|
5
|
+
dotenv (2.8.1)
|
6
|
+
lizarb (1.0.4)
|
7
|
+
colorize (~> 0.8)
|
8
|
+
dotenv (~> 2.8)
|
9
|
+
zeitwerk (~> 2.6)
|
10
|
+
zeitwerk (2.6.8)
|
11
|
+
|
12
|
+
PLATFORMS
|
13
|
+
x86_64-linux
|
14
|
+
|
15
|
+
DEPENDENCIES
|
16
|
+
lizarb (~> 1.0)
|
17
|
+
|
18
|
+
BUNDLED WITH
|
19
|
+
2.4.1
|
data/app_global.rb
ADDED
@@ -1,5 +1,4 @@
|
|
1
|
-
class LoopsBench <
|
2
|
-
main_dsl
|
1
|
+
class LoopsBench < SortedBench
|
3
2
|
|
4
3
|
setup do
|
5
4
|
N = 1_000_000
|
@@ -8,6 +7,8 @@ class LoopsBench < AppBench
|
|
8
7
|
HASH_INT = RANGE.map { |i| [i, i] }.to_h
|
9
8
|
HASH_STR = RANGE.map { |i| ["a#{i}", i] }.to_h
|
10
9
|
HASH_SYM = RANGE.map { |i| [:"a#{i}", i] }.to_h
|
10
|
+
|
11
|
+
log "setup N = #{N}"
|
11
12
|
end
|
12
13
|
|
13
14
|
mark "for i in RANGE" do
|
@@ -0,0 +1,83 @@
|
|
1
|
+
class ObjectsBench < SortedBench
|
2
|
+
|
3
|
+
setup do
|
4
|
+
N = 1_000_000
|
5
|
+
# N = 10_000_000
|
6
|
+
# N = 100_000_000
|
7
|
+
|
8
|
+
log "setup N = #{N}"
|
9
|
+
end
|
10
|
+
|
11
|
+
mark "BasicObject.new" do
|
12
|
+
i = 0
|
13
|
+
|
14
|
+
while (i += 1) <= N
|
15
|
+
BasicObject.new
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
mark "Object.new" do
|
20
|
+
i = 0
|
21
|
+
|
22
|
+
while (i += 1) <= N
|
23
|
+
Object.new
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
mark "String.new" do
|
28
|
+
i = 0
|
29
|
+
|
30
|
+
while (i += 1) <= N
|
31
|
+
String.new
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
mark "Numeric.new" do
|
36
|
+
i = 0
|
37
|
+
|
38
|
+
while (i += 1) <= N
|
39
|
+
Numeric.new
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
mark "Time.new" do
|
44
|
+
i = 0
|
45
|
+
|
46
|
+
while (i += 1) <= N
|
47
|
+
Time.new
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
mark "Proc.new {}" do
|
52
|
+
i = 0
|
53
|
+
|
54
|
+
while (i += 1) <= N
|
55
|
+
Proc.new {}
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
mark "Set.new" do
|
60
|
+
i = 0
|
61
|
+
|
62
|
+
while (i += 1) <= N
|
63
|
+
Set.new
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
mark "Array.new" do
|
68
|
+
i = 0
|
69
|
+
|
70
|
+
while (i += 1) <= N
|
71
|
+
Array.new
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
mark "Hash.new" do
|
76
|
+
i = 0
|
77
|
+
|
78
|
+
while (i += 1) <= N
|
79
|
+
Hash.new
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
class SortedBench < Liza::Bench
|
2
|
+
|
3
|
+
def self.call args
|
4
|
+
log "args = #{args.inspect}"
|
5
|
+
|
6
|
+
# https://rubyapi.org/3.1/o/benchmark
|
7
|
+
require "benchmark"
|
8
|
+
|
9
|
+
if @setup_bl
|
10
|
+
log "Setting up..."
|
11
|
+
instance_exec &@setup_bl
|
12
|
+
log "Set up"
|
13
|
+
end
|
14
|
+
|
15
|
+
log "Benchmarking #{marks.count} Ruby Blocks"
|
16
|
+
puts
|
17
|
+
|
18
|
+
length = marks.keys.map(&:length).max
|
19
|
+
|
20
|
+
marks.each do |label, bl|
|
21
|
+
log "Benchmarking #{label}"
|
22
|
+
marks[label] = Benchmark.measure label, &bl
|
23
|
+
end
|
24
|
+
|
25
|
+
puts
|
26
|
+
|
27
|
+
log "#{"Reporting".ljust_blanks(length + 17)} App CPU Time Kernel CPU Time Total CPU Time"
|
28
|
+
puts
|
29
|
+
|
30
|
+
sorted = marks.sort_by { |_k, tms| tms.total }.to_h
|
31
|
+
|
32
|
+
sorted.each.with_index do |(label, tms), i|
|
33
|
+
tms = tms.format "%10.6u %10.6y %10.6t"
|
34
|
+
s = "[#{i.next.to_s.rjust_zeroes 2}/#{marks.count.to_s.rjust_zeroes 2}] #{label.rjust_blanks length} #{tms}"
|
35
|
+
|
36
|
+
s = s.green if i == 0
|
37
|
+
s = s.red if i == marks.count-1
|
38
|
+
log s
|
39
|
+
end
|
40
|
+
puts
|
41
|
+
log "Done"
|
42
|
+
end
|
43
|
+
|
44
|
+
#
|
45
|
+
|
46
|
+
def self.marks()= @marks ||= {}
|
47
|
+
|
48
|
+
def self.mark(label, &block)= marks[label] = block
|
49
|
+
|
50
|
+
def self.setup &block
|
51
|
+
@setup_bl = block if block_given?
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class SortedBenchTest < Liza::BenchTest
|
2
|
+
|
3
|
+
test :subject_class do
|
4
|
+
assert_equality subject_class, SortedBench
|
5
|
+
end
|
6
|
+
|
7
|
+
test :settings do
|
8
|
+
assert_equality subject_class.log_level, :normal
|
9
|
+
assert_equality subject_class.log_color, :green
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
class VariablesBench < SortedBench
|
2
|
+
|
3
|
+
setup do
|
4
|
+
LETTERS = (Array("a".."z")+Array("A".."Z"))
|
5
|
+
N = 1_000
|
6
|
+
# N = 10_000
|
7
|
+
# N = 100_000
|
8
|
+
|
9
|
+
log "setup N = #{N}"
|
10
|
+
end
|
11
|
+
|
12
|
+
mark "local variable" do
|
13
|
+
i = 0
|
14
|
+
a = nil
|
15
|
+
|
16
|
+
while (i += 1) <= N
|
17
|
+
eval "v_#{random_name} = sample"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
mark "instance variable" do
|
22
|
+
i = 0
|
23
|
+
|
24
|
+
while (i += 1) <= N
|
25
|
+
eval "@v_#{random_name} = sample"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
mark "class variable" do
|
30
|
+
i = 0
|
31
|
+
|
32
|
+
while (i += 1) <= N
|
33
|
+
eval "@@v_#{random_name} = sample"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
mark "global variable" do
|
38
|
+
i = 0
|
39
|
+
|
40
|
+
while (i += 1) <= N
|
41
|
+
eval "$v_#{random_name} = sample"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
# helper methods
|
46
|
+
|
47
|
+
def self.random_name
|
48
|
+
LETTERS.shuffle.join("")
|
49
|
+
end
|
50
|
+
|
51
|
+
def self.sample
|
52
|
+
LETTERS.sample
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
@@ -3,17 +3,17 @@ class NarrativeMethodCommand < Liza::Command
|
|
3
3
|
class Invalid < Error; end
|
4
4
|
|
5
5
|
def self.call(args)
|
6
|
-
log "
|
6
|
+
log "args = #{args.inspect}"
|
7
7
|
new.call(args)
|
8
8
|
end
|
9
9
|
|
10
10
|
# instance methods
|
11
11
|
|
12
12
|
def call(args)
|
13
|
-
|
13
|
+
@args = args
|
14
|
+
log "@args = #{args.inspect}"
|
14
15
|
return help if args.empty?
|
15
16
|
|
16
|
-
@args = args
|
17
17
|
validate
|
18
18
|
perform
|
19
19
|
rescue StandardError => error
|
@@ -32,26 +32,24 @@ class NarrativeMethodCommand < Liza::Command
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def handle
|
35
|
-
log "Called #{self}.#{__method__}"
|
36
35
|
log render "error.txt"
|
37
36
|
end
|
38
37
|
|
39
38
|
def help
|
40
|
-
log "Called #{self}.#{__method__}"
|
41
39
|
log render "help.txt"
|
42
40
|
end
|
43
41
|
end
|
44
42
|
|
45
43
|
__END__
|
46
44
|
|
47
|
-
# success.txt.erb
|
45
|
+
# view success.txt.erb
|
48
46
|
|
49
47
|
RESULT:
|
50
48
|
|
51
49
|
class <%= @result.class %>
|
52
50
|
value <%= @result %>
|
53
51
|
|
54
|
-
# error.txt.erb
|
52
|
+
# view error.txt.erb
|
55
53
|
|
56
54
|
ERROR:
|
57
55
|
|