Class: Operations::Generators::ScaffoldGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Includes:
Base::Generators::BaseGenerator
Defined in:
lib/operations/generators/scaffold_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.start(args, config) ⇒ Object



28
29
30
31
32
33
34
35
36
# File 'lib/operations/generators/scaffold_generator.rb', line 28

def start(args, config)
  ActionGenerator.start(args, config)     if defined?(Dry::Validation)
  ContractGenerator.start(args, config)   if defined?(Dry::Transaction)
  SchemaGenerator.start(args, config)     if defined?(Dry::Schema)
  ValidationGenerator.start(args, config) if defined?(Dry::Validation)
  RepositoryGenerator.start(args, config) if defined?(Dry::Transaction)
  RegisterGenerator.start(args, config)   if defined?(Dry::Container)
  OperationGenerator.start(args, config)  if defined?(Dry::Transaction)
end

Instance Method Details

#call_generatorsObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/operations/generators/scaffold_generator.rb', line 8

def call_generators
  invoke "operations:action", [name, verb, fields], options if defined?(Dry::Validation)
  unless verb == "destroy" || !defined?(Dry::Transaction)
    invoke "operations:contract",   [name, verb, fields],
           options
  end
  unless verb == "destroy" || !defined?(Dry::Schema)
    invoke "operations:schema",     [name, verb, fields],
           options
  end
  unless verb == "destroy" || !defined?(Dry::Validation)
    invoke "operations:validation", [name, verb, fields],
           options
  end
  invoke "operations:repository", [name, verb, fields], options if defined?(Dry::Transaction)
  invoke "operations:register",   [name, verb, fields], options if defined?(Dry::Container)
  invoke "operations:operation",  [name, verb, fields], options if defined?(Dry::Transaction)
end