lib/legion/extensions/core.rb in legionio-0.3.0 vs lib/legion/extensions/core.rb in legionio-0.3.1

- old
+ new

@@ -5,10 +5,12 @@ require_relative 'helpers/core' require_relative 'helpers/task' require_relative 'helpers/logger' require_relative 'helpers/lex' require_relative 'helpers/transport' +require_relative 'helpers/data' +require_relative 'helpers/cache' require_relative 'actors/base' require_relative 'actors/every' require_relative 'actors/loop' require_relative 'actors/once' @@ -35,15 +37,37 @@ @queues = {} @exchanges = {} @messages = {} build_settings build_transport + build_data build_helpers build_runners build_actors end + def data_required? + false + end + + def transport_required? + true + end + + def cache_required? + false + end + + def crypt_required? + false + end + + def build_data + auto_generate_data + extension_class::Data.build + end + def build_transport if File.exist? "#{extension_path}/transport/autobuild.rb" require "#{extension_path}/transport/autobuild" extension_class::Transport::AutoBuild.build log.warn 'still using transport::autobuild, please upgrade' @@ -86,9 +110,17 @@ require 'legion/extensions/transport' log.debug 'running meta magic to generate a transport base class' return if Kernel.const_defined? "#{lex_class}::Transport" Kernel.const_get(lex_class.to_s).const_set('Transport', Module.new { extend Legion::Extensions::Transport }) + end + + def auto_generate_data + require 'legion/extensions/data' + log.debug 'running meta magic to generate a data base class' + return if Kernel.const_defined? "#{lex_class}::Data" + + Kernel.const_get(lex_class.to_s).const_set('Data', Module.new { extend Legion::Extensions::Data }) end end end end