Module: Legion::Extensions::Core
Instance Attribute Summary
#actors
#runners
Instance Method Summary
collapse
#actor_files, #build_actor_list, #build_actors, #build_meta_actor, #build_meta_actor_list
#const_defined_two?, #define_constant_two, #define_get, #find_files, #require_files
#build_helpers, #helper_files, #helpers
#build_runner_list, #build_runners, #runner_files
#function_desc, #function_example, #function_options, #function_set, included, #runner_desc
#handle_exception, #log
#find_setting, #settings
#actor_class, #actor_const, #actor_name, #calling_class, #calling_class_array, #from_json, #full_path, #lex_class, #lex_const, #lex_name, #normalize, #runner_class, #runner_const, #runner_name, #to_dotted_hash
#build_default_exchange, #default_exchange, #exchanges, #messages, #queues, #transport_class, #transport_path
Instance Method Details
#auto_generate_data ⇒ Object
121
122
123
124
125
126
127
128
|
# File 'lib/legion/extensions/core.rb', line 121
def auto_generate_data
require 'legion/extensions/data'
log.debug 'running meta magic to generate a data base class'
Kernel.const_get(lex_class.to_s).const_set('Data', Module.new { extend Legion::Extensions::Data })
rescue StandardError => e
log.error e.message
log.error e.backtrace
end
|
#auto_generate_transport ⇒ Object
113
114
115
116
117
118
119
|
# File 'lib/legion/extensions/core.rb', line 113
def auto_generate_transport
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
|
#autobuild ⇒ Object
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/legion/extensions/core.rb', line 31
def autobuild
@actors = {}
@meta_actors = {}
@runners = {}
@helpers = []
@queues = {}
@exchanges = {}
@messages = {}
build_settings
build_transport
build_data if Legion::Settings[:data][:connected] && data_required?
build_helpers
build_runners
build_actors
end
|
#build_data ⇒ Object
68
69
70
71
|
# File 'lib/legion/extensions/core.rb', line 68
def build_data
auto_generate_data
lex_class::Data.build
end
|
#build_settings ⇒ Object
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
# File 'lib/legion/extensions/core.rb', line 87
def build_settings
if Legion::Settings[:extensions].key?(lex_name.to_sym)
Legion::Settings[:default_extension_settings].each do |key, value|
Legion::Settings[:extensions][lex_name.to_sym][key.to_sym] = if Legion::Settings[:extensions][lex_name.to_sym].key?(key.to_sym)
value.merge(Legion::Settings[:extensions][lex_name.to_sym][key.to_sym])
else
value
end
end
else
Legion::Settings[:extensions][lex_name.to_sym] = Legion::Settings[:default_extension_settings]
end
default_settings.each do |key, value|
Legion::Settings[:extensions][lex_name.to_sym][key.to_sym] = if Legion::Settings[:extensions][lex_name.to_sym].key?(key.to_sym)
value.merge(Legion::Settings[:extensions][lex_name.to_sym][key.to_sym])
else
value
end
end
end
|
#build_transport ⇒ Object
73
74
75
76
77
78
79
80
81
82
83
84
85
|
# File 'lib/legion/extensions/core.rb', line 73
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'
elsif File.exist? "#{extension_path}/transport.rb"
require "#{extension_path}/transport"
extension_class::Transport.build
else
auto_generate_transport
extension_class::Transport.build
end
end
|
#cache_required? ⇒ Boolean
56
57
58
|
# File 'lib/legion/extensions/core.rb', line 56
def cache_required?
false
end
|
#crypt_required? ⇒ Boolean
60
61
62
|
# File 'lib/legion/extensions/core.rb', line 60
def crypt_required?
false
end
|
#data_required? ⇒ Boolean
48
49
50
|
# File 'lib/legion/extensions/core.rb', line 48
def data_required?
false
end
|
#default_settings ⇒ Object
109
110
111
|
# File 'lib/legion/extensions/core.rb', line 109
def default_settings
{}
end
|
#transport_required? ⇒ Boolean
52
53
54
|
# File 'lib/legion/extensions/core.rb', line 52
def transport_required?
true
end
|
#vault_required? ⇒ Boolean
64
65
66
|
# File 'lib/legion/extensions/core.rb', line 64
def vault_required?
false
end
|