Class: Charyf::AppEngine

Inherits:
Extension show all
Defined in:
lib/charyf/utils/app_engine.rb,
lib/charyf/utils/app_engine/extensions.rb

Direct Known Subclasses

Application

Defined Under Namespace

Classes: Extensions

Constant Summary

Constants inherited from Extension

Extension::ABSTRACT

Instance Method Summary collapse

Methods inherited from Extension

abstract?, #config, #configure, extension_name, #extension_name, #extension_namespace, generators, inherited, #initialize, instance, subclasses

Methods included from Initializable

included, #initializers, #run_initializers

Constructor Details

This class inherits a constructor from Charyf::Extension

Instance Method Details

#load_generators(app = self) ⇒ Object

Load Charyf generators and invoke the registered hooks. Check Charyf::Extension.generators for more info.



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/charyf/utils/app_engine.rb', line 11

def load_generators(app = self)
  require_relative 'generators'
  Charyf::Generators.configure!(app.config.generators)

  require_relative 'generators/app/app_generator'
  require_relative 'generators/skill/skill_generator'
  require_relative 'generators/intents/intents_generator'

  run_generators_blocks(app)
  self
end

#start_interfacesObject



23
24
25
# File 'lib/charyf/utils/app_engine.rb', line 23

def start_interfaces
  Charyf.application.interfaces.map(&:start)
end

#start_pipelineObject



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/charyf/utils/app_engine.rb', line 27

def start_pipeline

  begin
    loop do
      request = Charyf::Pipeline.dequeue

      Charyf.application.dispatcher.new.dispatch(request)
    end

  rescue Exception => e
    if e.is_a? Interrupt
      puts "\n\nExiting ...\n"
    elsif e.message =~ /No live threads left./
      raise "No interfaces are available. The server will now exit."
    else
      puts e
      puts e.backtrace
      Charyf.application.config.error_handlers.handle_exception(e)
      raise e
    end
  end

end