Class: DevSystem::BaseGenerator

Inherits:
Generator show all
Defined in:
lib/dev_system/sub/generator/generators/base_generator.rb

Direct Known Subclasses

SimpleGenerator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Liza::Controller

color, inherited, on_connected

Methods inherited from Liza::Unit

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

Instance Attribute Details

#envObject (readonly)

Returns the value of attribute env.



14
15
16
# File 'lib/dev_system/sub/generator/generators/base_generator.rb', line 14

def env
  @env
end

Class Method Details

.call(env) ⇒ Object



5
6
7
8
9
10
# File 'lib/dev_system/sub/generator/generators/base_generator.rb', line 5

def self.call(env)
  log :lower, "env.count is #{env.count}"
  
  generator = env[:generator] = new
  generator.call env
end

.get_generator_signaturesObject



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/dev_system/sub/generator/generators/base_generator.rb', line 48

def self.get_generator_signatures
  signatures = []
  ancestors_until(BaseGenerator).each do |c|
    signatures +=
      c.instance_methods_defined.select do |name|
        name.start_with? "call_"
      end.map do |name|
        OpenStruct.new({
          name: ( name.to_s.sub("call_", "").sub("default", "") ),
          description: "# no description",
        })
      end
  end
  signatures
end

Instance Method Details

#argsObject



38
39
40
# File 'lib/dev_system/sub/generator/generators/base_generator.rb', line 38

def args
  env[:args]
end

#call(env) ⇒ Object

Raises:

  • (NoMethodError)


16
17
18
19
20
21
22
23
24
25
26
# File 'lib/dev_system/sub/generator/generators/base_generator.rb', line 16

def call(env)
  log :lower, "env.count is #{env.count}"
  @env = env
  
  method_name = "call_#{env[:generator_coil] || :default}"
  return public_send method_name if respond_to? method_name

  log "method not found: #{method_name.inspect}"

  raise NoMethodError, "method not found: #{method_name.inspect}", caller 
end

#commandObject



42
43
44
# File 'lib/dev_system/sub/generator/generators/base_generator.rb', line 42

def command
  env[:command]
end

#informObject



28
29
30
# File 'lib/dev_system/sub/generator/generators/base_generator.rb', line 28

def inform
  log "not implemented"
end

#saveObject



32
33
34
# File 'lib/dev_system/sub/generator/generators/base_generator.rb', line 32

def save
  log "not implemented"
end