Class: DevSystem::LogGenerator

Inherits:
SimpleGenerator show all
Defined in:
lib/dev_system/sub/log/generators/log_generator.rb

Instance Attribute Summary

Attributes inherited from BaseGenerator

#env

Instance Method Summary collapse

Methods inherited from SimpleGenerator

#add_change, #changes, #copy_examples, #copy_file, #copy_files, #create_controller, #create_file, #create_unit, #inform, #last_change, #name!, #place!, #puts_line, #save

Methods inherited from BaseGenerator

#args, #call, call, #command, get_generator_signatures, #inform, #save

Methods inherited from Generator

get_generator_signatures

Methods inherited from Liza::Controller

color, inherited, on_connected

Methods inherited from Liza::Unit

const_missing, division, part, system, #system, test_class

Instance Method Details

#append_handler_to_log_panelObject



18
19
20
21
22
23
24
25
26
# File 'lib/dev_system/sub/log/generators/log_generator.rb', line 18

def append_handler_to_log_panel
  file = TextFileShell.new App.path.join("dev_box.rb")
  
  lines = LineShell.extract_wall_of file.old_lines, "    handler :"
  lines << "    handler :#{@name}\n"
  file.new_lines = LineShell.replace_wall_of file.old_lines, "    handler :", lines

  add_change file
end

#call_defaultObject

liza g log name place=app



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/dev_system/sub/log/generators/log_generator.rb', line 5

def call_default
  @controller_class = Log

  name!
  place!
  append_handler_to_log_panel

  create_controller @name, @controller_class, @place, @path do |unit, test|
    unit.section :controller_section_1
    test.section :controller_test_section_1
  end
end

#call_examplesObject

liza g log:examples



30
31
32
33
34
35
36
# File 'lib/dev_system/sub/log/generators/log_generator.rb', line 30

def call_examples
  # TODO: append once per example
  @name = "logger"
  append_handler_to_log_panel
  #
  copy_examples Log
end