lizarb 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (120) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +12 -13
  3. data/Rakefile +38 -0
  4. data/app/dev_box.rb +14 -12
  5. data/app/happy_box.rb +2 -2
  6. data/app/net_box.rb +4 -4
  7. data/app/web_box.rb +4 -4
  8. data/app.rb +6 -7
  9. data/{exe/Gemfile → app_global.gemfile.rb} +2 -0
  10. data/app_global.gemfile.rb.lock +19 -0
  11. data/app_global.rb +4 -0
  12. data/{app → app_new}/dev/benches/loops_bench.rb +3 -2
  13. data/{app/dev/generators/bench_generator_test.rb → app_new/dev/benches/loops_bench_test.rb} +2 -2
  14. data/app_new/dev/benches/objects_bench.rb +83 -0
  15. data/{app/dev/generators/record_generator_test.rb → app_new/dev/benches/objects_bench_test.rb} +2 -2
  16. data/app_new/dev/benches/sorted_bench.rb +54 -0
  17. data/app_new/dev/benches/sorted_bench_test.rb +12 -0
  18. data/app_new/dev/benches/variables_bench.rb +55 -0
  19. data/{app/dev/generators/command_generator_test.rb → app_new/dev/benches/variables_bench_test.rb} +2 -2
  20. data/{app → app_new}/dev/commands/calculator_command.rb +1 -1
  21. data/{app → app_new}/dev/commands/circle_command.rb +1 -1
  22. data/{app → app_new}/dev/commands/narrative_method_command.rb +5 -7
  23. data/{app → app_new}/dev/commands/quadratic_command.rb +1 -1
  24. data/app_new/dev_box.rb +14 -0
  25. data/app_new.rb +15 -0
  26. data/exe/lizarb +9 -1
  27. data/lib/app.rb +27 -95
  28. data/lib/dev_system/dev/controllers/bench/not_found_bench.rb +15 -8
  29. data/lib/dev_system/dev/controllers/bench.rb +0 -6
  30. data/lib/dev_system/dev/controllers/command/bench_command.rb +1 -2
  31. data/lib/dev_system/dev/controllers/command/generate_command.rb +3 -27
  32. data/lib/dev_system/dev/controllers/command/new_command.rb +9 -0
  33. data/lib/dev_system/dev/controllers/command/new_command_test.rb +7 -0
  34. data/lib/dev_system/dev/controllers/command/not_found_command.rb +29 -8
  35. data/lib/dev_system/dev/controllers/command/terminal_command.rb +2 -2
  36. data/lib/dev_system/dev/controllers/command/test_command.rb +6 -6
  37. data/lib/dev_system/dev/controllers/command.rb +9 -13
  38. data/lib/dev_system/dev/controllers/generator_dsl_main_part.rb +2 -4
  39. data/{app/dev/generators/bench_generator/bench.rb.erb → lib/dev_system/dev/controllers/generators/bench_generator/controller.rb.erb} +1 -2
  40. data/{app/dev/generators/bench_generator/bench_test.rb.erb → lib/dev_system/dev/controllers/generators/bench_generator/controller_test.rb.erb} +2 -2
  41. data/lib/dev_system/dev/controllers/generators/bench_generator.rb +12 -0
  42. data/lib/dev_system/dev/controllers/generators/bench_generator_test.rb +12 -0
  43. data/lib/dev_system/dev/controllers/generators/command_generator/controller.rb.erb +41 -0
  44. data/{app/dev/generators/command_generator/command_test.rb.erb → lib/dev_system/dev/controllers/generators/command_generator/controller_test.rb.erb} +2 -2
  45. data/lib/dev_system/dev/controllers/generators/command_generator.rb +19 -0
  46. data/lib/dev_system/dev/controllers/generators/command_generator_test.rb +12 -0
  47. data/lib/dev_system/dev/controllers/generators/controller_generator.rb +97 -0
  48. data/lib/dev_system/dev/controllers/generators/controller_generator_test.rb +12 -0
  49. data/lib/dev_system/dev/controllers/generators/generator_generator/template.rb.erb +1 -1
  50. data/lib/dev_system/dev/controllers/generators/new_generator.rb +117 -0
  51. data/lib/dev_system/dev/controllers/generators/new_generator_test.rb +12 -0
  52. data/lib/dev_system/dev/controllers/generators/not_found_generator.rb +20 -8
  53. data/{app/dev → lib/dev_system/dev/controllers}/generators/record_generator.rb +1 -1
  54. data/lib/dev_system/dev/controllers/generators/record_generator_test.rb +12 -0
  55. data/{app/dev → lib/dev_system/dev/controllers}/generators/request_generator.rb +2 -2
  56. data/lib/dev_system/dev/controllers/generators/request_generator_test.rb +12 -0
  57. data/lib/dev_system/dev/controllers/log.rb +3 -0
  58. data/{app/dev/generators/request_generator_test.rb → lib/dev_system/dev/controllers/log_test.rb} +2 -2
  59. data/lib/dev_system/dev/controllers/shell.rb +22 -0
  60. data/lib/dev_system/dev/controllers/shell_test.rb +25 -0
  61. data/lib/dev_system/dev/controllers/terminal/irb_terminal.rb +7 -1
  62. data/lib/dev_system/dev/controllers/terminal/pry_terminal.rb +1 -1
  63. data/lib/dev_system/dev/dev_box.rb +12 -18
  64. data/lib/dev_system/dev/panels/command_panel.rb +54 -11
  65. data/lib/dev_system/dev/panels/command_panel_test.rb +35 -10
  66. data/lib/dev_system/dev/panels/generator_panel.rb +70 -0
  67. data/lib/dev_system/dev/panels/generator_panel_test.rb +34 -0
  68. data/lib/happy_system/happy/happy_box.rb +2 -3
  69. data/lib/lerb.rb +95 -49
  70. data/lib/liza/base/box.rb +6 -1
  71. data/lib/liza/base/panel.rb +16 -18
  72. data/lib/liza/base/panel_test.rb +27 -1
  73. data/lib/liza/base_parts/controller_renderer_part.rb +1 -1
  74. data/lib/liza/ruby_tests/module_test.rb +2 -2
  75. data/lib/liza/test/test_test.rb +5 -1
  76. data/lib/liza/test_parts/test_assertions_part.rb +1 -1
  77. data/lib/liza/test_parts/test_dsl_part.rb +3 -3
  78. data/lib/liza/test_parts/test_tree_part.rb +4 -49
  79. data/lib/liza/unit.rb +73 -79
  80. data/lib/liza/unit_parts/unit_procedure_part_test.rb +9 -9
  81. data/lib/liza/unit_parts/unit_settings_part.rb +76 -0
  82. data/lib/liza/unit_parts/unit_settings_part_test.rb +3 -0
  83. data/lib/liza/unit_test.rb +11 -0
  84. data/lib/liza.rb +10 -1
  85. data/lib/lizarb/ruby/module.rb +1 -1
  86. data/lib/lizarb/version.rb +1 -1
  87. data/lib/lizarb.rb +247 -23
  88. data/lib/net_system/dev/net_command.rb +9 -9
  89. data/lib/net_system/net/controllers/client/redis_client.rb +1 -1
  90. data/lib/net_system/net/controllers/client/sqlite_client.rb +1 -1
  91. data/lib/net_system/net/net_box.rb +4 -6
  92. data/lib/web_system/dev/rack_command.rb +1 -8
  93. data/lib/web_system/dev/request_command.rb +6 -20
  94. data/lib/web_system/web/panels/request_panel.rb +0 -2
  95. data/lib/web_system/web/web_box.rb +4 -6
  96. data/lizarb.gemspec +1 -1
  97. metadata +46 -41
  98. data/.ruby-version +0 -1
  99. data/app/dev/benches/app_bench.rb +0 -5
  100. data/app/dev/benches/app_bench_test.rb +0 -7
  101. data/app/dev/benches/loops_bench_test.rb +0 -11
  102. data/app/dev/commands/app_command.rb +0 -5
  103. data/app/dev/commands/app_command_test.rb +0 -7
  104. data/app/dev/commands/new_command.rb +0 -9
  105. data/app/dev/commands/new_command_test.rb +0 -7
  106. data/app/dev/generators/bench_generator.rb +0 -18
  107. data/app/dev/generators/command_generator/command.rb.erb +0 -26
  108. data/app/dev/generators/command_generator.rb +0 -18
  109. data/exe/Gemfile.lock +0 -13
  110. data/lib/dev_system/dev/controllers/bench_dsl_main_part.rb +0 -58
  111. data/lib/dev_system/dev/controllers/command/echo_command.rb +0 -9
  112. data/lib/dev_system/dev/controllers/command/echo_command_test.rb +0 -12
  113. data/lib/dev_system/dev/controllers/command/version_command.rb +0 -7
  114. data/lib/dev_system/dev/controllers/command/version_command_test.rb +0 -12
  115. data/lib/dev_system/dev/controllers/generators/app_generator.rb +0 -146
  116. data/lib/dev_system/dev/controllers/generators/app_generator_test.rb +0 -12
  117. /data/{app → app_new}/dev/commands/calculator_command_test.rb +0 -0
  118. /data/{app → app_new}/dev/commands/circle_command_test.rb +0 -0
  119. /data/{app → app_new}/dev/commands/narrative_method_command_test.rb +0 -0
  120. /data/{app → app_new}/dev/commands/quadratic_command_test.rb +0 -0
