lizarb 0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (175) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -0
  3. data/CHANGELOG.md +13 -2
  4. data/Gemfile +22 -2
  5. data/Gemfile.lock +52 -0
  6. data/README.md +88 -12
  7. data/app/dev/benches/app_bench.rb +5 -0
  8. data/app/dev/benches/app_bench_test.rb +7 -0
  9. data/app/dev/benches/loops_bench.rb +148 -0
  10. data/app/dev/benches/loops_bench_test.rb +11 -0
  11. data/app/dev/commands/app_command.rb +5 -0
  12. data/app/dev/commands/app_command_test.rb +7 -0
  13. data/app/dev/commands/example_command.rb +57 -0
  14. data/app/dev/commands/example_command_test.rb +43 -0
  15. data/app/dev/commands/macro_child_command.rb +32 -0
  16. data/app/dev/commands/macro_child_command_test.rb +7 -0
  17. data/app/dev/commands/macro_parent_command.rb +70 -0
  18. data/app/dev/commands/macro_parent_command_test.rb +7 -0
  19. data/app/dev/commands/my_command.rb +7 -0
  20. data/app/dev/commands/my_command_test.rb +7 -0
  21. data/app/dev/commands/new_command.rb +9 -0
  22. data/app/dev/commands/new_command_test.rb +7 -0
  23. data/app/dev/generators/bench_generator.rb +67 -0
  24. data/app/dev/generators/bench_generator_test.rb +12 -0
  25. data/app/dev/generators/command_generator.rb +51 -0
  26. data/app/dev/generators/command_generator_test.rb +12 -0
  27. data/app/dev/generators/model_generator.rb +46 -0
  28. data/app/dev/generators/model_generator_test.rb +12 -0
  29. data/app/dev/generators/request_generator.rb +63 -0
  30. data/app/dev/generators/request_generator_test.rb +12 -0
  31. data/app/dev_box.rb +13 -0
  32. data/app/happy/axos/axo.rb +50 -0
  33. data/app/happy_box.rb +8 -0
  34. data/app/net/databases/redis_db.rb +5 -0
  35. data/app/net/databases/redis_db_test.rb +12 -0
  36. data/app/net/databases/sqlite_db.rb +11 -0
  37. data/app/net/databases/sqlite_db_test.rb +12 -0
  38. data/app/net/models/app_model.rb +20 -0
  39. data/app/net/models/app_model_test.rb +8 -0
  40. data/app/net/models/post_model.rb +4 -0
  41. data/app/net/models/post_model_test.rb +8 -0
  42. data/app/net/models/user_model.rb +4 -0
  43. data/app/net/models/user_model_test.rb +8 -0
  44. data/app/net_box.rb +21 -0
  45. data/app/web/requests/api_request.rb +61 -0
  46. data/app/web/requests/api_request_test.rb +31 -0
  47. data/app/web/requests/app_request.rb +5 -0
  48. data/app/web/requests/app_request_test.rb +7 -0
  49. data/app/web/requests/assets_request.rb +71 -0
  50. data/app/web/requests/assets_request_test.rb +33 -0
  51. data/app/web/requests/root_request.rb +55 -0
  52. data/app/web/requests/root_request_test.rb +31 -0
  53. data/app/web_box.rb +8 -0
  54. data/app.code.env +11 -0
  55. data/app.env +11 -0
  56. data/app.rb +17 -0
  57. data/app_new/.gitignore +4 -0
  58. data/app_new/Gemfile +31 -0
  59. data/app_new/Procfile +3 -0
  60. data/exe/Gemfile +3 -0
  61. data/exe/Gemfile.lock +13 -0
  62. data/exe/liza +3 -0
  63. data/exe/lizarb +11 -0
  64. data/lib/app.rb +200 -0
  65. data/lib/dev_system/dev/controllers/bench.rb +11 -0
  66. data/lib/dev_system/dev/controllers/bench_dsl_main_part.rb +60 -0
  67. data/lib/dev_system/dev/controllers/bench_test.rb +14 -0
  68. data/lib/dev_system/dev/controllers/command/bench_command.rb +24 -0
  69. data/lib/dev_system/dev/controllers/command/bench_command_test.rb +14 -0
  70. data/lib/dev_system/dev/controllers/command/dev_command.rb +24 -0
  71. data/lib/dev_system/dev/controllers/command/dev_command_test.rb +14 -0
  72. data/lib/dev_system/dev/controllers/command/echo_command.rb +11 -0
  73. data/lib/dev_system/dev/controllers/command/echo_command_test.rb +14 -0
  74. data/lib/dev_system/dev/controllers/command/generate_command.rb +23 -0
  75. data/lib/dev_system/dev/controllers/command/generate_command_test.rb +14 -0
  76. data/lib/dev_system/dev/controllers/command/test_command.rb +70 -0
  77. data/lib/dev_system/dev/controllers/command/test_command_test.rb +14 -0
  78. data/lib/dev_system/dev/controllers/command/version_command.rb +9 -0
  79. data/lib/dev_system/dev/controllers/command/version_command_test.rb +14 -0
  80. data/lib/dev_system/dev/controllers/command.rb +19 -0
  81. data/lib/dev_system/dev/controllers/command_test.rb +14 -0
  82. data/lib/dev_system/dev/controllers/generator.rb +11 -0
  83. data/lib/dev_system/dev/controllers/generator_dsl_main_part.rb +54 -0
  84. data/lib/dev_system/dev/controllers/generator_test.rb +14 -0
  85. data/lib/dev_system/dev/controllers/generators/app_generator.rb +71 -0
  86. data/lib/dev_system/dev/controllers/generators/app_generator_test.rb +14 -0
  87. data/lib/dev_system/dev/controllers/shell/file_shell.rb +29 -0
  88. data/lib/dev_system/dev/controllers/shell/file_shell_test.rb +14 -0
  89. data/lib/dev_system/dev/controllers/shell.rb +19 -0
  90. data/lib/dev_system/dev/controllers/shell_test.rb +13 -0
  91. data/lib/dev_system/dev/controllers/terminal/irb_terminal.rb +19 -0
  92. data/lib/dev_system/dev/controllers/terminal/irb_terminal_test.rb +14 -0
  93. data/lib/dev_system/dev/controllers/terminal/pry_terminal.rb +12 -0
  94. data/lib/dev_system/dev/controllers/terminal/pry_terminal_test.rb +14 -0
  95. data/lib/dev_system/dev/controllers/terminal.rb +19 -0
  96. data/lib/dev_system/dev/controllers/terminal_test.rb +14 -0
  97. data/lib/dev_system/dev/dev_box.rb +22 -0
  98. data/lib/dev_system/dev/dev_box_test.rb +19 -0
  99. data/lib/dev_system/dev/panels/command_panel.rb +10 -0
  100. data/lib/dev_system/dev/panels/command_panel_test.rb +23 -0
  101. data/lib/dev_system/dev/panels/log_panel.rb +10 -0
  102. data/lib/dev_system/dev/panels/log_panel_test.rb +18 -0
  103. data/lib/dev_system.rb +8 -0
  104. data/lib/happy_system/dev/happy_command.rb +11 -0
  105. data/lib/happy_system/happy/controllers/axo.rb +8 -0
  106. data/lib/happy_system/happy/happy_box.rb +12 -0
  107. data/lib/happy_system/happy/happy_box_test.rb +18 -0
  108. data/lib/happy_system/happy/panels/axo_panel.rb +5 -0
  109. data/lib/{viral.rb → happy_system.rb} +7 -3
  110. data/lib/liza/base/box.rb +40 -0
  111. data/lib/liza/base/box_test.rb +12 -0
  112. data/lib/liza/base/controller.rb +27 -0
  113. data/lib/liza/base/controller_test.rb +12 -0
  114. data/lib/liza/base/panel.rb +38 -0
  115. data/lib/liza/base/panel_test.rb +16 -0
  116. data/lib/liza/meta/part.rb +19 -0
  117. data/lib/liza/meta/part_extension.rb +13 -0
  118. data/lib/liza/meta/part_test.rb +8 -0
  119. data/lib/liza/meta/system.rb +20 -0
  120. data/lib/liza/meta/system_test.rb +13 -0
  121. data/lib/liza/test/test.rb +11 -0
  122. data/lib/liza/test/test_test.rb +108 -0
  123. data/lib/liza/test_parts/test_assertions_part.rb +110 -0
  124. data/lib/liza/test_parts/test_context_part.rb +81 -0
  125. data/lib/liza/test_parts/test_dsl_part.rb +122 -0
  126. data/lib/liza/test_parts/test_subject_part.rb +24 -0
  127. data/lib/liza/unit.rb +149 -0
  128. data/lib/liza/unit_test.rb +79 -0
  129. data/lib/liza.rb +62 -0
  130. data/lib/lizarb/ruby/class.rb +17 -0
  131. data/lib/lizarb/ruby/proc.rb +12 -0
  132. data/lib/lizarb/ruby/string.rb +25 -0
  133. data/lib/lizarb/ruby/time.rb +9 -0
  134. data/lib/{viral → lizarb}/version.rb +2 -2
  135. data/lib/lizarb.rb +68 -0
  136. data/lib/net_system/dev/net_command.rb +24 -0
  137. data/lib/net_system/net/controllers/client/redis_client.rb +28 -0
  138. data/lib/net_system/net/controllers/client/redis_client_test.rb +29 -0
  139. data/lib/net_system/net/controllers/client/sqlite_client.rb +28 -0
  140. data/lib/net_system/net/controllers/client/sqlite_client_test.rb +29 -0
  141. data/lib/net_system/net/controllers/client.rb +5 -0
  142. data/lib/net_system/net/controllers/client_test.rb +14 -0
  143. data/lib/net_system/net/controllers/database/redis_db.rb +11 -0
  144. data/lib/net_system/net/controllers/database/redis_db_test.rb +23 -0
  145. data/lib/net_system/net/controllers/database/sqlite_db.rb +11 -0
  146. data/lib/net_system/net/controllers/database/sqlite_db_test.rb +23 -0
  147. data/lib/net_system/net/controllers/database.rb +33 -0
  148. data/lib/net_system/net/controllers/database_test.rb +14 -0
  149. data/lib/net_system/net/controllers/model.rb +31 -0
  150. data/lib/net_system/net/controllers/model_test.rb +14 -0
  151. data/lib/net_system/net/net_box.rb +20 -0
  152. data/lib/net_system/net/net_box_test.rb +19 -0
  153. data/lib/net_system/net/panels/client_panel.rb +5 -0
  154. data/lib/net_system/net/panels/client_panel_test.rb +18 -0
  155. data/lib/net_system/net/panels/database_panel.rb +12 -0
  156. data/lib/net_system/net/panels/database_panel_test.rb +18 -0
  157. data/lib/net_system.rb +3 -0
  158. data/lib/web_system/dev/web_command.rb +42 -0
  159. data/lib/web_system/web/controllers/request/client_error_request.rb +18 -0
  160. data/lib/web_system/web/controllers/request/not_found_request.rb +18 -0
  161. data/lib/web_system/web/controllers/request/server_error_request.rb +20 -0
  162. data/lib/web_system/web/controllers/request.rb +5 -0
  163. data/lib/web_system/web/controllers/request_test.rb +18 -0
  164. data/lib/web_system/web/panels/request_panel.rb +55 -0
  165. data/lib/web_system/web/panels/request_panel_test.rb +14 -0
  166. data/lib/web_system/web/web_box.rb +12 -0
  167. data/lib/web_system/web/web_box_test.rb +18 -0
  168. data/lib/web_system.rb +5 -0
  169. data/lizarb.gemspec +44 -0
  170. data/sig/{viral.rbs → lizarb.rbs} +1 -1
  171. data/tmp/.gitkeep +0 -0
  172. data/web_files/favicon.ico +0 -0
  173. data/web_files/favicon.svg +948 -0
  174. metadata +226 -13
  175. data/viral.gemspec +0 -45
