Class: DevSystem::CommandGenerator

Inherits:
SimpleGenerator show all
Defined in:
lib/dev_system/sub/command/generators/command_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

#call_baseObject

liza g command:base name place=app



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/dev_system/sub/command/generators/command_generator.rb', line 36

def call_base
  @controller_class = Command

  name!
  place!
  @args = Array command.simple_args[1..-1]

  ancestor = BaseCommand
  create_controller @name, @controller_class, @place, @path, ancestor: ancestor do |unit, test|
    unit.section :base_command_section_1,
      caption: "liza #{ @name }"
    
    test.section :controller_test_section_1
  end
end

#call_defaultObject

liza g command name place=app



5
6
7
# File 'lib/dev_system/sub/command/generators/command_generator.rb', line 5

def call_default
  call_simple
end

#call_examplesObject

liza g command:examples



54
55
56
# File 'lib/dev_system/sub/command/generators/command_generator.rb', line 54

def call_examples
  copy_examples Command
end

#call_simpleObject

liza g command:simple name place=app



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/dev_system/sub/command/generators/command_generator.rb', line 11

def call_simple
  @controller_class = Command

  name!
  place!
  @args = Array command.simple_args[1..-1]

  ancestor = SimpleCommand
  create_controller @name, @controller_class, @place, @path, ancestor: ancestor do |unit, test|
    unit.section :controller_section_1,
      caption: "liza #{ @name }",
      method_name: "default"
    
    @args.each.with_index do |arg, i|
      unit.section :controller_section_1,
        caption: "liza #{ @name }:#{ arg }",
        method_name: arg
    end

    test.section :controller_test_section_1
  end
end