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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ebe2ac1c0a6d2e86f70577662d985ea755707a6855e67bcc0fc1e3d8f89ac563
4
- data.tar.gz: 47544f75a230d272e38bd50adacd388d4cb8a8710da689ae24ca0fe187e7d3f6
3
+ metadata.gz: 53e926fac5423110d8a9468bac9598dbe3a88922c61ac584311dc2b9a49ce81f
4
+ data.tar.gz: 0a2e15f3cd064944b01d02a8761fca520a3167172c7193c00f7c5d807e0e88ba
5
5
  SHA512:
6
- metadata.gz: 8427b2e5710ccff4f9031adc64b9ad9e3fcdc4dea4565f933dc34b91f72378230b7946e020074832c8e7f44c7c5085bc0c3dc503b98d9852a2fb207b685f41b1
7
- data.tar.gz: a8fa9c03c1cfa03947e3be6a35b610192cb2a50f5111f175b3211ee1ca35fcafbc371583c53e3b006735873fd5c07897c8dd3edcf6fb0235fac49353e19a460d
6
+ metadata.gz: ba9279ab0d31e64b01d41d764542a73465171497950a681119ecc2a2c8f01a66f04172dc67617b03c92a04302c8772c88209f5803053cf1c405216ac5cb003d9
7
+ data.tar.gz: 5b27e32f1f16dd6c2536c4ad6046bb782a9eb20a8e8c9f68d7b6ab412950a464367193b435e801f9c3b442120414ad0cf7b8f034c3fae40b9050efebcf2cfe17
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- lizarb (1.0.2)
4
+ lizarb (1.0.3)
5
5
  colorize (~> 0.8)
6
6
  dotenv (~> 2.8)
7
7
  zeitwerk (~> 2.6)
data/app/dev_box.rb CHANGED
@@ -1,13 +1,33 @@
1
1
  class DevBox < Liza::DevBox
2
2
 
3
- commands do
4
- # Set up your command panel per the DSL in http://guides.lizarb.com/panels/command.html
3
+ # Set up your bench panel per the DSL in http://guides.lizarb.org/panels/bench.html
4
+ panel :bench do
5
+ # set :log_level, ENV["dev.bench.log_level"]
6
+ end
7
+
8
+ # Set up your command panel per the DSL in http://guides.lizarb.org/panels/command.html
9
+ panel :command do
10
+ # set :log_level, ENV["dev.command.log_level"]
11
+ end
5
12
 
13
+ # Set up your generator panel per the DSL in http://guides.lizarb.org/panels/generator.html
14
+ panel :generator do
15
+ # set :log_level, ENV["dev.generator.log_level"]
6
16
  end
7
17
 
8
- logs do
9
- # Set up your log panel per the DSL in http://guides.lizarb.com/panels/log.html
18
+ # Set up your command panel per the DSL in http://guides.lizarb.org/panels/log.html
19
+ panel :log do
20
+ # set :log_level, ENV["dev.log.log_level"]
21
+ end
22
+
23
+ # Set up your shell panel per the DSL in http://guides.lizarb.org/panels/shell.html
24
+ panel :shell do
25
+ # set :log_level, ENV["dev.shell.log_level"]
26
+ end
10
27
 
28
+ # Set up your terminal panel per the DSL in http://guides.lizarb.org/panels/terminal.html
29
+ panel :terminal do
30
+ # set :log_level, ENV["dev.terminal.log_level"]
11
31
  end
12
32
 
13
33
  end
data/app/happy_box.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  class HappyBox < Liza::HappyBox
2
2
 
3
- axo do
3
+ panel :axo do
4
4
  # Set up your axo panel per the DSL in http://guides.lizarb.com/panels/axo.html
5
5
 
6
6
  end
@@ -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
@@ -2,7 +2,7 @@ class AppRecordTest < Liza::RecordTest
2
2
 
3
3
  test :subject_class do
4
4
  assert subject_class == AppRecord
5
- assert subject_class.db == SqliteDb.current
5
+ assert subject_class.db == SqliteDb
6
6
  end
7
7
 
8
8
  end
@@ -2,7 +2,7 @@ class PostRecordTest < Liza::RecordTest
2
2
 
3
3
  test :subject_class do
4
4
  assert subject_class == PostRecord
5
- assert subject_class.db == SqliteDb.current
5
+ assert subject_class.db == SqliteDb
6
6
  end
