lizarb 0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -0
- data/CHANGELOG.md +13 -2
- data/Gemfile +22 -2
- data/Gemfile.lock +52 -0
- data/README.md +88 -12
- data/app/dev/benches/app_bench.rb +5 -0
- data/app/dev/benches/app_bench_test.rb +7 -0
- data/app/dev/benches/loops_bench.rb +148 -0
- data/app/dev/benches/loops_bench_test.rb +11 -0
- data/app/dev/commands/app_command.rb +5 -0
- data/app/dev/commands/app_command_test.rb +7 -0
- data/app/dev/commands/example_command.rb +57 -0
- data/app/dev/commands/example_command_test.rb +43 -0
- data/app/dev/commands/macro_child_command.rb +32 -0
- data/app/dev/commands/macro_child_command_test.rb +7 -0
- data/app/dev/commands/macro_parent_command.rb +70 -0
- data/app/dev/commands/macro_parent_command_test.rb +7 -0
- data/app/dev/commands/my_command.rb +7 -0
- data/app/dev/commands/my_command_test.rb +7 -0
- data/app/dev/commands/new_command.rb +9 -0
- data/app/dev/commands/new_command_test.rb +7 -0
- data/app/dev/generators/bench_generator.rb +67 -0
- data/app/dev/generators/bench_generator_test.rb +12 -0
- data/app/dev/generators/command_generator.rb +51 -0
- data/app/dev/generators/command_generator_test.rb +12 -0
- data/app/dev/generators/model_generator.rb +46 -0
- data/app/dev/generators/model_generator_test.rb +12 -0
- data/app/dev/generators/request_generator.rb +63 -0
- data/app/dev/generators/request_generator_test.rb +12 -0
- data/app/dev_box.rb +13 -0
- data/app/happy/axos/axo.rb +50 -0
- data/app/happy_box.rb +8 -0
- data/app/net/databases/redis_db.rb +5 -0
- data/app/net/databases/redis_db_test.rb +12 -0
- data/app/net/databases/sqlite_db.rb +11 -0
- data/app/net/databases/sqlite_db_test.rb +12 -0
- data/app/net/models/app_model.rb +20 -0
- data/app/net/models/app_model_test.rb +8 -0
- data/app/net/models/post_model.rb +4 -0
- data/app/net/models/post_model_test.rb +8 -0
- data/app/net/models/user_model.rb +4 -0
- data/app/net/models/user_model_test.rb +8 -0
- data/app/net_box.rb +21 -0
- data/app/web/requests/api_request.rb +61 -0
- data/app/web/requests/api_request_test.rb +31 -0
- data/app/web/requests/app_request.rb +5 -0
- data/app/web/requests/app_request_test.rb +7 -0
- data/app/web/requests/assets_request.rb +71 -0
- data/app/web/requests/assets_request_test.rb +33 -0
- data/app/web/requests/root_request.rb +55 -0
- data/app/web/requests/root_request_test.rb +31 -0
- data/app/web_box.rb +8 -0
- data/app.code.env +11 -0
- data/app.env +11 -0
- data/app.rb +17 -0
- data/app_new/.gitignore +4 -0
- data/app_new/Gemfile +31 -0
- data/app_new/Procfile +3 -0
- data/exe/Gemfile +3 -0
- data/exe/Gemfile.lock +13 -0
- data/exe/liza +3 -0
- data/exe/lizarb +11 -0
- data/lib/app.rb +200 -0
- data/lib/dev_system/dev/controllers/bench.rb +11 -0
- data/lib/dev_system/dev/controllers/bench_dsl_main_part.rb +60 -0
- data/lib/dev_system/dev/controllers/bench_test.rb +14 -0
- data/lib/dev_system/dev/controllers/command/bench_command.rb +24 -0
- data/lib/dev_system/dev/controllers/command/bench_command_test.rb +14 -0
- data/lib/dev_system/dev/controllers/command/dev_command.rb +24 -0
- data/lib/dev_system/dev/controllers/command/dev_command_test.rb +14 -0
- data/lib/dev_system/dev/controllers/command/echo_command.rb +11 -0
- data/lib/dev_system/dev/controllers/command/echo_command_test.rb +14 -0
- data/lib/dev_system/dev/controllers/command/generate_command.rb +23 -0
- data/lib/dev_system/dev/controllers/command/generate_command_test.rb +14 -0
- data/lib/dev_system/dev/controllers/command/test_command.rb +70 -0
- data/lib/dev_system/dev/controllers/command/test_command_test.rb +14 -0
- data/lib/dev_system/dev/controllers/command/version_command.rb +9 -0
- data/lib/dev_system/dev/controllers/command/version_command_test.rb +14 -0
- data/lib/dev_system/dev/controllers/command.rb +19 -0
- data/lib/dev_system/dev/controllers/command_test.rb +14 -0
- data/lib/dev_system/dev/controllers/generator.rb +11 -0
- data/lib/dev_system/dev/controllers/generator_dsl_main_part.rb +54 -0
- data/lib/dev_system/dev/controllers/generator_test.rb +14 -0
- data/lib/dev_system/dev/controllers/generators/app_generator.rb +71 -0
- data/lib/dev_system/dev/controllers/generators/app_generator_test.rb +14 -0
- data/lib/dev_system/dev/controllers/shell/file_shell.rb +29 -0
- data/lib/dev_system/dev/controllers/shell/file_shell_test.rb +14 -0
- data/lib/dev_system/dev/controllers/shell.rb +19 -0
- data/lib/dev_system/dev/controllers/shell_test.rb +13 -0
- data/lib/dev_system/dev/controllers/terminal/irb_terminal.rb +19 -0
- data/lib/dev_system/dev/controllers/terminal/irb_terminal_test.rb +14 -0
- data/lib/dev_system/dev/controllers/terminal/pry_terminal.rb +12 -0
- data/lib/dev_system/dev/controllers/terminal/pry_terminal_test.rb +14 -0
- data/lib/dev_system/dev/controllers/terminal.rb +19 -0
- data/lib/dev_system/dev/controllers/terminal_test.rb +14 -0
- data/lib/dev_system/dev/dev_box.rb +22 -0
- data/lib/dev_system/dev/dev_box_test.rb +19 -0
- data/lib/dev_system/dev/panels/command_panel.rb +10 -0
- data/lib/dev_system/dev/panels/command_panel_test.rb +23 -0
- data/lib/dev_system/dev/panels/log_panel.rb +10 -0
- data/lib/dev_system/dev/panels/log_panel_test.rb +18 -0
- data/lib/dev_system.rb +8 -0
- data/lib/happy_system/dev/happy_command.rb +11 -0
- data/lib/happy_system/happy/controllers/axo.rb +8 -0
- data/lib/happy_system/happy/happy_box.rb +12 -0
- data/lib/happy_system/happy/happy_box_test.rb +18 -0
- data/lib/happy_system/happy/panels/axo_panel.rb +5 -0
- data/lib/{viral.rb → happy_system.rb} +7 -3
- data/lib/liza/base/box.rb +40 -0
- data/lib/liza/base/box_test.rb +12 -0
- data/lib/liza/base/controller.rb +27 -0
- data/lib/liza/base/controller_test.rb +12 -0
- data/lib/liza/base/panel.rb +38 -0
- data/lib/liza/base/panel_test.rb +16 -0
- data/lib/liza/meta/part.rb +19 -0
- data/lib/liza/meta/part_extension.rb +13 -0
- data/lib/liza/meta/part_test.rb +8 -0
- data/lib/liza/meta/system.rb +20 -0
- data/lib/liza/meta/system_test.rb +13 -0
- data/lib/liza/test/test.rb +11 -0
- data/lib/liza/test/test_test.rb +108 -0
- data/lib/liza/test_parts/test_assertions_part.rb +110 -0
- data/lib/liza/test_parts/test_context_part.rb +81 -0
- data/lib/liza/test_parts/test_dsl_part.rb +122 -0
- data/lib/liza/test_parts/test_subject_part.rb +24 -0
- data/lib/liza/unit.rb +149 -0
- data/lib/liza/unit_test.rb +79 -0
- data/lib/liza.rb +62 -0
- data/lib/lizarb/ruby/class.rb +17 -0
- data/lib/lizarb/ruby/proc.rb +12 -0
- data/lib/lizarb/ruby/string.rb +25 -0
- data/lib/lizarb/ruby/time.rb +9 -0
- data/lib/{viral → lizarb}/version.rb +2 -2
- data/lib/lizarb.rb +68 -0
- data/lib/net_system/dev/net_command.rb +24 -0
- data/lib/net_system/net/controllers/client/redis_client.rb +28 -0
- data/lib/net_system/net/controllers/client/redis_client_test.rb +29 -0
- data/lib/net_system/net/controllers/client/sqlite_client.rb +28 -0
- data/lib/net_system/net/controllers/client/sqlite_client_test.rb +29 -0
- data/lib/net_system/net/controllers/client.rb +5 -0
- data/lib/net_system/net/controllers/client_test.rb +14 -0
- data/lib/net_system/net/controllers/database/redis_db.rb +11 -0
- data/lib/net_system/net/controllers/database/redis_db_test.rb +23 -0
- data/lib/net_system/net/controllers/database/sqlite_db.rb +11 -0
- data/lib/net_system/net/controllers/database/sqlite_db_test.rb +23 -0
- data/lib/net_system/net/controllers/database.rb +33 -0
- data/lib/net_system/net/controllers/database_test.rb +14 -0
- data/lib/net_system/net/controllers/model.rb +31 -0
- data/lib/net_system/net/controllers/model_test.rb +14 -0
- data/lib/net_system/net/net_box.rb +20 -0
- data/lib/net_system/net/net_box_test.rb +19 -0
- data/lib/net_system/net/panels/client_panel.rb +5 -0
- data/lib/net_system/net/panels/client_panel_test.rb +18 -0
- data/lib/net_system/net/panels/database_panel.rb +12 -0
- data/lib/net_system/net/panels/database_panel_test.rb +18 -0
- data/lib/net_system.rb +3 -0
- data/lib/web_system/dev/web_command.rb +42 -0
- data/lib/web_system/web/controllers/request/client_error_request.rb +18 -0
- data/lib/web_system/web/controllers/request/not_found_request.rb +18 -0
- data/lib/web_system/web/controllers/request/server_error_request.rb +20 -0
- data/lib/web_system/web/controllers/request.rb +5 -0
- data/lib/web_system/web/controllers/request_test.rb +18 -0
- data/lib/web_system/web/panels/request_panel.rb +55 -0
- data/lib/web_system/web/panels/request_panel_test.rb +14 -0
- data/lib/web_system/web/web_box.rb +12 -0
- data/lib/web_system/web/web_box_test.rb +18 -0
- data/lib/web_system.rb +5 -0
- data/lizarb.gemspec +44 -0
- data/sig/{viral.rbs → lizarb.rbs} +1 -1
- data/tmp/.gitkeep +0 -0
- data/web_files/favicon.ico +0 -0
- data/web_files/favicon.svg +948 -0
- metadata +226 -13
- 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,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,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,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,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,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,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,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,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
|