@@ -0,0 +1,70 @@
1
+ class DevSystem
2
+ class TestCommand < Command
3
+
4
+ def self.call args
5
+ log :higher, "Called #{self} with args #{args}"
6
+
7
+ App.eager_load_all
8
+
9
+ now = Time.now
10
+ test_classes = Liza::Test.descendants
11
+
12
+ test_classes = _call_sort test_classes
13
+
14
+ log "Testing #{test_classes}"
15
+ _call_testing test_classes
16
+ log "Done Testing (#{now.diff}s)"
17
+
18
+ puts
19
+
20
+ log "Counting #{test_classes.count} Test Classes"
21
+ _call_counting test_classes
22
+ log "Done Counting (#{now.diff}s)"
23
+ end
24
+
25
+ def self._call_sort test_classes
26
+ test_classes.sort_by! &:name
27
+
28
+ proc_namespaced = proc { |tc| tc.name.include? "::" }
29
+ proc_liza = proc { |tc| tc.name[0..3] == "Liza" }
30
+
31
+ tc_app = test_classes.reject &proc_namespaced
32
+ tc_namespaced = test_classes.select &proc_namespaced
33
+
34
+ tc_liza = tc_namespaced.select &proc_liza
35
+ tc_system = tc_namespaced.reject &proc_liza
36
+
37
+ tc_app.sort_by! { |tc| Object.const_source_location(tc.name)[0] }
38
+ tc_liza.sort_by! { |tc| Object.const_source_location(tc.name)[0] }
39
+
40
+ [tc_liza, tc_system, tc_app].flatten
41
+ end
42
+
43
+ def self._call_testing test_classes
44
+ i, count = 0, test_classes.count
45
+ for test_class in test_classes
46
+ test_class.call i+=1, count
47
+ end
48
+ end
49
+
50
+ def self._call_counting test_classes
51
+ puts
52
+ totals = Hash.new { 0 }
53
+ last_namespace = nil
54
+ test_classes.each do |test_class|
55
+ namespace = test_class.first_namespace
56
+ puts if last_namespace != namespace
57
+ last_namespace = namespace
58
+
59
+ test_class.totals.each do |k, v|
60
+ totals[k] += v.size
61
+ end
62
+ Liza.log " #{"#{test_class}.totals".ljust 60} #{test_class.totals.map { |k, v| [k, v.size] }.to_h}"
63
+ end
64
+ puts
65
+ Liza.log " #{"Total".ljust 60} #{totals}"
66
+ puts
67
+ end
68
+
69
+ end
70
+ end
@@ -0,0 +1,14 @@
1
+ class DevSystem
2
+ class TestCommandTest < CommandTest
3
+
4
+ test :subject_class do
5
+ assert subject_class == DevSystem::TestCommand
6
+ end
7
+
8
+ test :settings do
9
+ assert subject_class.log_level == :normal
10
+ assert subject_class.log_color == :green
11
+ end
12
+
13
+ end
14
+ end
@@ -0,0 +1,9 @@
1
+ class DevSystem
2
+ class VersionCommand < Command
3
+
4
+ def self.call args
5
+ puts Lizarb::VERSION
6
+ end
7
+
8
+ end
9
+ end
@@ -0,0 +1,14 @@
1
+ class DevSystem
2
+ class VersionCommandTest < CommandTest
3
+
4
+ test :subject_class do
5
+ assert subject_class == DevSystem::VersionCommand
6
+ end
7
+
8
+ test :settings do
9
+ assert subject_class.log_level == :normal
10
+ assert subject_class.log_color == :green
11
+ end
12
+
13
+ end
14
+ end
@@ -0,0 +1,19 @@
1
+ class DevSystem
2
+ class Command < Liza::Controller
3
+
4
+ # def self.call args
5
+ # new.call args
6
+ # end
7
+
8
+ # def initialize args
9
+ # @args = args
10
+ # end
11
+
12
+ # attr_reader :args
13
+
14
+ # def call args
15
+ #
16
+ # end
17
+
18
+ end
19
+ end
@@ -0,0 +1,14 @@
1
+ class DevSystem
2
+ class CommandTest < Liza::ControllerTest
3
+
4
+ test :subject_class do
5
+ assert subject_class == DevSystem::Command
6
+ end
7
+
8
+ test :settings do
9
+ assert subject_class.log_level == :normal
10
+ assert subject_class.log_color == :green
11
+ end
12
+
13
+ end
14
+ end
@@ -0,0 +1,11 @@
1
+ class DevSystem
2
+ class Generator < Liza::Controller
3
+
4
+ # DSLS
5
+
6
+ def self.main_dsl
7
+ part :"generator_dsl_main", system: :dev
8
+ end
9
+
10
+ end
11
+ end
@@ -0,0 +1,54 @@
1
+ class DevSystem
2
+ class GeneratorDslMainPart < Liza::Part
3
+
4
+ insertion do
5
+
6
+ def self.call args
7
+ log :higher, "Called #{self}.#{__method__} with args #{args}"
8
+
9
+ name = args.shift || raise("args[0] should contain NAME")
10
+ name = name.downcase
11
+
12
+ memo.each do |label, bl|
13
+ log "Generating #{label}"
14
+ g = new label, name, args
15
+ g.instance_exec &bl
16
+ g.call
17
+ end
18
+
19
+ puts
20
+ log "done"
21
+ end
22
+
23
+ def self.memo()= @memo ||= {}
24
+
25
+ def self.generate(label, &block)= memo[label] = block
26
+
27
+ attr_reader :label, :name, :args
28
+
29
+ def initialize label, name, args
30
+ @label, @name, @args = label, name, args
31
+ end
32
+
33
+ def call
34
+ FileShell.write folder, filename, content
35
+ end
36
+
37
+ %w|folder filename content|.each do |s|
38
+ class_eval <<-CODE, __FILE__, __LINE__ + 1
39
+ attr_reader :#{s}
40
+
41
+ def #{s} #{s} = nil
42
+ if #{s}
43
+ @#{s} = #{s}
44
+ else
45
+ @#{s}
46
+ end
47
+ end
48
+ CODE
49
+ end
50
+
51
+ end
52
+
53
+ end
54
+ end
@@ -0,0 +1,14 @@
1
+ class DevSystem
2
+ class GeneratorTest < Liza::ControllerTest
3
+
4
+ test :subject_class do
5
+ assert subject_class == DevSystem::Generator
6
+ end
7
+
8
+ test :settings do
9
+ assert subject_class.log_level == :normal
10
+ assert subject_class.log_color == :green
11
+ end
12
+
13
+ end
14
+ end
@@ -0,0 +1,71 @@
1
+ class DevSystem
2
+ class AppGenerator < Generator
3
+
4
+ def self.call args
5
+ log :higher, "Called #{self}.#{__method__} with args #{args}"
6
+
7
+ # setup
8
+
9
+ name = args.shift || "app_1"
10
+
11
+ from = "#{Lizarb::APP_DIR}/app_new"
12
+ to = name
13
+
14
+ return log "Directory #{to.light_green} already exists." if Dir.exist? to
15
+
16
+ log "Liza Application initializing at `#{to}`"
17
+
18
+ # init
19
+
20
+ require "fileutils"
21
+ FileUtils.cp_r from, to, verbose: true
22
+
23
+ `cd #{to}; git init .`
24
+
25
+ # extra
26
+
27
+ puts
28
+
29
+ FileShell.gitkeep "#{to}/lib"
30
+ FileShell.gitkeep "#{to}/tmp"
31
+
32
+ FileShell.create_folder "#{to}/app"
33
+
34
+ # systems
35
+
36
+ App.systems.keys.each { |system_name| copy to, system_name }
37
+
38
+ FileUtils.rm "#{to}/app/dev/commands/new_command.rb"
39
+ FileUtils.rm "#{to}/app/dev/commands/new_command_test.rb"
40
+
41
+ FileUtils.cp_r "#{Lizarb::APP_DIR}/.ruby-version", "#{to}/.ruby-version", verbose: true
42
+ FileUtils.cp_r "#{Lizarb::APP_DIR}/README.md", "#{to}/README.md", verbose: true
43
+ FileUtils.cp_r "#{Lizarb::APP_DIR}/app.rb", "#{to}/app.rb", verbose: true
44
+ FileUtils.cp_r "#{Lizarb::APP_DIR}/app.env", "#{to}/app.env", verbose: true
45
+ FileUtils.cp_r "#{Lizarb::APP_DIR}/app.code.env", "#{to}/app.code.env", verbose: true
46
+
47
+ puts
48
+
49
+ log "Liza Application initialized at `#{to}`"
50
+ end
51
+
52
+ def self.copy name, system_name
53
+ from = "#{Lizarb::APP_DIR}/app/#{system_name}_box.rb"
54
+ to = "#{name}/app"
55
+ if File.exist? from
56
+ FileUtils.cp_r from, to, verbose: true
57
+ else
58
+ puts "file not found #{from}"
59
+ end
60
+
61
+ from = "#{Lizarb::APP_DIR}/app/#{system_name}"
62
+ to = "#{name}/app"
63
+ if File.exist? from
64
+ FileUtils.cp_r from, to, verbose: true
65
+ else
66
+ puts "file not found #{from}"
67
+ end
68
+ end
69
+
70
+ end
71
+ end
@@ -0,0 +1,14 @@
1
+ class DevSystem
2
+ class AppGeneratorTest < GeneratorTest
3
+
4
+ test :subject_class do
5
+ assert subject_class == DevSystem::AppGenerator
6
+ end
7
+
8
+ test :settings do
9
+ assert subject_class.log_level == :normal
10
+ assert subject_class.log_color == :green
11
+ end
12
+
13
+ end
14
+ end
@@ -0,0 +1,29 @@
1
+ class DevSystem
2
+ class FileShell < Shell
3
+ require "fileutils"
4
+
5
+ def self.create_folder folder, write_log = true
6
+ log "Creating folder #{folder}" if write_log
7
+ FileUtils.mkdir_p folder
8
+ end
9
+
10
+ def self.write folder, filename, content
11
+ create_folder folder, false
12
+ fname = "#{folder}/#{filename}"
13
+ log "Writing #{fname} with #{content.size} bytes"
14
+ File.write fname, content
15
+ end
16
+
17
+ def self.touch folder, filename
18
+ create_folder folder, false
19
+ fname = "#{folder}/#{filename}"
20
+ log "Touching #{fname}"
21
+ FileUtils.touch fname
22
+ end
23
+
24
+ def self.gitkeep folder
25
+ touch folder, ".gitkeep"
26
+ end
27
+
28
+ end
29
+ end
@@ -0,0 +1,14 @@
1
+ class DevSystem
2
+ class FileShellTest < ShellTest
3
+
4
+ test :subject_class do
5
+ assert subject_class == DevSystem::FileShell
6
+ end
7
+
8
+ test :settings do
9
+ assert subject_class.log_level == :normal
10
+ assert subject_class.log_color == :green
11
+ end
12
+
13
+ end
14
+ end
@@ -0,0 +1,19 @@
1
+ class DevSystem
2
+ class Shell < Liza::Controller
3
+ def windows?
4
+ RUBY_PLATFORM =~ /win32/
5
+ end
6
+
7
+ def unix?
8
+ linux? || mac?
9
+ end
10
+
11
+ def linux?
12
+ RUBY_PLATFORM =~ /linux/
13
+ end
14
+
15
+ def mac?
16
+ RUBY_PLATFORM =~ /darwin/
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,13 @@
1
+ class DevSystem
2
+ class ShellTest < Liza::ControllerTest
3
+
4
+ test :subject_class do
5
+ assert subject_class == DevSystem::Shell
6
+ end
7
+
8
+ test :settings do
9
+ assert subject_class.log_level == :normal
10
+ assert subject_class.log_color == :green
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,19 @@
1
+ class DevSystem
2
+ class IrbTerminal < Terminal
3
+
4
+ def self.call args
5
+ log :higher, "Called #{self}.#{__method__} with args #{args}"
6
+
7
+ # https://github.com/ruby/ruby/blob/master/lib/irb.rb
8
+ require "irb"
9
+
10
+ IRB.setup(nil)
11
+ workspace = IRB::WorkSpace.new(binding)
12
+ irb = IRB::Irb.new(workspace)
13
+ IRB.conf[:MAIN_CONTEXT] = irb.context
14
+
15
+ irb.eval_input
16
+ end
17
+
18
+ end
19
+ end
@@ -0,0 +1,14 @@
1
+ class DevSystem
2
+ class IrbTerminalTest < TerminalTest
3
+
4
+ test :subject_class do
5
+ assert subject_class == DevSystem::IrbTerminal
6
+ end
7
+
8
+ test :settings do
9
+ assert subject_class.log_level == :normal
10
+ assert subject_class.log_color == :green
11
+ end
12
+
13
+ end
14
+ end
@@ -0,0 +1,12 @@
1
+ class DevSystem
2
+ class PryTerminal < Terminal
3
+
4
+ def self.call args
5
+ log :higher, "Called #{self}.#{__method__} with args #{args}"
6
+
7
+ require "pry"
8
+ Pry.start
9
+ end
10
+
11
+ end
12
+ end
@@ -0,0 +1,14 @@
1
+ class DevSystem
2
+ class PryTerminalTest < TerminalTest
3
+
4
+ test :subject_class do
5
+ assert subject_class == DevSystem::PryTerminal
6
+ end
7
+
8
+ test :settings do
9
+ assert subject_class.log_level == :normal
10
+ assert subject_class.log_color == :green
11
+ end
12
+
13
+ end
14
+ end
@@ -0,0 +1,19 @@
1
+ class DevSystem
2
+ class Terminal < Liza::Controller
3
+
4
+ # def self.call args
5
+ # new.call args
6
+ # end
7
+
8
+ # def initialize args
9
+ # @args = args
10
+ # end
11
+
12
+ # attr_reader :args
13
+
14
+ # def call args
15
+ #
16
+ # end
17
+
18
+ end
19
+ end
@@ -0,0 +1,14 @@
1
+ class DevSystem
2
+ class TerminalTest < Liza::ControllerTest
3
+
4
+ test :subject_class do
5
+ assert subject_class == DevSystem::Terminal
6
+ end
7
+
8
+ test :settings do
9
+ assert subject_class.log_level == :normal
10
+ assert subject_class.log_color == :green
11
+ end
12
+
13
+ end
14
+ end
@@ -0,0 +1,22 @@
1
+ class DevSystem
2
+ class DevBox < Liza::Box
3
+ has_panel :command, :commands
4
+ has_controller :command, :commands
5
+ has_controller :shell, :commands
6
+ has_controller :bench, :commands
7
+ has_controller :terminal, :commands
8
+
9
+ has_panel :log, :logs
10
+
11
+ # Set up your command panel per the DSL in http://guides.lizarb.org/panels/command.html
12
+ commands do
13
+ # set :log_level, ENV["dev.command.log_level"]
14
+ end
15
+
16
+ # Set up your command panel per the DSL in http://guides.lizarb.org/panels/log.html
17
+ logs do
18
+ # set :log_level, ENV["dev.log.log_level"]
19
+ end
20
+
21
+ end
22
+ end
@@ -0,0 +1,19 @@
1
+ class DevSystem
2
+ class DevBoxTest < Liza::BoxTest
3
+
4
+ test :subject_class do
5
+ assert subject_class == DevSystem::DevBox
6
+ end
7
+
8
+ test :settings do
9
+ assert subject_class.log_level == :normal
10
+ assert subject_class.log_color == :green
11
+ end
12
+
13
+ test :panels do
14
+ assert subject_class.commands.is_a? CommandPanel
15
+ assert subject_class.logs.is_a? LogPanel
16
+ end
17
+
18
+ end
19
+ end
@@ -0,0 +1,10 @@
1
+ class DevSystem
2
+ class CommandPanel < Liza::Panel
3
+
4
+ def call args
5
+ command_klass = Liza.const "#{args[0]}_command"
6
+ command_klass.call args[1..-1]
7
+ end
8
+
9
+ end
10
+ end
@@ -0,0 +1,23 @@
1
+ class DevSystem
2
+ class CommandPanelTest < Liza::PanelTest
3
+
4
+ test :subject_class do
5
+ assert subject_class == DevSystem::CommandPanel
6
+ end
7
+
8
+ test :settings do
9
+ assert subject_class.log_level == :normal
10
+ assert subject_class.log_color == :green
11
+ end
12
+
13
+ test :call do
14
+ begin
15
+ subject.call ["echo", 1, 2, 3]
16
+ assert false
17
+ rescue RuntimeError => e
18
+ assert e.message == "[1, 2, 3]"
19
+ end
20
+ end
21
+
22
+ end
23
+ end
@@ -0,0 +1,10 @@
1
+ class DevSystem
2
+ class LogPanel < Liza::Panel
3
+
4
+ # https://rubyapi.org/3.1/o/logger
5
+ def call string
6
+ puts string
7
+ end
8
+
9
+ end
10
+ end
@@ -0,0 +1,18 @@
1
+ class DevSystem
2
+ class LogPanelTest < Liza::PanelTest
3
+
4
+ test :subject_class do
5
+ assert subject_class == DevSystem::LogPanel
6
+ end
7
+
8
+ test :settings do
9
+ assert subject_class.log_level == :normal
10
+ assert subject_class.log_color == :green
11
+ end
12
+
13
+ # test :call do
14
+ # todo "write this"
15
+ # end
16
+
17
+ end
18
+ end
data/lib/dev_system.rb ADDED
@@ -0,0 +1,8 @@
1
+ class DevSystem < Liza::System
2
+ class Error < Liza::Error; end
3
+
4
+ #
5
+
6
+ set :log_color, :green
7
+
8
+ end
@@ -0,0 +1,11 @@
1
+ class HappySystem::HappyCommand < Liza::Command
2
+
3
+ def self.call args
4
+ if args[0] == "axo"
5
+ Axo.call args[1..-1]
6
+ else
7
+ log "unrecognized game: #{args[0]}. Try `liza happy axo` instead"
8
+ end
9
+ end
10
+
11
+ end
@@ -0,0 +1,8 @@
1
+ class HappySystem
2
+ class Axo < Liza::Controller
3
+
4
+ def self.call args
5
+ #
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,12 @@
1
+ class HappySystem
2
+ class HappyBox < Liza::Box
3
+ has_panel :axo
4
+ has_controller :axo
5
+
6
+ # Set up your axo panel per the DSL in http://guides.lizarb.org/panels/axo.html
7
+ axo do
8
+ # set :log_level, ENV["happy.axo.log_level"]
9
+ end
10
+
11
+ end
12
+ end
@@ -0,0 +1,18 @@
1
+ class HappySystem
2
+ class HappyBoxTest < Liza::BoxTest
3
+
4
+ test :subject_class do
5
+ assert subject_class == HappySystem::HappyBox
6
+ end
7
+
8
+ test :settings do
9
+ assert subject_class.log_level == :normal
10
+ assert subject_class.log_color == :magenta
11
+ end
12
+
13
+ test :panels do
14
+ assert subject_class.axo.is_a? AxoPanel
15
+ end
16
+
17
+ end
18
+ end
@@ -0,0 +1,5 @@
1
+ class HappySystem
2
+ class AxoPanel < Liza::Panel
3
+
4
+ end
5
+ end