7
7
 
8
8
  end
@@ -2,7 +2,7 @@ class UserRecordTest < Liza::RecordTest
2
2
 
3
3
  test :subject_class do
4
4
  assert subject_class == UserRecord
5
- assert subject_class.db == SqliteDb.current
5
+ assert subject_class.db == SqliteDb
6
6
  end
7
7
 
8
8
  end
data/app/net_box.rb CHANGED
@@ -1,20 +1,20 @@
1
1
  class NetBox < Liza::NetBox
2
2
 
3
- clients do
3
+ panel :client do
4
4
  # Set up 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 :sqlite, "tmp/app.#{Time.now.to_i}.sqlite" if App.mode == :code
8
- set :sqlite, "app.#{App.mode}.sqlite"
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
- databases do
12
+ panel :database do
13
13
  # Set up your database panel per the DSL in http://guides.lizarb.org/panels/database.html
14
14
 
15
- define :redis, RedisDb.current
16
- define :sql, SqliteDb.current
17
- define :sqlite, SqliteDb.current
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,6 +1,6 @@
1
1
  class WebBox < Liza::WebBox
2
2
 
3
- rack do
3
+ panel :rack do
4
4
  # Set up 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")
@@ -8,7 +8,7 @@ class WebBox < Liza::WebBox
8
8
  # set :port, 3000
9
9
  end
10
10
 
11
- requests do
11
+ panel :request do
12
12
  # Set up your request panel per the DSL in http://guides.lizarb.org/panels/request.html
13
13
 
14
14
  end
data/lib/app.rb CHANGED
@@ -27,7 +27,7 @@ module App
27
27
  check_mode!
28
28
 
29
29
  puts
30
- ::DevBox.commands.call argv
30
+ DevBox[:command].call argv
31
31
  puts
32
32
  end
33
33
 
@@ -1,29 +1,27 @@
1
- class DevSystem
2
- class NotFoundBench < Bench
1
+ class DevSystem::NotFoundBench < DevSystem::Bench
3
2
 
4
- def self.call args
5
- # 1. LOG
3
+ def self.call args
4
+ # 1. LOG
6
5
 
7
- log :higher, "Called #{self}.#{__method__} with args #{args}"
8
- puts
6
+ log :higher, "Called #{self}.#{__method__} with args #{args}"
7
+ puts
9
8
 
10
- # 2. FIND generators
9
+ # 2. FIND generators
11
10
 
12
- App.eager_load_all
13
- benches = Liza::Bench.descendants
11
+ App.eager_load_all
12
+ benches = Liza::Bench.descendants
14
13
 
15
- log "Liza comes with #{benches.count} benches you can use."
16
- puts
14
+ log "Liza comes with #{benches.count} benches you can use."
15
+ puts
17
16
 
18
- log "Here they are:"
19
- puts
17
+ log "Here they are:"
18
+ puts
20
19
 
21
- # 3. LIST benches
22
-
23
- keys = benches.map { |k| k.last_namespace.snakecase[0..-7] }.sort
24
- keys.reject! { |s| s == "not_found" }
25
- keys.each { |s| log "liza bench #{s}" }
26
- end
20
+ # 3. LIST benches
27
21
 
22
+ keys = benches.map { |k| k.last_namespace.snakecase[0..-7] }.sort
23
+ keys.reject! { |s| s == "not_found" }
24
+ keys.each { |s| log "liza bench #{s}" }
28
25
  end
26
+
29
27
  end
@@ -1,14 +1,12 @@
1
- class DevSystem
2
- class NotFoundBenchTest < BenchTest
1
+ class DevSystem::NotFoundBenchTest < DevSystem::BenchTest
3
2
 
4
- test :subject_class do
5
- assert subject_class == DevSystem::NotFoundBench
6
- end
7
-
8
- test :settings do
9
- assert subject_class.log_level == :normal
10
- assert subject_class.log_color == :green
11
- end
3
+ test :subject_class do
4
+ assert subject_class == DevSystem::NotFoundBench
5
+ end
6
+
7
+ test :settings do
8
+ assert subject_class.log_level == :normal
9
+ assert subject_class.log_color == :green
10
+ end
12
11
 
13
- end
14
12
  end
@@ -1,11 +1,9 @@
1
- class DevSystem
2
- class Bench < Liza::Controller
1
+ class DevSystem::Bench < Liza::Controller
3
2
 
