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
data/app_new.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# This is a LizaRB Application
|
2
|
+
# Learn more: http://lizarb.org/
|
3
|
+
|
4
|
+
class App
|
5
|
+
|
6
|
+
# Modes help you organize your application's behavior and settings.
|
7
|
+
|
8
|
+
mode :code
|
9
|
+
mode :demo
|
10
|
+
|
11
|
+
# Systems help you organize your application's dependencies and RAM memory usage.
|
12
|
+
|
13
|
+
system :dev
|
14
|
+
|
15
|
+
end
|
data/exe/lizarb
CHANGED
@@ -1,11 +1,19 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
+
$APP = ENV["APP"]
|
4
|
+
|
3
5
|
$VERBOSE = ENV["VERBOSE"]
|
4
6
|
|
5
7
|
$LOAD_PATH.unshift "#{Dir.pwd}/lib"
|
6
8
|
|
7
9
|
require_relative "../lib/lizarb.rb"
|
8
10
|
|
11
|
+
Lizarb.setup
|
12
|
+
|
13
|
+
Lizarb.app
|
14
|
+
|
9
15
|
Lizarb.call
|
10
16
|
|
11
|
-
|
17
|
+
App.call ARGV
|
18
|
+
|
19
|
+
Lizarb.exit verbose: true
|
data/lib/app.rb
CHANGED
@@ -1,102 +1,38 @@
|
|
1
|
-
|
1
|
+
class App
|
2
2
|
class Error < StandardError; end
|
3
|
-
class ModeNotFound < Error; end
|
4
3
|
class SystemNotFound < Error; end
|
5
4
|
|
6
5
|
#
|
7
6
|
|
8
|
-
|
9
|
-
|
10
|
-
def log s
|
7
|
+
def self.log s
|
11
8
|
puts s.bold
|
12
9
|
end
|
13
10
|
|
14
|
-
def logv s
|
11
|
+
def self.logv s
|
15
12
|
log s if $VERBOSE
|
16
13
|
end
|
17
14
|
|
18
|
-
# called from
|
19
|
-
def call argv
|
20
|
-
instance_exec &block
|
21
|
-
|
22
|
-
setup_env
|
23
|
-
setup_bundle
|
24
|
-
setup_liza
|
25
|
-
bundle_systems_app Lizarb::APP_DIR
|
26
|
-
|
27
|
-
check_mode!
|
28
|
-
|
15
|
+
# called from exe/lizarb
|
16
|
+
def self.call argv
|
29
17
|
puts
|
30
|
-
|
18
|
+
Liza[:DevBox][:command].call argv
|
31
19
|
puts
|
32
20
|
end
|
33
21
|
|
34
|
-
def root
|
22
|
+
def self.root
|
35
23
|
Pathname Dir.pwd
|
36
24
|
end
|
37
25
|
|
38
|
-
def setup_env
|
39
|
-
require "dotenv"
|
40
|
-
Dotenv.load "app.#{mode}.env", "app.env"
|
41
|
-
end
|
42
|
-
|
43
|
-
def setup_bundle
|
44
|
-
require "bundler/setup"
|
45
|
-
Bundler.require :default, *@systems.keys
|
46
|
-
end
|
47
|
-
|
48
|
-
def setup_liza
|
49
|
-
require "liza"
|
50
|
-
|
51
|
-
@loaders << loader = Zeitwerk::Loader.new
|
52
|
-
loader.tag = Liza.to_s
|
53
|
-
|
54
|
-
# ORDER MATTERS: IGNORE, COLLAPSE, PUSH
|
55
|
-
loader.collapse "#{Liza.source_location_radical}/**/*"
|
56
|
-
loader.push_dir "#{Liza.source_location_radical}", namespace: Liza
|
57
|
-
|
58
|
-
loader.enable_reloading
|
59
|
-
loader.setup
|
60
|
-
end
|
61
|
-
|
62
|
-
def bundle_systems_app app_dir
|
63
|
-
@systems.keys.each do |k|
|
64
|
-
key = "#{k}_system"
|
65
|
-
|
66
|
-
require_system key
|
67
|
-
klass = Object.const_get key.camelize
|
68
|
-
|
69
|
-
@systems[k] = klass
|
70
|
-
end
|
71
|
-
|
72
|
-
@loaders << loader = Zeitwerk::Loader.new
|
73
|
-
|
74
|
-
@systems.each do |k, klass|
|
75
|
-
# ORDER MATTERS: IGNORE, COLLAPSE, PUSH
|
76
|
-
loader.collapse "#{klass.source_location_radical}/**/*"
|
77
|
-
loader.push_dir "#{klass.source_location_radical}", namespace: klass
|
78
|
-
end
|
79
|
-
|
80
|
-
# ORDER MATTERS: IGNORE, COLLAPSE, PUSH
|
81
|
-
loader.collapse "#{app_dir}/app/**/*"
|
82
|
-
loader.push_dir "#{app_dir}/app" if Dir.exist? "#{app_dir}/app"
|
83
|
-
|
84
|
-
loader.enable_reloading
|
85
|
-
loader.setup
|
86
|
-
|
87
|
-
@systems.each do |k, klass|
|
88
|
-
connect_system k, klass
|
89
|
-
end
|
90
|
-
|
91
|
-
@systems.freeze
|
92
|
-
end
|
93
|
-
|
94
26
|
# loaders
|
95
27
|
|
96
28
|
@loaders = []
|
97
29
|
@mutex = Mutex.new
|
98
30
|
|
99
|
-
def
|
31
|
+
def self.loaders
|
32
|
+
@loaders
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.reload &block
|
100
36
|
@mutex.synchronize do
|
101
37
|
@loaders.map &:reload
|
102
38
|
yield if block_given?
|
@@ -105,36 +41,33 @@ module App
|
|
105
41
|
true
|
106
42
|
end
|
107
43
|
|
108
|
-
def
|
109
|
-
|
44
|
+
def self.load_all
|
45
|
+
Lizarb.load_all
|
110
46
|
end
|
111
47
|
|
112
|
-
#
|
48
|
+
# modes
|
113
49
|
|
114
|
-
@modes = [
|
115
|
-
ENV["LIZA_MODE"] ||= @modes.first.to_s
|
116
|
-
@mode = ENV["LIZA_MODE"].to_sym
|
50
|
+
@modes = []
|
117
51
|
|
118
|
-
def mode mode = nil
|
119
|
-
return
|
52
|
+
def self.mode mode = nil
|
53
|
+
return $MODE if mode.nil?
|
120
54
|
@modes << mode.to_sym
|
121
55
|
end
|
122
56
|
|
123
|
-
def
|
124
|
-
|
125
|
-
raise ModeNotFound, "LIZA_MODE `#{@mode}` not found in #{@modes}", []
|
57
|
+
def self.modes
|
58
|
+
@modes
|
126
59
|
end
|
127
60
|
|
128
61
|
# systems
|
129
62
|
|
130
63
|
@systems = {}
|
131
64
|
|
132
|
-
def system key
|
65
|
+
def self.system key
|
133
66
|
raise "locked" if @locked
|
134
67
|
@systems[key] = nil
|
135
68
|
end
|
136
69
|
|
137
|
-
def systems
|
70
|
+
def self.systems
|
138
71
|
@systems
|
139
72
|
end
|
140
73
|
|
@@ -150,7 +83,7 @@ module App
|
|
150
83
|
|
151
84
|
# parts
|
152
85
|
|
153
|
-
def connect_part part_klass, key, system
|
86
|
+
def self.connect_part part_klass, key, system
|
154
87
|
t = Time.now
|
155
88
|
string = "CONNECTING PART #{part_klass.to_s.rjust 25}.part :#{key}"
|
156
89
|
logv string
|
@@ -163,23 +96,22 @@ module App
|
|
163
96
|
end
|
164
97
|
|
165
98
|
if klass.insertion
|
166
|
-
part_klass.class_exec
|
99
|
+
part_klass.class_exec(&klass.insertion)
|
167
100
|
end
|
168
101
|
|
169
102
|
if klass.extension
|
170
103
|
klass.const_set :Extension, Class.new(Liza::PartExtension)
|
171
|
-
klass::Extension.class_exec
|
104
|
+
klass::Extension.class_exec(&klass.extension)
|
172
105
|
end
|
173
106
|
logv "#{string} takes #{t.diff}s"
|
174
107
|
end
|
175
108
|
|
176
109
|
# systems
|
177
110
|
|
178
|
-
def connect_system key, system_klass
|
111
|
+
def self.connect_system key, system_klass
|
179
112
|
t = Time.now
|
180
113
|
|
181
114
|
color_system_klass = system_klass.to_s.colorize system_klass.log_color
|
182
|
-
color_key = key.to_s.colorize system_klass.log_color
|
183
115
|
|
184
116
|
registrar_index = 0
|
185
117
|
system_klass.registrar.each do |string, target_block|
|
@@ -190,7 +122,7 @@ module App
|
|
190
122
|
target_klass = Liza.const reg_target
|
191
123
|
|
192
124
|
if reg_type == "insertion"
|
193
|
-
target_klass.class_exec
|
125
|
+
target_klass.class_exec(&target_block)
|
194
126
|
else
|
195
127
|
raise "TODO: decide and implement system extension"
|
196
128
|
end
|
@@ -1,29 +1,34 @@
|
|
1
|
-
class DevSystem
|
2
|
-
class NotFoundBench < Bench
|
1
|
+
class DevSystem::NotFoundBench < DevSystem::Bench
|
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
|
+
benches = Liza::Bench.descendants
|
13
|
+
benches -= ignored_benches
|
14
14
|
|
15
|
-
|
16
|
-
puts
|
15
|
+
# 3. LIST benches
|
17
16
|
|
18
|
-
|
19
|
-
puts
|
17
|
+
keys = benches.map { _1.last_namespace.snakecase[0..-7] }.uniq.sort
|
20
18
|
|
21
|
-
|
19
|
+
log "Liza comes with #{keys.count} benches you can use."
|
20
|
+
log "Here they are:"
|
21
|
+
puts
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
keys.each { |s| log "liza bench #{s}" }
|
26
|
-
end
|
23
|
+
keys.each { |s| log "liza bench #{s}" }
|
24
|
+
end
|
27
25
|
|
26
|
+
def self.ignored_benches
|
27
|
+
[
|
28
|
+
self,
|
29
|
+
DevSystem::NotFoundBench,
|
30
|
+
(DevSystem::SortedBench if defined? SortedBench),
|
31
|
+
].uniq.compact
|
28
32
|
end
|
33
|
+
|
29
34
|
end
|
@@ -1,14 +1,12 @@
|
|
1
|
-
class DevSystem
|
2
|
-
class NotFoundBenchTest < BenchTest
|
1
|
+
class DevSystem::NotFoundBenchTest < DevSystem::BenchTest
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
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,14 +1,12 @@
|
|
1
|
-
class DevSystem
|
2
|
-
class BenchTest < Liza::ControllerTest
|
1
|
+
class DevSystem::BenchTest < 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::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,31 @@
|
|
1
|
-
class DevSystem
|
2
|
-
class BenchCommand < Command
|
1
|
+
class DevSystem::BenchCommand < DevSystem::Command
|
3
2
|
|
4
|
-
|
5
|
-
|
3
|
+
def self.call args
|
4
|
+
# 1. LOG
|
6
5
|
|
7
|
-
|
8
|
-
puts
|
6
|
+
log "args = #{args.inspect}"
|
9
7
|
|
10
|
-
|
8
|
+
# 2. FIND bench
|
11
9
|
|
12
|
-
|
10
|
+
return call_not_found args if args.none?
|
13
11
|
|
14
|
-
|
12
|
+
bench = args[0]
|
15
13
|
|
16
|
-
|
14
|
+
log({bench:})
|
17
15
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
end
|
23
|
-
|
24
|
-
# 3. CALL
|
25
|
-
|
26
|
-
bench_klass.call args[1..-1]
|
16
|
+
begin
|
17
|
+
bench_klass = Liza.const "#{bench}_bench"
|
18
|
+
rescue Liza::ConstNotFound
|
19
|
+
bench_klass = NotFoundBench
|
27
20
|
end
|
28
21
|
|
29
|
-
|
30
|
-
Liza::NotFoundBench.call args
|
31
|
-
end
|
22
|
+
# 3. CALL
|
32
23
|
|
24
|
+
bench_klass.call args[1..-1]
|
33
25
|
end
|
26
|
+
|
27
|
+
def self.call_not_found args
|
28
|
+
Liza::NotFoundBench.call args
|
29
|
+
end
|
30
|
+
|
34
31
|
end
|
@@ -1,14 +1,12 @@
|
|
1
|
-
class DevSystem
|
2
|
-
class BenchCommandTest < CommandTest
|
1
|
+
class DevSystem::BenchCommandTest < DevSystem::CommandTest
|
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::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,35 +1,9 @@
|
|
1
|
-
class DevSystem
|
2
|
-
class GenerateCommand < Command
|
1
|
+
class DevSystem::GenerateCommand < DevSystem::Command
|
3
2
|
|
4
|
-
|
5
|
-
|
3
|
+
def call args
|
4
|
+
log "args = #{args}" if DevBox[:generator].get :log_details
|
6
5
|
|
7
|
-
|
8
|
-
puts
|
9
|
-
|
10
|
-
# 2. FIND generator
|
11
|
-
|
12
|
-
return call_not_found args if args.none?
|
13
|
-
|
14
|
-
generator = args[0]
|
15
|
-
|
16
|
-
log({generator:})
|
17
|
-
|
18
|
-
#
|
19
|
-
|
20
|
-
begin
|
21
|
-
generator_class = Liza.const "#{generator}_generator"
|
22
|
-
rescue Liza::ConstNotFound
|
23
|
-
generator_class = NotFoundGenerator
|
24
|
-
end
|
25
|
-
|
26
|
-
# 3. CALL
|
27
|
-
|
28
|
-
generator_class.call args[1..-1]
|
29
|
-
end
|
30
|
-
|
31
|
-
def self.call_not_found args
|
32
|
-
Liza::NotFoundGenerator.call args
|
33
|
-
end
|
6
|
+
DevBox[:generator].call args
|
34
7
|
end
|
8
|
+
|
35
9
|
end
|
@@ -1,14 +1,12 @@
|
|
1
|
-
class DevSystem
|
2
|
-
class GenerateCommandTest < CommandTest
|
1
|
+
class DevSystem::GenerateCommandTest < DevSystem::CommandTest
|
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::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,48 @@
|
|
1
|
-
class DevSystem
|
2
|
-
class NotFoundCommand < Command
|
1
|
+
class DevSystem::NotFoundCommand < DevSystem::Command
|
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 commands
|
11
10
|
|
12
|
-
|
13
|
-
|
11
|
+
App.load_all
|
12
|
+
commands = Liza::Command.descendants
|
13
|
+
commands -= ignored_commands
|
14
14
|
|
15
|
-
|
16
|
-
puts
|
15
|
+
# 3. LIST commands
|
17
16
|
|
18
|
-
|
19
|
-
puts
|
17
|
+
keys = commands.map { _1.last_namespace.snakecase[0..-9] }.uniq.sort
|
20
18
|
|
21
|
-
|
19
|
+
log "Liza comes with #{keys.count} commands you can use."
|
20
|
+
log "Here they are:"
|
21
|
+
puts
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
23
|
+
keys.each { |s| log "liza #{s}" }
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.ignored_commands
|
27
|
+
[
|
28
|
+
self,
|
29
|
+
DevSystem::NotFoundCommand,
|
30
|
+
DevSystem::NewCommand,
|
31
|
+
DevSystem::TerminalCommand,
|
32
|
+
(DevSystem::NarrativeMethodCommand if defined? NarrativeMethodCommand),
|
33
|
+
].uniq.compact
|
34
|
+
end
|
27
35
|
|
36
|
+
if $APP == "app_global"
|
37
|
+
def self.ignored_commands
|
38
|
+
[
|
39
|
+
self,
|
40
|
+
DevSystem::NotFoundCommand,
|
41
|
+
DevSystem::BenchCommand,
|
42
|
+
DevSystem::GenerateCommand,
|
43
|
+
DevSystem::TestCommand,
|
44
|
+
].uniq.compact
|
45
|
+
end
|
28
46
|
end
|
47
|
+
|
29
48
|
end
|
@@ -1,14 +1,12 @@
|
|
1
|
-
class DevSystem
|
2
|
-
class NotFoundCommandTest < CommandTest
|
1
|
+
class DevSystem::NotFoundCommandTest < DevSystem::CommandTest
|
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::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
|
@@ -1,24 +1,22 @@
|
|
1
|
-
class DevSystem
|
2
|
-
class TerminalCommand < Command
|
1
|
+
class DevSystem::TerminalCommand < DevSystem::Command
|
3
2
|
|
4
|
-
|
5
|
-
|
3
|
+
def call args
|
4
|
+
# 1. LOG
|
6
5
|
|
7
|
-
|
8
|
-
|
6
|
+
log "args = #{args.inspect}"
|
7
|
+
puts
|
9
8
|
|
10
|
-
|
9
|
+
# 2. FIND terminal
|
11
10
|
|
12
|
-
|
11
|
+
terminal = args[0] || "irb"
|
13
12
|
|
14
|
-
|
13
|
+
log({terminal:})
|
15
14
|
|
16
|
-
|
15
|
+
terminal_klass = Liza.const "#{terminal}_terminal"
|
17
16
|
|
18
|
-
|
19
|
-
|
20
|
-
terminal_klass.call Array(args[1..-1])
|
21
|
-
end
|
17
|
+
# 3. CALL
|
22
18
|
|
19
|
+
terminal_klass.call Array(args[1..-1])
|
23
20
|
end
|
21
|
+
|
24
22
|
end
|
@@ -1,14 +1,12 @@
|
|
1
|
-
class DevSystem
|
2
|
-
class TerminalCommandTest < CommandTest
|
1
|
+
class DevSystem::TerminalCommandTest < DevSystem::CommandTest
|
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::TerminalCommand
|
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
|