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
@@ -0,0 +1,117 @@
|
|
1
|
+
class DevSystem::NewGenerator < DevSystem::Generator
|
2
|
+
def self.call(args)
|
3
|
+
log "args = #{args.inspect}"
|
4
|
+
new.call args
|
5
|
+
end
|
6
|
+
|
7
|
+
def call(args)
|
8
|
+
log "args = #{args.inspect}"
|
9
|
+
# setup
|
10
|
+
|
11
|
+
name = args.shift || "app_1"
|
12
|
+
|
13
|
+
from = "#{Lizarb::APP_DIR}/app_new"
|
14
|
+
to = name
|
15
|
+
|
16
|
+
return log "Directory #{to.light_green} already exists." if Dir.exist? to
|
17
|
+
|
18
|
+
log "Liza Application initializing at `#{to}`"
|
19
|
+
|
20
|
+
# init
|
21
|
+
|
22
|
+
DirShell.create to
|
23
|
+
|
24
|
+
# app
|
25
|
+
|
26
|
+
FileUtils.cp_r from, "#{to}/app", verbose: true
|
27
|
+
FileUtils.cp_r "#{from}.rb", "#{to}/app.rb", verbose: true
|
28
|
+
|
29
|
+
# extra
|
30
|
+
|
31
|
+
puts
|
32
|
+
|
33
|
+
FileShell.gitkeep "#{to}/lib"
|
34
|
+
FileShell.gitkeep "#{to}/tmp"
|
35
|
+
|
36
|
+
TextShell.write "#{to}/.gitignore", render("hidden.gitignore")
|
37
|
+
TextShell.write "#{to}/Gemfile", render("Gemfile.rb")
|
38
|
+
# TextShell.write "#{to}/Procfile", render("Procfile.yml")
|
39
|
+
TextShell.write "#{to}/.tool-versions", render("toolversions.txt")
|
40
|
+
|
41
|
+
FileUtils.cp_r "#{Lizarb::APP_DIR}/README.md",
|
42
|
+
"#{to}/README.md",
|
43
|
+
verbose: true
|
44
|
+
# FileUtils.cp_r "#{Lizarb::APP_DIR}/web_files",
|
45
|
+
# "#{to}/web_files",
|
46
|
+
# verbose: true
|
47
|
+
@env_name = nil
|
48
|
+
TextShell.write "#{to}/app.env", render("env.env")
|
49
|
+
@env_name = :code
|
50
|
+
TextShell.write "#{to}/app.code.env", render("env.env")
|
51
|
+
@env_name = :demo
|
52
|
+
TextShell.write "#{to}/app.demo.env", render("env.env")
|
53
|
+
|
54
|
+
puts
|
55
|
+
|
56
|
+
`cd #{to}; git init -b main; git add .; git commit -m "lizarb new app_1 (v#{Lizarb::VERSION})"`
|
57
|
+
|
58
|
+
log "Liza Application initialized at `#{to}`"
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
__END__
|
63
|
+
|
64
|
+
# view hidden.gitignore.erb
|
65
|
+
# Ignore all files in all subdirectories
|
66
|
+
.gitignore
|
67
|
+
/.bundle/
|
68
|
+
/tmp/
|
69
|
+
*.sqlite
|
70
|
+
*.rdb
|
71
|
+
|
72
|
+
# view toolversions.txt.erb
|
73
|
+
ruby <%= RUBY_VERSION %>
|
74
|
+
|
75
|
+
# view Procfile.yml.erb
|
76
|
+
# HEROKU EXAMPLE
|
77
|
+
|
78
|
+
web: MODE=demo bundle exec liza rack h=0.0.0.0 p=$PORT
|
79
|
+
|
80
|
+
# view Gemfile.rb.erb
|
81
|
+
# frozen_string_literal: true
|
82
|
+
|
83
|
+
source "https://rubygems.org"
|
84
|
+
|
85
|
+
group :default do
|
86
|
+
gem "lizarb", "~> <%= Lizarb::VERSION %>"
|
87
|
+
# gem "lizarb", github: "rubyonrails-brasil/lizarb"
|
88
|
+
end
|
89
|
+
|
90
|
+
group :dev do
|
91
|
+
# gems you only want to load if DevSystem is loaded
|
92
|
+
# gem "pry", "~> 0.14.1"
|
93
|
+
end
|
94
|
+
|
95
|
+
# view env.env.erb
|
96
|
+
#
|
97
|
+
<% if @env_name == :code -%>
|
98
|
+
# ENV VARIABLES FOR MODE=code (default)
|
99
|
+
#
|
100
|
+
# MODE=code lizarb commands
|
101
|
+
# lizarb commands
|
102
|
+
<% elsif @env_name == :demo -%>
|
103
|
+
# ENV VARIABLES FOR MODE=demo
|
104
|
+
#
|
105
|
+
# MODE=demo lizarb commands
|
106
|
+
<% else -%>
|
107
|
+
# ENV VARIABLES FOR ALL MODES
|
108
|
+
#
|
109
|
+
# MODE=code lizarb commands
|
110
|
+
# MODE=demo lizarb commands
|
111
|
+
# lizarb commands
|
112
|
+
<% end -%>
|
113
|
+
#
|
114
|
+
|
115
|
+
# app variables
|
116
|
+
|
117
|
+
# dev variables
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class DevSystem::NewGeneratorTest < DevSystem::GeneratorTest
|
2
|
+
|
3
|
+
test :subject_class do
|
4
|
+
assert subject_class == DevSystem::NewGenerator
|
5
|
+
end
|
6
|
+
|
7
|
+
test :settings do
|
8
|
+
assert subject_class.log_level == :normal
|
9
|
+
assert subject_class.log_color == :green
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
@@ -1,29 +1,39 @@
|
|
1
|
-
class DevSystem
|
2
|
-
class NotFoundGenerator < Generator
|
1
|
+
class DevSystem::NotFoundGenerator < DevSystem::Generator
|
3
2
|
|
4
|
-
|
5
|
-
|
3
|
+
def self.call args
|
4
|
+
# 1. LOG
|
6
5
|
|
7
|
-
|
8
|
-
|
6
|
+
log "args = #{args.inspect}"
|
7
|
+
puts
|
9
8
|
|
10
|
-
|
9
|
+
# 2. FIND generators
|
11
10
|
|
12
|
-
|
13
|
-
|
11
|
+
App.load_all
|
12
|
+
generators = Liza::Generator.descendants
|
13
|
+
generators -= ignored_generators
|
14
14
|
|
15
|
-
|
16
|
-
puts
|
15
|
+
# 3. LIST generators
|
17
16
|
|
18
|
-
|
19
|
-
puts
|
17
|
+
keys = generators.map { _1.last_namespace.snakecase[0..-11] }.uniq.sort
|
20
18
|
|
21
|
-
|
19
|
+
log "Liza comes with #{keys.count} generators you can use."
|
20
|
+
log "Here they are:"
|
21
|
+
puts
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
keys.each { |s| log "liza generate #{s}" }
|
23
|
+
keys.each do
|
24
|
+
log "liza generate #{_1}"
|
26
25
|
end
|
26
|
+
end
|
27
27
|
|
28
|
+
def self.ignored_generators
|
29
|
+
[
|
30
|
+
self,
|
31
|
+
DevSystem::NotFoundGenerator,
|
32
|
+
DevSystem::NewGenerator,
|
33
|
+
DevSystem::ControllerGenerator,
|
34
|
+
DevSystem::RecordGenerator,
|
35
|
+
DevSystem::RequestGenerator,
|
36
|
+
].uniq.compact
|
28
37
|
end
|
38
|
+
|
29
39
|
end
|
@@ -1,14 +1,12 @@
|
|
1
|
-
class DevSystem
|
2
|
-
class NotFoundGeneratorTest < GeneratorTest
|
1
|
+
class DevSystem::NotFoundGeneratorTest < DevSystem::GeneratorTest
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
|
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::NotFoundGenerator
|
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
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class DevSystem::RecordGeneratorTest < DevSystem::GeneratorTest
|
2
|
+
|
3
|
+
test :subject_class do
|
4
|
+
assert subject_class == DevSystem::RecordGenerator
|
5
|
+
end
|
6
|
+
|
7
|
+
test :settings do
|
8
|
+
assert subject_class.log_level == :normal
|
9
|
+
assert subject_class.log_color == :green
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class RequestGenerator <
|
1
|
+
class DevSystem::RequestGenerator < DevSystem::Generator
|
2
2
|
main_dsl
|
3
3
|
|
4
4
|
FOLDER = "app/web/requests"
|
@@ -23,7 +23,7 @@ class #{name.camelize}Request < Liza::Request
|
|
23
23
|
|
24
24
|
def self.call env
|
25
25
|
path = env["REQUEST_PATH"]
|
26
|
-
log
|
26
|
+
log "args = #{args.inspect}"
|
27
27
|
|
28
28
|
#
|
29
29
|
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class DevSystem::RequestGeneratorTest < DevSystem::GeneratorTest
|
2
|
+
|
3
|
+
test :subject_class do
|
4
|
+
assert subject_class == DevSystem::RequestGenerator
|
5
|
+
end
|
6
|
+
|
7
|
+
test :settings do
|
8
|
+
assert subject_class.log_level == :normal
|
9
|
+
assert subject_class.log_color == :green
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
@@ -28,4 +28,26 @@ class DevSystem::Shell < Liza::Controller
|
|
28
28
|
:unix
|
29
29
|
end
|
30
30
|
|
31
|
+
# Return the current Ruby engine as a symbol
|
32
|
+
def self.engine
|
33
|
+
return :jruby if jruby?
|
34
|
+
return :ruby if ruby?
|
35
|
+
:unknown
|
36
|
+
end
|
37
|
+
|
38
|
+
# Check if the current Ruby engine is JRuby
|
39
|
+
def self.jruby?
|
40
|
+
@jruby || RUBY_ENGINE == "jruby"
|
41
|
+
end
|
42
|
+
|
43
|
+
# Check if the current Ruby engine is MRI
|
44
|
+
def self.ruby?
|
45
|
+
@ruby || RUBY_ENGINE == "ruby"
|
46
|
+
end
|
47
|
+
|
48
|
+
# Return the current Ruby version as a Gem::Version
|
49
|
+
def self.ruby_version
|
50
|
+
Lizarb.ruby_version
|
51
|
+
end
|
52
|
+
|
31
53
|
end
|
@@ -43,4 +43,29 @@ class DevSystem::ShellTest < Liza::ControllerTest
|
|
43
43
|
subject_class.instance_variable_set(:@mac, original)
|
44
44
|
end
|
45
45
|
|
46
|
+
#
|
47
|
+
|
48
|
+
test :subject_class, :ruby? do
|
49
|
+
original = subject_class.ruby?
|
50
|
+
subject_class.instance_variable_set(:@ruby, true)
|
51
|
+
assert subject_class.ruby?
|
52
|
+
ensure
|
53
|
+
subject_class.instance_variable_set(:@ruby, original)
|
54
|
+
end
|
55
|
+
|
56
|
+
test :subject_class, :jruby? do
|
57
|
+
original = subject_class.jruby?
|
58
|
+
subject_class.instance_variable_set(:@jruby, true)
|
59
|
+
assert subject_class.jruby?
|
60
|
+
ensure
|
61
|
+
subject_class.instance_variable_set(:@jruby, original)
|
62
|
+
end
|
63
|
+
|
64
|
+
#
|
65
|
+
|
66
|
+
test :subject_class, :ruby_version do
|
67
|
+
assert subject_class.ruby_version.class == Gem::Version
|
68
|
+
end
|
69
|
+
|
70
|
+
|
46
71
|
end
|
@@ -1,19 +1,23 @@
|
|
1
|
-
class DevSystem
|
2
|
-
class IrbTerminal < Terminal
|
1
|
+
class DevSystem::IrbTerminal < DevSystem::Terminal
|
3
2
|
|
4
|
-
|
5
|
-
|
3
|
+
def self.call args
|
4
|
+
log "args = #{args.inspect}"
|
6
5
|
|
7
|
-
|
8
|
-
|
6
|
+
# https://github.com/ruby/ruby/blob/master/lib/irb.rb
|
7
|
+
require "irb"
|
9
8
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
9
|
+
IRB.setup(nil)
|
10
|
+
workspace = IRB::WorkSpace.new(binding)
|
11
|
+
irb = IRB::Irb.new(workspace)
|
12
|
+
IRB.conf[:MAIN_CONTEXT] = irb.context
|
14
13
|
|
15
|
-
|
14
|
+
def irb.signal_status(status)
|
15
|
+
super
|
16
|
+
rescue Interrupt
|
17
|
+
IrbTerminal.log "Control-C"
|
16
18
|
end
|
17
19
|
|
20
|
+
irb.eval_input
|
18
21
|
end
|
22
|
+
|
19
23
|
end
|
@@ -1,14 +1,12 @@
|
|
1
|
-
class DevSystem
|
2
|
-
class IrbTerminalTest < TerminalTest
|
1
|
+
class DevSystem::IrbTerminalTest < DevSystem::TerminalTest
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
|
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::IrbTerminal
|
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,12 +1,10 @@
|
|
1
|
-
class DevSystem
|
2
|
-
class PryTerminal < Terminal
|
1
|
+
class DevSystem::PryTerminal < DevSystem::Terminal
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
require "pry"
|
8
|
-
Pry.start
|
9
|
-
end
|
3
|
+
def self.call args
|
4
|
+
log "args = #{args.inspect}"
|
10
5
|
|
6
|
+
require "pry"
|
7
|
+
Pry.start
|
11
8
|
end
|
9
|
+
|
12
10
|
end
|
@@ -1,14 +1,12 @@
|
|
1
|
-
class DevSystem
|
2
|
-
class PryTerminalTest < TerminalTest
|
1
|
+
class DevSystem::PryTerminalTest < DevSystem::TerminalTest
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
|
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::PryTerminal
|
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,19 +1,17 @@
|
|
1
|
-
class DevSystem
|
2
|
-
class Terminal < Liza::Controller
|
1
|
+
class DevSystem::Terminal < Liza::Controller
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
# def self.call args
|
4
|
+
# new.call args
|
5
|
+
# end
|
7
6
|
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
# def initialize args
|
8
|
+
# @args = args
|
9
|
+
# end
|
11
10
|
|
12
|
-
|
11
|
+
# attr_reader :args
|
13
12
|
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
# def call args
|
14
|
+
#
|
15
|
+
# end
|
17
16
|
|
18
|
-
end
|
19
17
|
end
|
@@ -1,14 +1,12 @@
|
|
1
|
-
class DevSystem
|
2
|
-
class TerminalTest < Liza::ControllerTest
|
1
|
+
class DevSystem::TerminalTest < Liza::ControllerTest
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
|
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::Terminal
|
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,22 +1,33 @@
|
|
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
|
1
|
+
class DevSystem::DevBox < Liza::Box
|
8
2
|
|
9
|
-
|
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
|
+
end
|
12
|
+
|
13
|
+
# Configure your generator panel per the DSL in http://guides.lizarb.org/panels/generator.html
|
14
|
+
configure :generator do
|
15
|
+
# set :log_level, ENV["dev.generator.log_level"]
|
16
|
+
end
|
10
17
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
18
|
+
# Configure your command panel per the DSL in http://guides.lizarb.org/panels/log.html
|
19
|
+
configure :log do
|
20
|
+
# set :log_level, ENV["dev.log.log_level"]
|
21
|
+
end
|
15
22
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
23
|
+
# Configure your shell panel per the DSL in http://guides.lizarb.org/panels/shell.html
|
24
|
+
configure :shell do
|
25
|
+
# set :log_level, ENV["dev.shell.log_level"]
|
26
|
+
end
|
20
27
|
|
28
|
+
# Configure your terminal panel per the DSL in http://guides.lizarb.org/panels/terminal.html
|
29
|
+
configure :terminal do
|
30
|
+
# set :log_level, ENV["dev.terminal.log_level"]
|
21
31
|
end
|
32
|
+
|
22
33
|
end
|
@@ -1,19 +1,17 @@
|
|
1
|
-
class DevSystem
|
2
|
-
class DevBoxTest < Liza::BoxTest
|
1
|
+
class DevSystem::DevBoxTest < Liza::BoxTest
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
test :settings do
|
9
|
-
assert subject_class.log_level == :normal
|
10
|
-
assert subject_class.log_color == :green
|
11
|
-
end
|
3
|
+
test :subject_class do
|
4
|
+
assert subject_class == DevSystem::DevBox
|
5
|
+
end
|
12
6
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
7
|
+
test :settings do
|
8
|
+
assert subject_class.log_level == :normal
|
9
|
+
assert subject_class.log_color == :green
|
10
|
+
end
|
17
11
|
|
12
|
+
test :panels do
|
13
|
+
assert subject_class[:command].is_a? DevSystem::CommandPanel
|
14
|
+
assert subject_class[:log].is_a? DevSystem::LogPanel
|
18
15
|
end
|
16
|
+
|
19
17
|
end
|