4
- # DSLS
5
-
6
- def self.main_dsl
7
- part :"bench_dsl_main", system: :dev
8
- end
3
+ # DSLS
9
4
 
5
+ def self.main_dsl
6
+ part :"bench_dsl_main", system: :dev
10
7
  end
8
+
11
9
  end
@@ -1,60 +1,58 @@
1
- class DevSystem
2
- class BenchDslMainPart < Liza::Part
1
+ class DevSystem::BenchDslMainPart < Liza::Part
3
2
 
4
- insertion do
3
+ insertion do
5
4
 
6
- def self.call args
7
- log :higher, "Called #{self}.#{__method__} with args #{args}"
5
+ def self.call args
6
+ log :higher, "Called #{self}.#{__method__} with args #{args}"
8
7
 
9
- # https://rubyapi.org/3.1/o/benchmark
10
- require "benchmark"
8
+ # https://rubyapi.org/3.1/o/benchmark
9
+ require "benchmark"
11
10
 
12
- if @setup_bl
13
- log "Setting up..."
14
- instance_exec &@setup_bl
15
- log "Set up"
16
- end
11
+ if @setup_bl
12
+ log "Setting up..."
13
+ instance_exec &@setup_bl
14
+ log "Set up"
15
+ end
17
16
 
18
- log "Benchmarking #{marks.count} Ruby Blocks"
19
- puts
17
+ log "Benchmarking #{marks.count} Ruby Blocks"
18
+ puts
20
19
 
21
- length = marks.keys.map(&:length).max
20
+ length = marks.keys.map(&:length).max
22
21
 
23
- marks.each do |label, bl|
24
- log "Benchmarking #{label}"
25
- marks[label] = Benchmark.measure label, &bl
26
- end
22
+ marks.each do |label, bl|
23
+ log "Benchmarking #{label}"
24
+ marks[label] = Benchmark.measure label, &bl
25
+ end
27
26
 
28
- puts
27
+ puts
29
28
 
30
- log "#{"Reporting".ljust_blanks(length + 17)} App CPU Time Kernel CPU Time Total CPU Time"
31
- puts
29
+ log "#{"Reporting".ljust_blanks(length + 17)} App CPU Time Kernel CPU Time Total CPU Time"
30
+ puts
32
31
 
33
- sorted = marks.sort_by { |_k, tms| tms.total }.to_h
32
+ sorted = marks.sort_by { |_k, tms| tms.total }.to_h
34
33
 
35
- sorted.each.with_index do |(label, tms), i|
36
- tms = tms.format "%10.6u %10.6y %10.6t"
37
- s = "[#{i.next.to_s.rjust_zeroes 2}/#{marks.count.to_s.rjust_zeroes 2}] #{label.rjust_blanks length} #{tms}"
34
+ sorted.each.with_index do |(label, tms), i|
35
+ tms = tms.format "%10.6u %10.6y %10.6t"
36
+ s = "[#{i.next.to_s.rjust_zeroes 2}/#{marks.count.to_s.rjust_zeroes 2}] #{label.rjust_blanks length} #{tms}"
38
37
 
39
- s = s.green if i == 0
40
- s = s.red if i == marks.count-1
41
- log s
42
- end
43
- puts
44
- log "Done"
38
+ s = s.green if i == 0
39
+ s = s.red if i == marks.count-1
40
+ log s
45
41
  end
42
+ puts
43
+ log "Done"
44
+ end
46
45
 
47
- #
48
-
49
- def self.marks()= @marks ||= {}
46
+ #
50
47
 
51
- def self.mark(label, &block)= marks[label] = block
48
+ def self.marks()= @marks ||= {}
52
49
 
53
- def self.setup &block
54
- @setup_bl = block if block_given?
55
- end
50
+ def self.mark(label, &block)= marks[label] = block
56
51
 
52
+ def self.setup &block
53
+ @setup_bl = block if block_given?
57
54
  end
58
55
 
59
56
  end
57
+
60
58
  end
@@ -1,14 +1,12 @@
1
- class DevSystem
2
- class BenchTest < Liza::ControllerTest
1
+ class DevSystem::BenchTest < Liza::ControllerTest
3
2
 