@@ -1,3 +1,73 @@
1
1
  class DevSystem::GeneratorPanel < Liza::Panel
2
+ class Error < StandardError; end
3
+ class ParseError < Error; end
4
+
5
+ #
6
+
7
+ def call args
8
+ log "args = #{args}"
9
+
10
+ return call_not_found args if args.none?
11
+
12
+ struct = parse args[0]
13
+ struct.generator = short struct.generator
14
+ generator = find struct.generator
15
+
16
+ case
17
+ when struct.class_method
18
+ _call_log "#{generator}.#{struct.class_method}(#{args[1..-1]})"
19
+ generator.public_send struct.class_method, args[1..-1]
20
+ when struct.instance_method
21
+ _call_log "#{generator}.new.#{struct.instance_method}(#{args[1..-1]})"
22
+ generator.new.public_send struct.instance_method, args[1..-1]
23
+ when struct.method
24
+ if generator.respond_to?(struct.method)
25
+ _call_log "#{generator}.#{struct.method}(#{args[1..-1]})"
26
+ generator.public_send struct.method, args[1..-1]
27
+ else
28
+ _call_log "#{generator}.new.#{struct.method}(#{args[1..-1]})"
29
+ generator.new.public_send struct.method, args[1..-1]
30
+ end
31
+ else
32
+ _call_log "#{generator}.call(#{args[1..-1]})"
33
+ generator.call args[1..-1]
34
+ end
35
+ rescue ParseError
36
+ call_not_found args
37
+ end
38
+
39
+ def _call_log string
40
+ log "#{string}" if get :log_details
41
+ end
42
+
43
+ #
44
+
45
+ PARSE_REGEX = /(?<generator>[a-z_]+)(?::(?<class_method>[a-z_]+))?(?:#(?<instance_method>[a-z_]+))?(?:\.(?<method>[a-z_]+))?/
46
+
47
+ # OpenStruct generator class_method instance_method method
48
+ def parse string
49
+ md = string.to_s.match PARSE_REGEX
50
+ raise ParseError if md.nil?
51
+ hash = md.named_captures
52
+ log "{#{hash.map { ":#{_1} => #{_2.to_s.inspect}" }.join(", ") }}" if get :log_details
53
+ OpenStruct.new hash
54
+ end
55
+
56
+ #
57
+
58
+ def find string
59
+ k = Liza.const "#{string}_generator"
60
+ rescue Liza::ConstNotFound
61
+ k = Liza::NotFoundGenerator
62
+ ensure
63
+ log k.to_s if get :log_details
64
+ k
65
+ end
66
+
67
+ #
68
+
69
+ def call_not_found args
70
+ Liza[:NotFoundGenerator].call args
71
+ end
2
72
 
3
73
  end
@@ -9,4 +9,38 @@ class DevSystem::GeneratorPanelTest < Liza::PanelTest
9
9
  assert subject_class.log_color == :green
10
10
  end
11
11
 
12
+ test :parse do
13
+ struct = subject.parse "system"
14
+ assert_equality struct.generator, "system"
15
+ assert_equality struct.class_method, nil
16
+ assert_equality struct.instance_method, nil
17
+ assert_equality struct.method, nil
18
+
19
+ struct = subject.parse "system:install"
20
+ assert_equality struct.generator, "system"
21
+ assert_equality struct.class_method, "install"
22
+ assert_equality struct.instance_method, nil
23
+ assert_equality struct.method, nil
24
+
25
+ struct = subject.parse "system#install"
26
+ assert_equality struct.generator, "system"
27
+ assert_equality struct.class_method, nil
28
+ assert_equality struct.instance_method, "install"
29
+ assert_equality struct.method, nil
30
+
31
+ struct = subject.parse "system.install"
32
+ assert_equality struct.generator, "system"
33
+ assert_equality struct.class_method, nil
34
+ assert_equality struct.instance_method, nil
35
+ assert_equality struct.method, "install"
36
+ end
37
+
38
+ test :find do
39
+ klass = subject.find "command"
40
+ assert_equality DevSystem::CommandGenerator, klass
41
+
42
+ klass = subject.find "c"
43
+ assert_equality DevSystem::NotFoundGenerator, klass
44
+ end
45
+
12
46
  end
@@ -1,9 +1,8 @@
1
1
  class HappySystem::HappyBox < Liza::Box
2
2
 
3
- # Set up your axo panel per the DSL in http://guides.lizarb.org/panels/axo.html
4
- panel :axo do
3
+ # Configure your axo panel per the DSL in http://guides.lizarb.org/panels/axo.html
4
+ configure :axo do
5
5
  # set :log_level, ENV["happy.axo.log_level"]
6
6
  end
7
7
 
8
- has_controller :axo
9
8
  end
data/lib/lerb.rb CHANGED
@@ -3,95 +3,141 @@
3
3
  # https://docs.ruby-lang.org/en/3.2/ERB.html
4
4
  require "erb"
5
5
 
6
+ $LERB_VERBOSE = ENV["LERB_VERBOSE"]
7
+
6
8
  class LERB < ERB
7
9
  class Error < StandardError; end
8
10
  class BuildError < Error; end
9
11
  class ExecutionError < Error; end
10
12
 
11
- # loaders
13
+ # output
12
14
 
13
- def self.load path_radical
14
- load_from_folder(path_radical) + load_from_file("#{path_radical}.rb")
15
+ def self.puts string=nil
16
+ super if $LERB_VERBOSE
15
17
  end
16
18
 
17
- def self.load_from_file path
18
- ret = []
19
-
20
- fname = path
21
- return ret unless File.exist? path
19
+ # loaders
22
20
 
23
- lines = File.readlines fname
21
+ DEFAULT_KEY = "inline.txt.erb"
24
22
 
25
- lineno = lines.index "__END__\n"
26
- return ret if lineno.nil?
23
+ def self.load path_radical
24
+ erbs = []
27
25
 
28
- content = lines[lineno+1..-1].join
29
- array = content.split(/^# (\w*).(\w*).(\w*)$/)
30
- # => ["", "a", "html", "erb", "\n<html>\n<a></a>\n</html>\n", "b", "html", "erb", "\n<html>\n<b></b>\n</html>"]
26
+ "#{path_radical}.rb".tap do |filename|
27
+ _load erbs, filename
28
+ end
31
29
 
32
- while (chunk = array.pop 4; chunk.size == 4)
33
- # => ["b", "html", "erb", "\n<html>\n<b></b>\n</html>"]
34
- # => ["a", "html", "erb", "\n<html>\n<a></a>\n</html>\n"]
35
- key = "#{chunk[0]}.#{chunk[1]}.#{chunk[2]}"
36
- content = chunk[3]
37
- ret.push new :file, key, content, fname, lineno
30
+ Dir.glob("#{path_radical}.*.erb").each do |filename|
31
+ _load erbs, filename
38
32
  end
39
33
 
40
- ret
41
- end
34
+ Dir.glob("#{path_radical}/*.*.erb").each do |filename|
35
+ _load erbs, filename
36
+ end
42
37
 
43
- def self.load_from_folder path
44
- ret = []
38
+ #
45
39
 
46
- lineno = 0
47
- fnames = Dir.glob "#{path}/*.*.erb"
48
- fnames.map do |fname|
49
- key = fname.split("/").last
50
- content = File.read fname
51
- ret.push new :folder, key, content, fname, lineno
40
+ puts "#{erbs.size} erbs".on_red
41
+ erbs.each do |h|
42
+ puts "key: #{h.key}".on_green
52
43
  end
53
44
 
54
- ret
45
+ erbs
55
46
  end
56
47
 
57
- # format
48
+ def self._load erbs, filename
49
+ is_erb = filename.end_with? ".erb"
50
+ is_ignoring_ruby = !is_erb
51
+ is_accepting_views = false
52
+
53
+ puts
54
+ puts "LERB filename: #{filename}".on_red
55
+
56
+ puts "LERB is_erb: #{is_erb}".on_red
57
+ puts "LERB is_ignoring_ruby: #{is_ignoring_ruby}".on_red
58
+ puts "LERB is_accepting_views: #{is_accepting_views}".on_red
59
+
60
+ current_lineno = 0
61
+ current_content = ""
62
+ current_key = is_erb ? filename.split("/").last : DEFAULT_KEY
63
+
64
+ if current_key
65
+ puts "LERB declare: #{current_key} | because not erb".green
66
+ end
58
67
 
59
- TAG_FORMATS = %w|xml html|
68
+ File.readlines(filename).each.with_index do |line, lineno|
69
+ is_line_end = line == "__END__\n"
70
+
71
+ # stop ignoring ruby lines if line is __END__
72
+ # move to next line if ignoring ruby lines
73
+
74
+ if is_ignoring_ruby
75
+ puts "LERB ignore: #{lineno}: #{line[0..-2]}".light_black
76
+ if is_line_end
77
+ is_ignoring_ruby = false
78
+ is_accepting_views = true
79
+ current_lineno = lineno + 1
80
+ puts "LERB declare: #{current_key} | current".green if current_key
81
+ end
82
+ next
83
+ end
84
+
85
+ if is_accepting_views && line[0..6] == "# view "
86
+ _load_into erbs, filename, current_lineno, current_key, current_content
87
+ current_key = line[7..-1].strip
88
+ current_lineno = lineno + 1
89
+ current_content = ""
90
+ puts "LERB declare: #{current_key} | #{lineno}: #{line[0..-2]}".green
91
+ else
92
+ current_content += line
93
+ puts "LERB keeping: #{lineno}: #{line[0..-2]}".bold.white
94
+ end
95
+
96
+ if is_line_end
97
+ puts "LERB warning: #{lineno}: #{line[0..-2]} found! No longer accepting views".light_yellow
98
+ is_accepting_views = false
99
+ end
100
+ end
60
101
 
61
- def tags?
62
- TAG_FORMATS.include? format
102
+ _load_into erbs, filename, current_lineno, current_key, current_content
103
+
104
+ erbs
63
105
  end
64
106
 
65
- # source
107
+ def self._load_into erbs, filename, lineno, key, content
108
+ return unless key
109
+ return unless key.end_with? "erb"
110
+ return if content.strip.empty?
66
111
 
67
- SOURCES = %i|file folder|
112
+ content += "\n" if content[-1] != "\n"
68
113
 
69
- def file?
70
- @source == :file
114
+ erbs.push new filename, lineno, key, content
71
115
  end
72
116
 
73
- def folder?
74
- @source == :folder
117
+ # format
118
+
119
+ TAG_FORMATS = %w|xml html|
120
+
121
+ def tags?
122
+ TAG_FORMATS.include? format
75
123
  end
76
124
 
77
125
  # constructor
78
126
 
79
127
  TRIM_MODE = "<>-"
80
128
 
81
- attr_reader :source, :key, :name, :format
82
-
83
- def initialize source, key, content, filename, lineno
84
- raise BuildError, "source :#{source} must be one of #{SOURCES}" unless SOURCES.include? source
129
+ attr_reader :key, :name, :format
85
130
 
131
+ def initialize filename, lineno, key, content
86
132
  segments = key.split("/").last.split(".")
87
133
  name, format = segments[0..1]
88
134
 
89
- # raise BuildError, "key '#{key}' must be formatted as <name>.<format>.erb" unless segments.count == 3
90
- # raise BuildError, "key '#{key}' must be formatted as <name>.<format>.erb" unless segments[2] == "erb"
91
- raise BuildError, "key '#{key}' has an invalid format '#{format}'" unless format.gsub(/[^a-z0-9]/, "") == format
135
+ if format.gsub(/[^a-z0-9]/, "") != format
136
+ raise BuildError, "key '#{key}' has an invalid format '#{format}'"
137
+ end
92
138
 
93
139
  super content, trim_mode: TRIM_MODE
94
- @source, @key, @name, @format, self.filename, self.lineno = source, key, name, format, filename, lineno
140
+ self.filename, self.lineno, @key, @name, @format = filename, lineno, key, name, format
95
141
  end
96
142
 
97
143
  # result
data/lib/liza/base/box.rb CHANGED
@@ -56,7 +56,7 @@ class Liza::Box < Liza::Unit
56
56
  panels[symbol].started
57
57
  end
58
58
 
59
- def self.panel symbol, panel_class = nil, &block
59
+ def self.has_panel symbol, panel_class = nil, &block
60
60
  raise ArgumentError, "block required" unless block_given?
61
61
 
62
62
  system_class = get :system
@@ -82,4 +82,9 @@ class Liza::Box < Liza::Unit
82
82
  controller_class.on_connected self, panel
83
83
  end
84
84
 
85
+ def self.configure name, &block
86
+ has_panel name, &block
87
+ has_controller name, name
88
+ end
89
+
85
90
  end
@@ -13,12 +13,27 @@ class Liza::Panel < Liza::Unit
13
13
  self.class.box
14
14
  end
15
15
 
16
+ #
17
+
16
18
  def initialize key
17
19
  @key = key
18
20
  @blocks = []
19
21
  @unstarted = true
22
+ @short = {}
20
23
  end
21
24
 
25
+ #
26
+
27
+ def short a, b = nil
28
+ if b
29
+ @short[a.to_s] = b.to_s
30
+ else
31
+ @short[a.to_s] || a.to_s
32
+ end
33
+ end
34
+
35
+ #
36
+
22
37
  def push block
23
38
  @unstarted = true
24
39
  @blocks.push block
@@ -28,27 +43,10 @@ class Liza::Panel < Liza::Unit
28
43
  return self unless defined? @unstarted
29
44
  remove_instance_variable :@unstarted
30
45
 
31
- @blocks.each { |bl| instance_eval &bl }
46
+ @blocks.each { |bl| instance_eval(&bl) }
32
47
  @blocks.clear
33
48
 
34
49
  self
35
50
  end
36
-
37
- def log log_level = :normal, string
38
- raise "invalid log_level `#{log_level}`" unless LOG_LEVELS.keys.include? log_level
39
- return unless log_level? log_level
40
-
41
- source = box.to_s
42
-
43
- x = source.size
44
- source = source.bold.colorize log_color
45
-
46
- y = source.size
47
- source = "#{source}[:#{@key}]".ljust(LOG_JUST+y-x)
48
-
49
- string = "#{source} #{string}"
50
-
51
- DevBox[:log].call string
52
- end
53
51
 
54
52
  end
@@ -4,11 +4,37 @@ class Liza::PanelTest < Liza::UnitTest
4
4
  end
5
5
 
6
6
  def subject
7
- subject_class.new "name"
7
+ @subject ||= subject_class.new "name"
8
8
  end
9
9
 
10
10
  test :settings do
11
11
  assert subject_class.log_level == :normal
12
12
  assert subject_class.log_color == :white
13
13
  end
14
+
15
+ test :short do
16
+ assert_equality subject.short("m"), "m"
17
+ assert_equality subject.short("i"), "i"
18
+ assert_equality subject.short("n"), "n"
19
+ assert_equality subject.short("s"), "s"
20
+ assert_equality subject.short("w"), "w"
21
+ assert_equality subject.short("a"), "a"
22
+ assert_equality subject.short("n"), "n"
23
+
24
+ subject.short :m, :matz
25
+ subject.short :i, :is
26
+ subject.short :n, :nice
27
+ subject.short :s, :so
28
+ subject.short :w, :we
29
+ subject.short :a, :are
30
+
31
+ assert_equality subject.short("m"), "matz"
32
+ assert_equality subject.short("i"), "is"
33
+ assert_equality subject.short("n"), "nice"
34
+ assert_equality subject.short("s"), "so"
35
+ assert_equality subject.short("w"), "we"
36
+ assert_equality subject.short("a"), "are"
37
+ assert_equality subject.short("n"), "nice"
38
+ end
39
+
14
40
  end
@@ -93,7 +93,7 @@ Did you forget to add ERB keys?
93
93
  s = erb.result the_binding, receiver
94
94
  _log_render_out key, s.length, t.diff
95
95
  s = wrap_comment_tags s, erb if App.mode == :code && erb.tags?
96
- stack.push s.strip
96
+ stack.push s
97
97
  end
98
98
 
99
99
  stack.pop
@@ -8,14 +8,14 @@ class Liza::ModuleTest < Liza::RubyTest
8
8
  assert Object.source_location == []
9
9
 
10
10
  assert Liza::Command.source_location[1] == 1
11
- assert AppCommand.source_location[1] == 1
11
+ assert TerminalCommand.source_location[1] == 1
12
12
  end
13
13
 
14
14
  test :source_location_radical do
15
15
  assert Object.source_location_radical == nil
16
16
 
17
17
  assert Liza::Command.source_location_radical.end_with? "/lib/dev_system/dev/controllers/command"
18
- assert AppCommand.source_location_radical.end_with? "/app/dev/commands/app_command"
18
+ assert TerminalCommand.source_location_radical.end_with? "/lib/dev_system/dev/controllers/command/terminal_command"
19
19
  end
20
20
 
21
21
  end
@@ -74,7 +74,11 @@ class Liza::TestTest < Liza::Test
74
74
 
75
75
  group :instance_variables do
76
76
  test :instance_variables do
77
- assert_equality instance_variables, [:@test_words, :@before_stack, :@after_stack, :@test_block]
77
+ if Shell.jruby?
78
+ todo "jruby!"
79
+ else
80
+ assert_equality instance_variables, [:@test_words, :@before_stack, :@after_stack, :@test_block]
81
+ end
78
82
  end
79
83
 
80
84
  test :test_block do
@@ -56,7 +56,7 @@ class Liza::TestAssertionsPart < Liza::Part
56
56
  block_given? || raise(ArgumentError, "No block given")
57
57
 
58
58
  _groups << block
59
- instance_exec &block
59
+ instance_exec(&block)
60
60
  _groups.pop
61
61
 
62
62
  kaller ||= caller
@@ -40,20 +40,20 @@ class Liza::TestDslPart < Liza::Part
40
40
  log " calling stacked before blocks #{stack.map { |bl| _log_test_block bl }}".magenta if log_test_building?
41
41
  stack.each do |bl|
42
42
  log_test_call "B&", &bl if log_test_call_block?
43
- instance_exec &bl
43
+ instance_exec(&bl)
44
44
  end
45
45
  end
46
46
 
47
47
  bl = @test_block
48
48
  log " calling test block #{_log_test_block bl}".magenta if log_test_building?
49
49
  log_test_call "T&", &bl if log_test_call_block?
50
- instance_exec &bl
50
+ instance_exec(&bl)
51
51
 
52
52
  @after_stack.each do |stack|
53
53
  log " calling stacked after blocks #{stack.map { |bl| _log_test_block bl }}".magenta if log_test_building?
54
54
  stack.each do |bl|
55
55
  log_test_call "A&", &bl if log_test_call_block?
56
- instance_exec &bl
56
+ instance_exec(&bl)
57
57
  end
58
58
  end
59
59
  end
@@ -17,7 +17,7 @@ class Liza::TestTreePart < Liza::Part
17
17
  raise ArgumentError, "No block given" unless block_given?
18
18
  previous = test_node
19
19
  @test_node = test_node.branch_out words
20
- instance_exec &block
20
+ instance_exec(&block)
21
21
  @test_node = previous
22
22
  end
23
23
 
@@ -28,12 +28,12 @@ class Liza::TestTreePart < Liza::Part
28
28
 
29
29
  def self.before &block
30
30
  raise ArgumentError, "No block given" unless block_given?
31
- test_node.add_before &block
31
+ test_node.add_before(&block)
32
32
  end
33
33
 
34
34
  def self.after &block
35
35
  raise ArgumentError, "No block given" unless block_given?
36
- test_node.add_after &block
36
+ test_node.add_after(&block)
37
37
  end
38
38
 
39
39
  end
@@ -41,7 +41,7 @@ class Liza::TestTreePart < Liza::Part
41
41
  extension do
42
42
 
43
43
  def log *args
44
- self.class.solder.log *args
44
+ self.class.solder.log(*args)
45
45
  end
46
46
 
47
47
  def log_test_building?
@@ -50,51 +50,6 @@ class Liza::TestTreePart < Liza::Part
50
50
 
51
51
  attr_reader :tests, :parent, :children, :before_stack, :after_stack
52
52
 
53
- def initialize parent, before_stack, after_stack
54
- @parent = parent || self
55
-
56
- @children, @tests = [], []
57
- @before_top, @after_top = [], []
58
-
59
- @before_stack = before_stack.push @before_top
60
- @after_stack = after_stack.unshift @after_top
61
-
62
- @parent.children << self if @parent != self
63
- end
64
-
65
- def initialize parent, before_stack, after_stack
66
- @parent = parent || self
67
-
68
- @children, @tests, @before_top, @after_top = [], [], [], []
69
-
70
- @before_stack = before_stack.push @before_top
71
- @after_stack = after_stack.unshift @after_top
72
-
73
- @parent.children << self if @parent != self
74
- end
75
-
76
- def initialize parent, before_stack, after_stack
77
- @parent = parent || self
78
- @children, @tests = [], []
79
- @parent.children << self if @parent != self
80
-
81
- @before_top, @after_top = [], []
82
- @before_stack = before_stack.push @before_top
83
- @after_stack = after_stack.unshift @after_top
84
- end
85
-
86
- def initialize parent, before_stack, after_stack
87
- @tests = []
88
-
89
- @parent = parent || self
90
- @children = []
91
- @parent.children << self if @parent != self
92
-
93
- @before_top, @after_top = [], []
94
- @before_stack = before_stack.push @before_top
95
- @after_stack = after_stack.unshift @after_top
96
- end
97
-
98
53
  def initialize parent, before_stack, after_stack
99
54
  @tests = []
100
55
  initialize_parenting parent