carioca 2.0.2 → 2.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +54 -0
- data/Gemfile +3 -4
- data/Gemfile.lock +37 -3
- data/README.md +27 -18
- data/Rakefile +40 -2
- data/VERSION +1 -0
- data/bin/console +3 -3
- data/carioca.gemspec +29 -29
- data/config/locales/en.yml +4 -0
- data/config/locales/fr.yml +5 -1
- data/lib/carioca/configuration.rb +68 -59
- data/lib/carioca/constants.rb +52 -45
- data/lib/carioca/container.rb +8 -10
- data/lib/carioca/dependencies.rb +3 -1
- data/lib/carioca/helpers.rb +39 -41
- data/lib/carioca/mixin.rb +10 -12
- data/lib/carioca/rake/manage.rb +5 -2
- data/lib/carioca/rake/tasks/config.tasks +46 -0
- data/lib/carioca/rake/tasks/gem.tasks +15 -0
- data/lib/carioca/rake/tasks/registry.tasks +17 -10
- data/lib/carioca/registry.rb +95 -86
- data/lib/carioca/registry_file.rb +54 -57
- data/lib/carioca/services/config.rb +122 -126
- data/lib/carioca/services/debug.rb +51 -0
- data/lib/carioca/services/i18n.rb +15 -16
- data/lib/carioca/services/init.rb +3 -2
- data/lib/carioca/services/output.rb +181 -169
- data/lib/carioca/validator.rb +44 -45
- data/lib/carioca/version.rb +10 -0
- data/lib/carioca.rb +2 -5
- data/samples/Rakefile +2 -0
- data/samples/test.rb +75 -68
- metadata +99 -22
@@ -1,175 +1,187 @@
|
|
1
|
+
# frozen_string_literal: false
|
2
|
+
|
1
3
|
module Carioca
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
4
|
+
module Services
|
5
|
+
module Output
|
6
|
+
module FormatsMapping
|
7
|
+
COLORS = {
|
8
|
+
unknown: :red,
|
9
|
+
fatal: :red,
|
10
|
+
error: :red,
|
11
|
+
ko: :yellow,
|
12
|
+
warn: :yellow,
|
13
|
+
item: :white,
|
14
|
+
arrow: :white,
|
15
|
+
sending: :white,
|
16
|
+
calling: :white,
|
17
|
+
scheduling: :white,
|
18
|
+
trigger: :white,
|
19
|
+
receive: :white,
|
20
|
+
info: :cyan,
|
21
|
+
ok: :green,
|
22
|
+
success: :green,
|
23
|
+
debug: :magenta,
|
24
|
+
flat: :white
|
25
|
+
}.freeze
|
26
|
+
|
27
|
+
EMOJI = {
|
28
|
+
unknown: { value: "\u{1F4A5}", alt: '[!!]', text: '(UNKNOWN)' },
|
29
|
+
fatal: { value: "\u{26D4}", alt: '[!!]', text: '(FATAL)' },
|
30
|
+
error: { value: "\u{1F6AB}", alt: '[!]', text: '(ERROR)' },
|
31
|
+
ko: { value: "\u{1F44E}", alt: '[-]', text: '(KO)' },
|
32
|
+
warn: { value: "\u{26A0}", alt: '[/!\]', text: '(WARNING)' },
|
33
|
+
info: { value: "\u{2139}", alt: '[i]', text: '(INFO)' },
|
34
|
+
item: { value: " \u{1F539}", alt: '', text: ' *' },
|
35
|
+
arrow: { value: " \u{27A1}", alt: '', text: ' =>' },
|
36
|
+
calling: { value: "\u{1F4DE}", alt: '[C]', text: '(CALLING)' },
|
37
|
+
scheduling: { value: "\u{23F2}", alt: '[S]', text: '{SCHEDULING})' },
|
38
|
+
trigger: { value: "\u{23F0}", alt: '[T]', text: '(TRIGGER)' },
|
39
|
+
sending: { value: "\u{1F4E4}", alt: '[>]', text: '(SENDING)' },
|
40
|
+
receive: { value: "\u{1F4E5}", alt: '[<]', text: '(RECEIVE)' },
|
41
|
+
ok: { value: "\u{1F44D}", alt: '[+]', text: '(OK)' },
|
42
|
+
success: { value: "\u{1F4AA}", alt: '[+]', text: '(SUCCESS)' },
|
43
|
+
debug: { value: "\u{1F41B}", alt: '[D]', text: '(DEBUG)' },
|
44
|
+
flat: { value: '', alt: '' }
|
45
|
+
}.freeze
|
46
|
+
LEVELS = %i[debug info warn error fatal unknown].freeze
|
47
|
+
ALIAS = {
|
48
|
+
flat: :info,
|
49
|
+
item: :info,
|
50
|
+
ok: :info,
|
51
|
+
ko: :error,
|
52
|
+
trigger: :info,
|
53
|
+
scheduling: :info,
|
54
|
+
arrow: :info,
|
55
|
+
sending: :info,
|
56
|
+
calling: :info,
|
57
|
+
receive: :info,
|
58
|
+
success: :info
|
59
|
+
|
60
|
+
}.freeze
|
61
|
+
end
|
62
|
+
|
63
|
+
class Provider
|
64
|
+
include FormatsMapping
|
65
|
+
|
66
|
+
attr_accessor :mode, :emoji, :color
|
67
|
+
|
68
|
+
@@alias = ALIAS.dup
|
69
|
+
@@colors = COLORS.dup
|
70
|
+
@@emoji = EMOJI.dup
|
71
|
+
|
72
|
+
MODE = %i[mono dual].freeze
|
73
|
+
|
74
|
+
LEVELS.each do |method|
|
75
|
+
define_method(method) do |message, session = '', source = 'Carioca->Output'|
|
76
|
+
display(level: method, message: message, session: session, source: source)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
@@alias.each_key do |method|
|
80
|
+
define_method(method) do |message, session = '', source = 'Carioca->Output'|
|
81
|
+
display(level: method, message: message, session: session, source: source)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
def map_color(color:, analias:)
|
86
|
+
raise 'Color must be a Symbol' unless color.instance_of?(Symbol)
|
87
|
+
raise "Missing alias : #{analias}" unless LEVELS.include? analias
|
88
|
+
|
89
|
+
@@alias[analias] = color
|
90
|
+
end
|
91
|
+
|
92
|
+
def map_emoji(emoji:, analias:)
|
93
|
+
raise 'Emoji must be a String' unless color.instance_of?(String)
|
94
|
+
raise "Missing alias : #{analias}" unless LEVELS.include? analias
|
95
|
+
|
96
|
+
@@alias[analias] = emoji
|
97
|
+
end
|
98
|
+
|
99
|
+
def add_alias(newalias:, level:)
|
100
|
+
raise 'Alias must be a Symbol' unless newalias.instance_of?(Symbol)
|
101
|
+
raise "Bad Level : #{level}" unless LEVELS.include? level
|
102
|
+
|
103
|
+
self.class.define_method(newalias) do |message, session = ''|
|
104
|
+
display({ level: newalias, message: message, session: session })
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
# constructor
|
109
|
+
def initialize(level: :debug, mode: :mono, emoji: true, colors: true)
|
110
|
+
registry = Carioca::Registry.get
|
111
|
+
@logger = registry.get_service name: :logger
|
112
|
+
@i18n = registry.get_service name: :i18n
|
113
|
+
@debug = Carioca::Registry.config.debug?
|
114
|
+
self.level = level
|
115
|
+
@mode = mode
|
116
|
+
@emoji = check_unicode_term ? emoji : false
|
117
|
+
@color = colors
|
118
|
+
set = []
|
119
|
+
set.push mode
|
120
|
+
set.push :emoji if @emoji
|
121
|
+
set.push :colors if @color
|
122
|
+
@logger.debug('Carioca->Output') { @i18n.t('output.load.context', confset: set.to_s) } if @debug
|
123
|
+
raise "Unknown output mode : #{@mode}" unless MODE.include? @mode
|
124
|
+
end
|
125
|
+
|
126
|
+
# build a session number
|
127
|
+
# @return [String] Session number
|
128
|
+
def generate_session
|
129
|
+
"#{Time.now.to_i}#{rand(999)}"
|
130
|
+
end
|
131
|
+
|
132
|
+
# getter for the current level
|
133
|
+
# @return [Symbol] level
|
134
|
+
def level
|
135
|
+
@active_levels.first
|
136
|
+
end
|
137
|
+
|
138
|
+
# virtual setter for level, set the current level
|
139
|
+
# @raise a badLevel in case of bad level
|
140
|
+
# @param [Symbol] level
|
141
|
+
def level=(level)
|
142
|
+
raise "Bad Level : #{level}" unless LEVELS.include? level
|
143
|
+
|
144
|
+
@active_levels = LEVELS.dup
|
145
|
+
@active_levels.shift(LEVELS.index(level))
|
146
|
+
end
|
147
|
+
|
148
|
+
# check if unicode must be used with term ENV
|
149
|
+
# @return [Boolean]
|
150
|
+
def check_unicode_term
|
151
|
+
return false unless ENV.include? 'TERM'
|
152
|
+
|
153
|
+
ENV.values_at('LC_ALL', 'LC_CTYPE',
|
154
|
+
'LANG').compact.first.include?('UTF-8') && ENV.values_at('TERM').first.include?('xterm')
|
155
|
+
end
|
156
|
+
|
157
|
+
# abstract method for log wrapper
|
158
|
+
# @param [Hash] params
|
159
|
+
# @option params [Symbol] :level, a valid level in LEVELS or ALIAS
|
160
|
+
# @option params [String] :message text
|
161
|
+
# @option params [String] :session an id/timestamp of session
|
162
|
+
def display(level:, message:, session:, source:)
|
163
|
+
message << "(#{session})" if session
|
164
|
+
save = message.dup
|
165
|
+
target_level = @@alias.keys.include?(level) ? @@alias[level] : level
|
166
|
+
if @active_levels.include? target_level
|
167
|
+
if @color
|
168
|
+
pastel = ::Pastel.new
|
169
|
+
message = pastel.send @@colors[level], message
|
60
170
|
end
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
@@alias = ALIAS.dup
|
67
|
-
@@colors = COLORS.dup
|
68
|
-
@@emoji = EMOJI.dup
|
69
|
-
|
70
|
-
MODE = [:mono, :dual]
|
71
|
-
|
72
|
-
LEVELS.each do |method|
|
73
|
-
define_method(method) do |message, session = ''|
|
74
|
-
self.display(level: method, message: message, session: session)
|
75
|
-
end
|
76
|
-
end
|
77
|
-
@@alias.keys.each do |method|
|
78
|
-
define_method(method) do |message, session = ''|
|
79
|
-
self.display( level: method, message: message, session: session)
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
def map_color(color: , analias: )
|
84
|
-
raise "Color must be a Symbol" unless color.class == Symbol
|
85
|
-
raise "Missing alias : #{analias}" unless LEVELS.include? analias
|
86
|
-
@@alias[analias] = color
|
87
|
-
end
|
88
|
-
|
89
|
-
def map_emoji(emoji: , analias: )
|
90
|
-
raise "Emoji must be a String" unless color.class == String
|
91
|
-
raise "Missing alias : #{analias}" unless LEVELS.include? analias
|
92
|
-
@@alias[analias] = emoji
|
93
|
-
end
|
94
|
-
|
95
|
-
|
96
|
-
def add_alias(newalias:, level:)
|
97
|
-
raise "Alias must be a Symbol" unless newalias.class == Symbol
|
98
|
-
raise "Bad Level : #{level}" unless LEVELS.include? level
|
99
|
-
self.class.define_method(newalias) do |message, session = ''|
|
100
|
-
self.display({ level: newalias, message: message, session: session})
|
101
|
-
end
|
102
|
-
end
|
103
|
-
|
104
|
-
|
105
|
-
# constructor
|
106
|
-
def initialize(level: :debug, mode: :mono , emoji: true, colors: true)
|
107
|
-
self.level = level
|
108
|
-
@mode = mode
|
109
|
-
@emoji = emoji
|
110
|
-
@color = colors
|
111
|
-
if @mode == :dual then
|
112
|
-
registry = Carioca::Registry.get
|
113
|
-
@logger = registry.get_service name: :logger
|
114
|
-
end
|
115
|
-
raise "Unknown output mode : #{@mode}" unless MODE.include? @mode
|
116
|
-
end
|
117
|
-
|
118
|
-
# build a session number
|
119
|
-
# @return [String] Session number
|
120
|
-
def get_session
|
121
|
-
return "#{Time.now.to_i.to_s}#{rand(999)}"
|
122
|
-
end
|
123
|
-
|
124
|
-
# getter for the current level
|
125
|
-
# @return [Symbol] level
|
126
|
-
def level
|
127
|
-
return @active_levels.first
|
128
|
-
end
|
129
|
-
|
130
|
-
# virtual setter for level, set the current level
|
131
|
-
# @raise a badLevel in case of bad level
|
132
|
-
# @param [Symbol] level
|
133
|
-
def level=(level)
|
134
|
-
raise "Bad Level : #{level}" unless LEVELS.include? level
|
135
|
-
@active_levels = LEVELS.dup
|
136
|
-
@active_levels.shift(LEVELS.index(level))
|
137
|
-
end
|
138
|
-
|
139
|
-
|
140
|
-
# abstract method for log wrapper
|
141
|
-
# @param [Hash] params
|
142
|
-
# @option params [Symbol] :level, a valid level in LEVELS or ALIAS
|
143
|
-
# @option params [String] :message text
|
144
|
-
def display(level: , message: , session:)
|
145
|
-
save = message.dup
|
146
|
-
target_level = (@@alias.keys.include? level)? @@alias[level] : level
|
147
|
-
if @active_levels.include? target_level then
|
148
|
-
if @color then
|
149
|
-
pastel = ::Pastel.new
|
150
|
-
message = pastel.send @@colors[level], message
|
151
|
-
end
|
152
|
-
if @@emoji.include? level
|
153
|
-
pattern = (@emoji)? @@emoji[level][:value] : @@emoji[level][:alt]
|
154
|
-
pattern = "#{pattern} #{@@emoji[level][:text]}" if @@emoji[level].include? :text and !@emoji
|
155
|
-
message = pattern + " " + message unless pattern.empty?
|
156
|
-
end
|
157
|
-
if @mode == :dual
|
158
|
-
|
159
|
-
pattern = @@emoji[level][:alt]
|
160
|
-
unless LEVELS.include? level
|
161
|
-
save = "#{@@emoji[level][:text]} #{save}" if @@emoji[level].include? :text
|
162
|
-
end
|
163
|
-
@logger.send target_level, save
|
164
|
-
end
|
165
|
-
puts message
|
166
|
-
end
|
167
|
-
end
|
168
|
-
|
171
|
+
if @@emoji.include? level
|
172
|
+
pattern = @emoji ? @@emoji[level][:value] : @@emoji[level][:alt]
|
173
|
+
pattern = "#{pattern} #{@@emoji[level][:text]}" if @@emoji[level].include?(:text) && !@emoji
|
174
|
+
message = "#{pattern} #{message}" unless pattern.empty?
|
169
175
|
end
|
170
|
-
|
171
|
-
|
176
|
+
if @mode == :dual
|
177
|
+
save = "#{@@emoji[level][:text]} #{save}" if !LEVELS.include?(level) && (@@emoji[level].include? :text)
|
178
|
+
block = proc { save }
|
179
|
+
@logger.send target_level, source, &block
|
180
|
+
end
|
181
|
+
puts message
|
182
|
+
end
|
172
183
|
end
|
184
|
+
end
|
173
185
|
end
|
186
|
+
end
|
174
187
|
end
|
175
|
-
|
data/lib/carioca/validator.rb
CHANGED
@@ -1,49 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Carioca
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
private
|
22
|
-
def validate_not_builtins
|
23
|
-
|
24
|
-
raise "Builtins reserved name #{@service.to_s}" if BUILTINS.keys.include? @service
|
25
|
-
end
|
26
|
-
|
27
|
-
def validate_mandatories
|
28
|
-
SERVICES_MANDATORY_SPECS.keys.each do |spec|
|
29
|
-
raise "Key : :#{spec} is mandatory in a service definition" unless @definition.include? spec
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
def validate_full_and_type
|
34
|
-
@definition.each do |spec,value|
|
35
|
-
raise "Key : :#{spec} is not allowed in a service definition" unless SERVICES_FULL_LIST_SPECS.include? spec
|
36
|
-
raise "key : #{spec} must be a : #{SERVICES_FULL_LIST_SPECS[spec].to_s}" unless value.class == SERVICES_FULL_LIST_SPECS[spec]
|
37
|
-
if SERVICES_SPECS_DETAIL.include? spec then
|
38
|
-
raise "key : #{spec} must be in : #{SERVICES_SPECS_DETAIL[spec].to_s}" unless SERVICES_SPECS_DETAIL[spec].include? value
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
def fill_content
|
44
|
-
@definition[:description] = @service.to_s unless @definition.include? :description
|
45
|
-
end
|
4
|
+
module Services
|
5
|
+
class Validator
|
6
|
+
attr_reader :definition
|
7
|
+
|
8
|
+
include Carioca::Constants
|
9
|
+
|
10
|
+
def initialize(definition:, service:)
|
11
|
+
@definition = definition
|
12
|
+
@service = service
|
13
|
+
end
|
14
|
+
|
15
|
+
def validate!
|
16
|
+
validate_mandatories
|
17
|
+
validate_full_and_type
|
18
|
+
validate_not_builtins
|
19
|
+
fill_content
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
46
23
|
|
24
|
+
def validate_not_builtins
|
25
|
+
raise "Builtins reserved name #{@service}" if BUILTINS.keys.include? @service
|
26
|
+
end
|
27
|
+
|
28
|
+
def validate_mandatories
|
29
|
+
SERVICES_MANDATORY_SPECS.each_key do |spec|
|
30
|
+
raise "Key : :#{spec} is mandatory in a service definition" unless @definition.include? spec
|
47
31
|
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def validate_full_and_type
|
35
|
+
@definition.each do |spec, value|
|
36
|
+
raise "Key : :#{spec} is not allowed in a service definition" unless SERVICES_FULL_LIST_SPECS.include? spec
|
37
|
+
raise "key : #{spec} must be a : #{SERVICES_FULL_LIST_SPECS[spec]}" unless value.instance_of?(SERVICES_FULL_LIST_SPECS[spec])
|
38
|
+
|
39
|
+
raise "key : #{spec} must be in : #{SERVICES_SPECS_DETAIL[spec]}" if SERVICES_SPECS_DETAIL.include?(spec) && !(SERVICES_SPECS_DETAIL[spec].include? value)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def fill_content
|
44
|
+
@definition[:description] = @service.to_s unless @definition.include? :description
|
45
|
+
end
|
48
46
|
end
|
49
|
-
end
|
47
|
+
end
|
48
|
+
end
|
data/lib/carioca.rb
CHANGED
data/samples/Rakefile
CHANGED
data/samples/test.rb
CHANGED
@@ -1,98 +1,105 @@
|
|
1
|
+
# frozen_string_literal: false
|
2
|
+
|
1
3
|
require 'rubygems'
|
2
4
|
require 'carioca'
|
3
5
|
|
4
|
-
|
5
6
|
Carioca::Registry.configure do |spec|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
7
|
+
spec.filename = './config/carioca.registry'
|
8
|
+
spec.debug = true
|
9
|
+
spec.init_from_file = true
|
10
|
+
# spec.log_file = '/tmp/test.rge'
|
11
|
+
spec.config_file = './config/settings.yml'
|
12
|
+
spec.config_root = :monappli
|
13
|
+
spec.environment = :development
|
14
|
+
spec.default_locale = :fr
|
15
|
+
spec.log_level = :debug
|
16
|
+
spec.output_mode = :mono
|
17
|
+
spec.output_emoji = true
|
18
|
+
spec.output_colors = true
|
19
|
+
spec.locales_load_path << Dir["#{File.expand_path('./config/locales')}/*.yml"]
|
20
|
+
spec.debugger_tracer = :output
|
18
21
|
end
|
19
22
|
|
20
|
-
|
21
23
|
class MyService
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
24
|
+
extend Carioca::Injector
|
25
|
+
inject service: :logger
|
26
|
+
|
27
|
+
def initialize
|
28
|
+
logger.warn(self.class.to_s) { 'Init service' }
|
29
|
+
end
|
30
|
+
|
31
|
+
def hello
|
32
|
+
logger.info(self.class.to_s) { 'Hello World' }
|
33
|
+
end
|
34
|
+
|
35
|
+
def method_test(_titi, tutu:)
|
36
|
+
@tutu = tutu
|
37
|
+
yield if block_given?
|
38
|
+
"result #{@tutu}"
|
39
|
+
end
|
32
40
|
end
|
33
41
|
|
34
|
-
|
35
42
|
spec = {
|
36
|
-
|
37
|
-
|
43
|
+
service: 'MyService::new',
|
44
|
+
type: :internal
|
38
45
|
}
|
39
46
|
|
40
47
|
Carioca::Registry.init.add service: :myservice, definition: spec
|
41
48
|
|
42
49
|
logger = Carioca::Registry.get.get_service name: :logger
|
43
50
|
|
44
|
-
logger.info(
|
51
|
+
logger.info(to_s) { "avaible services : #{Carioca::Registry.get.services.keys} " }
|
45
52
|
i18n = Carioca::Registry.get.get_service name: :i18n
|
46
53
|
i18n.locale = :es
|
47
54
|
p i18n.t(:test)
|
48
55
|
|
49
56
|
config = Carioca::Registry.get.get_service name: :configuration
|
50
|
-
config.settings.newkey =
|
57
|
+
config.settings.newkey = 'value'
|
51
58
|
|
52
|
-
logger.info(
|
59
|
+
logger.info(to_s) { config.settings }
|
53
60
|
|
54
61
|
class MonAppli < Carioca::Container
|
55
|
-
|
56
|
-
|
57
|
-
|
62
|
+
def test
|
63
|
+
myservice.hello
|
64
|
+
logger.warn(self.class.to_s) { uuid.generate }
|
65
|
+
end
|
66
|
+
|
67
|
+
inject service: :uuid
|
68
|
+
inject service: :myservice
|
69
|
+
logger.info(to_s) { uuid.generate }
|
70
|
+
|
71
|
+
inject service: :output
|
72
|
+
inject service: :debugger
|
73
|
+
|
74
|
+
def test2
|
75
|
+
cycle = %i[unknown fatal error ko warn info item arrow scheduling trigger sending calling receive
|
76
|
+
ok success debug flat]
|
77
|
+
cycle.each do |verb|
|
78
|
+
output.send verb, verb.to_s
|
58
79
|
end
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
def test2
|
67
|
-
cycle = [:unknown,:fatal,:error,:ko,:warn,:info,:item,:arrow,:scheduling,:trigger,:sending, :calling,:receive,:ok,:success,:debug,:flat]
|
68
|
-
cycle.each do |verb|
|
69
|
-
output.send verb, verb.to_s
|
70
|
-
end
|
71
|
-
output.color = false
|
72
|
-
cycle.each do |verb|
|
73
|
-
output.send verb, verb.to_s
|
74
|
-
end
|
75
|
-
output.emoji = false
|
76
|
-
cycle.each do |verb|
|
77
|
-
output.send verb, verb.to_s
|
78
|
-
end
|
79
|
-
output.color = true
|
80
|
-
cycle.each do |verb|
|
81
|
-
output.send verb, verb.to_s
|
82
|
-
end
|
83
|
-
|
80
|
+
output.color = false
|
81
|
+
cycle.each do |verb|
|
82
|
+
output.send verb, verb.to_s
|
83
|
+
end
|
84
|
+
output.emoji = false
|
85
|
+
cycle.each do |verb|
|
86
|
+
output.send verb, verb.to_s
|
84
87
|
end
|
88
|
+
output.color = true
|
89
|
+
cycle.each do |verb|
|
90
|
+
output.send verb, verb.to_s
|
91
|
+
end
|
92
|
+
end
|
85
93
|
|
94
|
+
def test3
|
95
|
+
proxy = debugger.get service: :myservice
|
96
|
+
proxy.method_test 'param', tutu: 'keyword' do
|
97
|
+
puts 'titi'
|
98
|
+
end
|
99
|
+
end
|
86
100
|
end
|
87
101
|
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
appli = MonAppli::new
|
102
|
+
appli = MonAppli.new
|
93
103
|
appli.test
|
94
|
-
appli.test2
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
104
|
+
# appli.test2
|
105
|
+
appli.test3
|