4
- test :subject_class do
5
- assert subject_class == DevSystem::Bench
6
- end
7
-
8
- test :settings do
9
- assert subject_class.log_level == :normal
10
- assert subject_class.log_color == :green
11
- end
3
+ test :subject_class do
4
+ assert subject_class == DevSystem::Bench
5
+ end
12
6
 
7
+ test :settings do
8
+ assert subject_class.log_level == :normal
9
+ assert subject_class.log_color == :green
13
10
  end
11
+
14
12
  end
@@ -1,34 +1,32 @@
1
- class DevSystem
2
- class BenchCommand < Command
1
+ class DevSystem::BenchCommand < DevSystem::Command
3
2
 
4
- def self.call args
5
- # 1. LOG
3
+ def self.call args
4
+ # 1. LOG
6
5
 
7
- log :higher, "args: #{args}"
8
- puts
6
+ log :higher, "args: #{args}"
7
+ puts
9
8
 
10
- # 2. FIND bench
9
+ # 2. FIND bench
11
10
 
12
- return call_not_found args if args.none?
11
+ return call_not_found args if args.none?
13
12
 
14
- bench = args[0]
13
+ bench = args[0]
15
14
 
16
- log({bench:})
15
+ log({bench:})
17
16
 
18
- begin
19
- bench_klass = Liza.const "#{bench}_bench"
20
- rescue Liza::ConstNotFound
21
- bench_klass = NotFoundBench
22
- end
23
-
24
- # 3. CALL
25
-
26
- bench_klass.call args[1..-1]
17
+ begin
18
+ bench_klass = Liza.const "#{bench}_bench"
19
+ rescue Liza::ConstNotFound
20
+ bench_klass = NotFoundBench
27
21
  end
28
22
 
29
- def self.call_not_found args
30
- Liza::NotFoundBench.call args
31
- end
23
+ # 3. CALL
32
24
 
25
+ bench_klass.call args[1..-1]
33
26
  end
27
+
28
+ def self.call_not_found args
29
+ Liza::NotFoundBench.call args
30
+ end
31
+
34
32
  end
@@ -1,14 +1,12 @@
1
- class DevSystem
2
- class BenchCommandTest < CommandTest
1
+ class DevSystem::BenchCommandTest < DevSystem::CommandTest
3
2
 
4
- test :subject_class do
5
- assert subject_class == DevSystem::BenchCommand
6
- end
7
-
8
- test :settings do
9
- assert subject_class.log_level == :normal
10
- assert subject_class.log_color == :green
11
- end
3
+ test :subject_class do
4
+ assert subject_class == DevSystem::BenchCommand
5
+ end
12
6
 
7
+ test :settings do
8
+ assert subject_class.log_level == :normal
9
+ assert subject_class.log_color == :green
13
10
  end
11
+
14
12
  end
@@ -1,11 +1,9 @@
1
- class DevSystem
2
- class EchoCommand < Command
1
+ class DevSystem::EchoCommand < DevSystem::Command
3
2
 
4
- def self.call args
5
- log :higher, "Called #{self} with args #{args}"
6
-
7
- raise RuntimeError, args.to_s
8
- end
3
+ def self.call args
4
+ log :higher, "Called #{self} with args #{args}"
9
5
 
6
+ raise RuntimeError, args.to_s
10
7
  end
8
+
11
9
  end
@@ -1,14 +1,12 @@
1
- class DevSystem
2
- class EchoCommandTest < CommandTest
1
+ class DevSystem::EchoCommandTest < DevSystem::CommandTest
3
2
 
4
- test :subject_class do
5
- assert subject_class == DevSystem::EchoCommand
6
- end
7
-
8
- test :settings do
9
- assert subject_class.log_level == :normal
10
- assert subject_class.log_color == :green
11
- end
3
+ test :subject_class do
4
+ assert subject_class == DevSystem::EchoCommand
5
+ end
12
6
 
7
+ test :settings do
8
+ assert subject_class.log_level == :normal
9
+ assert subject_class.log_color == :green
13
10
  end
11
+
14
12
  end
@@ -1,35 +1,33 @@
1
- class DevSystem
2
- class GenerateCommand < Command
1
+ class DevSystem::GenerateCommand < DevSystem::Command
3
2
 
4
- def self.call args
5
- # 1. LOG
3
+ def self.call args
4
+ # 1. LOG
6
5
 
