carioca 2.0.4 → 2.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +54 -0
- data/Gemfile +3 -4
- data/Gemfile.lock +36 -2
- data/Rakefile +40 -2
- data/VERSION +1 -0
- data/bin/console +3 -3
- data/carioca.gemspec +29 -29
- data/lib/carioca/configuration.rb +60 -57
- data/lib/carioca/constants.rb +52 -53
- data/lib/carioca/container.rb +8 -10
- data/lib/carioca/dependencies.rb +2 -0
- data/lib/carioca/helpers.rb +39 -41
- data/lib/carioca/mixin.rb +10 -12
- data/lib/carioca/rake/manage.rb +5 -5
- data/lib/carioca/registry.rb +95 -86
- data/lib/carioca/registry_file.rb +54 -57
- data/lib/carioca/services/config.rb +122 -127
- data/lib/carioca/services/debug.rb +45 -52
- data/lib/carioca/services/i18n.rb +15 -16
- data/lib/carioca/services/init.rb +3 -2
- data/lib/carioca/services/output.rb +181 -183
- 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 +73 -86
- metadata +96 -22
data/samples/test.rb
CHANGED
@@ -1,118 +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
|
-
|
18
|
-
|
19
|
-
|
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
|
20
21
|
end
|
21
22
|
|
22
|
-
|
23
23
|
class MyService
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
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
|
40
40
|
end
|
41
41
|
|
42
|
-
|
43
42
|
spec = {
|
44
|
-
|
45
|
-
|
43
|
+
service: 'MyService::new',
|
44
|
+
type: :internal
|
46
45
|
}
|
47
46
|
|
48
47
|
Carioca::Registry.init.add service: :myservice, definition: spec
|
49
48
|
|
50
49
|
logger = Carioca::Registry.get.get_service name: :logger
|
51
50
|
|
52
|
-
logger.info(
|
51
|
+
logger.info(to_s) { "avaible services : #{Carioca::Registry.get.services.keys} " }
|
53
52
|
i18n = Carioca::Registry.get.get_service name: :i18n
|
54
53
|
i18n.locale = :es
|
55
54
|
p i18n.t(:test)
|
56
55
|
|
57
56
|
config = Carioca::Registry.get.get_service name: :configuration
|
58
|
-
config.settings.newkey =
|
57
|
+
config.settings.newkey = 'value'
|
59
58
|
|
60
|
-
logger.info(
|
59
|
+
logger.info(to_s) { config.settings }
|
61
60
|
|
62
61
|
class MonAppli < Carioca::Container
|
63
|
-
|
64
|
-
|
65
|
-
|
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
|
66
79
|
end
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
logger.info(self.to_s) { uuid.generate }
|
71
|
-
|
72
|
-
inject service: :output
|
73
|
-
inject service: :debugger
|
74
|
-
|
75
|
-
def test2
|
76
|
-
cycle = [:unknown,:fatal,:error,:ko,:warn,:info,:item,:arrow,:scheduling,:trigger,:sending, :calling,:receive,:ok,:success,:debug,:flat]
|
77
|
-
cycle.each do |verb|
|
78
|
-
output.send verb, verb.to_s
|
79
|
-
end
|
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
|
87
|
-
end
|
88
|
-
output.color = true
|
89
|
-
cycle.each do |verb|
|
90
|
-
output.send verb, verb.to_s
|
91
|
-
end
|
92
|
-
|
80
|
+
output.color = false
|
81
|
+
cycle.each do |verb|
|
82
|
+
output.send verb, verb.to_s
|
93
83
|
end
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
proxy.method_test "param", tutu: "keyword" do
|
98
|
-
puts 'titi'
|
99
|
-
end
|
84
|
+
output.emoji = false
|
85
|
+
cycle.each do |verb|
|
86
|
+
output.send verb, verb.to_s
|
100
87
|
end
|
88
|
+
output.color = true
|
89
|
+
cycle.each do |verb|
|
90
|
+
output.send verb, verb.to_s
|
91
|
+
end
|
92
|
+
end
|
101
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
|
102
100
|
end
|
103
101
|
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
appli = MonAppli::new
|
102
|
+
appli = MonAppli.new
|
109
103
|
appli.test
|
110
|
-
#appli.test2
|
104
|
+
# appli.test2
|
111
105
|
appli.test3
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
metadata
CHANGED
@@ -1,85 +1,99 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: carioca
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Romain GEORGES
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-07-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: deep_merge
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: '1.2'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: '1.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: i18n
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: '1.10'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: '1.10'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: locale
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '1
|
47
|
+
version: '2.1'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '1
|
54
|
+
version: '2.1'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: pastel
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 0.8.0
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: 0.8.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: tty-prompt
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: 0.23.1
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: 0.23.1
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: code_statistics
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.2.13
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.2.13
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: rake
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -108,6 +122,62 @@ dependencies:
|
|
108
122
|
- - "~>"
|
109
123
|
- !ruby/object:Gem::Version
|
110
124
|
version: '3.0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rubocop
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '1.32'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '1.32'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: yard
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: 0.9.27
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: 0.9.27
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: yard-rspec
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0.1'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - "~>"
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0.1'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: version
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - "~>"
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '1.1'
|
174
|
+
type: :runtime
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - "~>"
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '1.1'
|
111
181
|
description: 'Carioca 2: is a complete rewrite who provide a full IoC/DI light Container
|
112
182
|
and a services registry, build with logs, config and Internationalization facilities
|
113
183
|
for designing your applications'
|
@@ -120,10 +190,12 @@ files:
|
|
120
190
|
- ".github/workflows/main.yml"
|
121
191
|
- ".gitignore"
|
122
192
|
- ".rspec"
|
193
|
+
- ".rubocop.yml"
|
123
194
|
- Gemfile
|
124
195
|
- Gemfile.lock
|
125
196
|
- README.md
|
126
197
|
- Rakefile
|
198
|
+
- VERSION
|
127
199
|
- bin/console
|
128
200
|
- bin/setup
|
129
201
|
- carioca.gemspec
|
@@ -148,6 +220,7 @@ files:
|
|
148
220
|
- lib/carioca/services/init.rb
|
149
221
|
- lib/carioca/services/output.rb
|
150
222
|
- lib/carioca/validator.rb
|
223
|
+
- lib/carioca/version.rb
|
151
224
|
- samples/Rakefile
|
152
225
|
- samples/config/carioca.registry
|
153
226
|
- samples/config/locales/en.yml
|
@@ -163,7 +236,8 @@ metadata:
|
|
163
236
|
homepage_uri: https://github.com/Ultragreen/carioca
|
164
237
|
source_code_uri: https://github.com/Ultragreen/carioca
|
165
238
|
changelog_uri: https://github.com/Ultragreen/carioca
|
166
|
-
|
239
|
+
rubygems_mfa_required: 'false'
|
240
|
+
post_install_message:
|
167
241
|
rdoc_options: []
|
168
242
|
require_paths:
|
169
243
|
- lib
|
@@ -171,15 +245,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
171
245
|
requirements:
|
172
246
|
- - ">="
|
173
247
|
- !ruby/object:Gem::Version
|
174
|
-
version: 2.
|
248
|
+
version: 2.6.0
|
175
249
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
176
250
|
requirements:
|
177
251
|
- - ">="
|
178
252
|
- !ruby/object:Gem::Version
|
179
253
|
version: '0'
|
180
254
|
requirements: []
|
181
|
-
rubygems_version: 3.
|
182
|
-
signing_key:
|
255
|
+
rubygems_version: 3.3.5
|
256
|
+
signing_key:
|
183
257
|
specification_version: 4
|
184
258
|
summary: 'Carioca : Container And Registry with Inversion Of Control for your Applications'
|
185
259
|
test_files: []
|