7
- log :higher, "args: #{args}"
8
- puts
6
+ log :higher, "args: #{args}"
7
+ puts
9
8
 
10
- # 2. FIND generator
9
+ # 2. FIND generator
11
10
 
12
- return call_not_found args if args.none?
11
+ return call_not_found args if args.none?
13
12
 
14
- generator = args[0]
13
+ generator = args[0]
15
14
 
16
- log({generator:})
15
+ log({generator:})
17
16
 
18
- #
17
+ #
19
18
 
20
- begin
21
- generator_class = Liza.const "#{generator}_generator"
22
- rescue Liza::ConstNotFound
23
- generator_class = NotFoundGenerator
24
- end
19
+ begin
20
+ generator_class = Liza.const "#{generator}_generator"
21
+ rescue Liza::ConstNotFound
22
+ generator_class = NotFoundGenerator
23
+ end
25
24
 
26
- # 3. CALL
25
+ # 3. CALL
27
26
 
28
- generator_class.call args[1..-1]
29
- end
27
+ generator_class.call args[1..-1]
28
+ end
30
29
 
31
- def self.call_not_found args
32
- Liza::NotFoundGenerator.call args
33
- end
30
+ def self.call_not_found args
31
+ Liza::NotFoundGenerator.call args
34
32
  end
35
33
  end
@@ -1,14 +1,12 @@
1
- class DevSystem
2
- class GenerateCommandTest < CommandTest
1
+ class DevSystem::GenerateCommandTest < DevSystem::CommandTest
3
2
 
4
- test :subject_class do
5
- assert subject_class == DevSystem::GenerateCommand
6
- end
7
-
8
- test :settings do
9
- assert subject_class.log_level == :normal
10
- assert subject_class.log_color == :green
11
- end
3
+ test :subject_class do
4
+ assert subject_class == DevSystem::GenerateCommand
5
+ end
12
6
 
7
+ test :settings do
8
+ assert subject_class.log_level == :normal
9
+ assert subject_class.log_color == :green
13
10
  end
11
+
14
12
  end
@@ -1,29 +1,27 @@
1
- class DevSystem
2
- class NotFoundCommand < Command
1
+ class DevSystem::NotFoundCommand < DevSystem::Command
3
2
 
4
- def self.call args
5
- # 1. LOG
3
+ def self.call args
4
+ # 1. LOG
6
5
 
7
- log :higher, "Called #{self}.#{__method__} with args #{args}"
8
- puts
6
+ log :higher, "Called #{self}.#{__method__} with args #{args}"
7
+ puts
9
8
 
10
- # 2. FIND commands
9
+ # 2. FIND commands
11
10
 
12
- App.eager_load_all
13
- commands = Liza::Command.descendants
11
+ App.eager_load_all
12
+ commands = Liza::Command.descendants
14
13
 
15
- log "Liza comes with #{commands.count} commands you can use."
16
- puts
14
+ log "Liza comes with #{commands.count} commands you can use."
15
+ puts
17
16
 
18
- log "Here they are:"
19
- puts
17
+ log "Here they are:"
18
+ puts
20
19
 
21
- # 3. LIST commands
22
-
23
- keys = commands.map { |k| k.last_namespace.snakecase[0..-9] }.sort
24
- keys.reject! { |s| s == "not_found" }
25
- keys.each { |s| log "liza #{s}" }
26
- end
20
+ # 3. LIST commands
27
21
 
22
+ keys = commands.map { |k| k.last_namespace.snakecase[0..-9] }.sort
23
+ keys.reject! { |s| s == "not_found" }
24
+ keys.each { |s| log "liza #{s}" }
28
25
  end
26
+
29
27
  end
@@ -1,14 +1,12 @@
1
- class DevSystem
2
- class NotFoundCommandTest < CommandTest
1
+ class DevSystem::NotFoundCommandTest < DevSystem::CommandTest
3
2
 
4
- test :subject_class do
5
- assert subject_class == DevSystem::NotFoundCommand
6
- end
7
-
8
- test :settings do
9
- assert subject_class.log_level == :normal
10
- assert subject_class.log_color == :green
11
- end
3
+ test :subject_class do
4
+ assert subject_class == DevSystem::NotFoundCommand
5
+ end
12
6
 
7
+ test :settings do
8
+ assert subject_class.log_level == :normal
9
+ assert subject_class.log_color == :green
13
10
  end
11
+
14
12
  end