carioca 2.0.12 → 2.1.1

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.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/.debride_withelist +49 -0
  3. data/.github/workflows/main.yml +7 -1
  4. data/Gemfile +1 -0
  5. data/Gemfile.lock +44 -4
  6. data/LICENSE.txt +21 -0
  7. data/README.md +651 -16
  8. data/Rakefile +15 -0
  9. data/VERSION +1 -1
  10. data/assets/images/carioca_output_emoji_colors.PNG +0 -0
  11. data/assets/images/carioca_output_emoji_no_colors.PNG +0 -0
  12. data/assets/images/carioca_output_no_emoji_colors.PNG +0 -0
  13. data/assets/images/carioca_output_no_emoji_no_colors.PNG +0 -0
  14. data/assets/images/description_carioca.png +0 -0
  15. data/assets/images/description_configuration_carioca.png +0 -0
  16. data/assets/images/description_container_carioca.png +0 -0
  17. data/assets/images/description_registry_carioca.png +0 -0
  18. data/assets/images/description_services_carioca.png +0 -0
  19. data/assets/images/logo_carioca_full_large.png +0 -0
  20. data/assets/images/logo_carioca_full_small.png +0 -0
  21. data/assets/images/logo_carioca_light_small.png +0 -0
  22. data/bom.xml +746 -0
  23. data/carioca.gemspec +3 -0
  24. data/config/locales/en.yml +34 -0
  25. data/config/locales/fr.yml +35 -1
  26. data/lib/carioca/configuration.rb +6 -2
  27. data/lib/carioca/constants.rb +38 -1
  28. data/lib/carioca/dependencies.rb +13 -0
  29. data/lib/carioca/services/config.rb +1 -1
  30. data/lib/carioca/services/finisher.rb +121 -0
  31. data/lib/carioca/services/sanitycheck.rb +143 -0
  32. data/lib/carioca/services/securestore.rb +81 -0
  33. data/lib/carioca/services/setup.rb +87 -0
  34. data/lib/carioca/services/toolbox.rb +104 -0
  35. data/samples/config/carioca.registry +0 -15
  36. data/samples/config/locales/en.yml +2 -1
  37. data/samples/config/settings.yml +29 -6
  38. data/samples/test.rb +111 -11
  39. metadata +64 -2
data/README.md CHANGED
@@ -22,8 +22,8 @@ Carioca 2: is a complete rewrite who provide a full IoC/DI light Container and a
22
22
  <noscript><a href="https://liberapay.com/ruydiaz/donate"><img alt="Donate using Liberapay" src="https://liberapay.com/assets/widgets/donate.svg"></a></noscript>
23
23
 
24
24
 
25
- ![Sc4ry logo](assets/images/logo_carioca.png)
26
- _Container And Registry with Inversion Of Control for your Applications__
25
+ ![Carioca logo](assets/images/logo_carioca_full_small.png)
26
+ _Container And Registry with Inversion Of Control for your Applications_
27
27
 
28
28
 
29
29
  ## Installation
@@ -32,11 +32,28 @@ Install it yourself as:
32
32
 
33
33
  $ gem install carioca
34
34
 
35
+ ## Principe
36
+
37
+ ![Carioca synoptic](assets/images/description_carioca.png)
38
+
35
39
  ## Usage
36
40
 
37
41
 
38
42
  ### Basic usage
39
43
 
44
+
45
+
46
+ #### Principe
47
+
48
+ ![Carioca synoptic](assets/images/description_container_carioca.png)
49
+
50
+ * Carioca come with a Container Class Template
51
+ * the Container automatically inject :logger, :i18n and a :configuration service (explain in detail after)
52
+ * the Container provide a class method macro :inject
53
+ * this macro give a way to use other services defined in the registry file (service could be register inline, presented after)
54
+
55
+ ### Beginning usecase new gem
56
+
40
57
  Create you own gem :
41
58
 
42
59
  $ bundle gem yourgem
@@ -53,7 +70,7 @@ and after :
53
70
  $ bundle add carioca
54
71
  $ mkdir -p config/locales
55
72
 
56
- Edit the Rakefil, and add the following line :
73
+ Edit the Rakefile, and add the following line :
57
74
 
58
75
  ```ruby
59
76
  require "carioca/rake/manage"
@@ -156,7 +173,7 @@ yourgem_cmd = Yourgem::YourgemCMD::new
156
173
  yourgem_cmd.test
157
174
  ```
158
175
 
159
- After this, don't forget to stage new files, and you could build & install the gem before running your new command for the first time :
176
+ **Note** : After this, don't forget to stage new files, and you could build & install the gem before running your new command for the first time :
160
177
 
161
178
  $ git add config/ exe/
162
179
  $ rake install && yourgem_cmd
@@ -178,19 +195,637 @@ After this, don't forget to stage new files, and you could build & install the g
178
195
  D, [2022-03-07T01:06:20.338381 #21513] DEBUG -- Carioca: Starting service uuid
179
196
  W, [2022-03-07T01:06:20.353142 #21513] WARN -- Sample::YourGemCMD: Give me an UUID : 574cc860-7fd8-013a-2323-1e00870a7189
180
197
 
181
- You could see, somme interesting things :
182
- * Carioca have an internationalisation service (this service will be explain in detail after):
183
- * default configured on :en locale
184
- * must be in French (:fr) or English (:en), other traductions are welcome
185
- * Carioca have a builtin logger service using regular Logger from Stdlib (also explain in detail in this document)
186
- * default logging on STDOUT, but could be redirect in the configure bloc
187
- * Carioca give us some usefull traces in debug
188
- * Carioca come with a Container Class Template
189
- * the Container automatically inject :logger, :i18n and a :configuration service (explain in detail after)
190
- * the Container provide a class method macro :inject
191
- * this macro give a way to use other services defined in the registry file (service could be register inline, presented after)
198
+
199
+
200
+ ## Builtins services
201
+
202
+ ### Description Registry
203
+
204
+
205
+ ![Carioca synoptic](assets/images/description_registry_carioca.png)
206
+
207
+ ### Description of services
208
+
209
+ ![Carioca synoptic](assets/images/description_services_carioca.png)
210
+
211
+ ### Generic Usage
212
+
213
+ #### Usage with the Carioca::Container template class
214
+
215
+ Considering an existing service named : my_service with a unique method named a_method
216
+
217
+ ```ruby
218
+
219
+ # frozen_string_literal: true
220
+
221
+ require 'carioca'
222
+
223
+ class MyObject < Carioca::Container
224
+
225
+ inject service: my_service
226
+
227
+ def initialize
228
+ my_service.a_method
229
+ end
230
+
231
+
232
+
233
+ my_service.a_method
234
+
235
+ end
236
+
237
+ end
238
+
239
+ ```
240
+ The macro inject is already mixed in Carioca::Container
241
+
242
+ **Note** : Service cloud be used on class method wrapping and instance mecthode.
243
+
244
+ #### Usage without Carioca::Container heritage
245
+
246
+ Considering an existing service named : my_service with a unique method named a_method
247
+
248
+ ```ruby
249
+
250
+ require 'carioca'
251
+
252
+ class MyObject
253
+
254
+ extend Carioca::Injector
255
+ inject service: my_service
256
+
257
+ def initialize
258
+ my_service.a_method
259
+ end
260
+
261
+ my_service.a_method
262
+
263
+ end
264
+
265
+ end
266
+
267
+ ```
268
+
269
+ ### Service I18n
270
+
271
+ the I18n is loaded by default with Carioca::Container, and loaded as dependency when using others builtin services.
272
+ It's a fondation service for Carioca.
273
+
274
+ For this exemple, we show you an explicit inject of I18n
275
+
276
+ **Note** : I18n povide internationalisation for Carioca itself AND for self made services and more
277
+
278
+ **Note** : You could create all your locales files for any languages speciif to your application :
279
+ - in $PWD/config/locales/*.yml
280
+ - in $GEMPATH/config/locales/*.yml
281
+
282
+ **Note** : If you create locales in other languages than :en or :fr (atcually the 2 supported by Carioca), for internals output (Carioca itself logs, outputs or debugs), carioca fallback on default locales defined in configuration (default :en).
283
+
284
+
285
+ Considering a locale file en.yml in config/locales/ like :
286
+
287
+ ```yaml
288
+
289
+ en:
290
+ sample:
291
+ string: "Display %{myvar}"
292
+
293
+
294
+ ```
295
+
296
+ with the current code :
297
+
298
+ ```ruby
299
+
300
+ require 'carioca'
301
+
302
+ class MyObject
303
+
304
+ extend Carioca::Injector
305
+ inject service: I18n
306
+
307
+ def initialize
308
+ puts i18n.t('sample.string', myvar: 'test')
309
+ end
310
+
311
+ end
312
+
313
+ end
314
+
315
+ ```
316
+
317
+ output :
318
+
319
+ Display test
320
+
321
+ ### Service Logger
322
+
323
+ **Note** : Logger depends on service I18n
324
+ #### Logging simply
325
+
326
+ ```ruby
327
+
328
+ require 'carioca'
329
+
330
+ class MyObject
331
+
332
+ extend Carioca::Injector
333
+ inject service: logger
334
+
335
+ def initialize
336
+ logger.info(self.to_s) { "my log" }
337
+ end
338
+
339
+ end
340
+
341
+ end
342
+
343
+ ```
344
+
345
+
346
+ #### Changing log strategy
347
+
348
+
349
+ ```ruby
350
+ require 'rubygems'
351
+ require 'carioca'
352
+
353
+ Carioca::Registry.configure do |spec|
354
+ spec.debug = false
355
+ spec.log_file = '/tmp/test_carioca.log' # a different log path (default STDOUT)
356
+ spec.log_level = :debug # log level base (default :info)
357
+ spec.log_target = '::Logger::new(STDOUT)' # to change completly the log object
358
+ end
359
+ ```
360
+
361
+
362
+ for more information on ruby Stdlib Logger, see :
363
+ https://ruby-doc.org/3.2.2/stdlibs/logger/Logger.html
364
+
365
+
366
+ **Note** : you could totally subsitute Logger with your own logger, by the configuration, or the logger of an other service.
367
+ BUT it's necessary to be compatible with standard Logger facilities :
368
+
369
+ ```ruby
370
+ logger.debug('Maximal debugging info')
371
+ logger.info('Non-error information')
372
+ logger.warn('Non-error warning')
373
+ logger.error('Non-fatal error')
374
+ logger.fatal('Fatal error')
375
+ logger.unknown('Most severe')
376
+ ```
377
+
378
+ **Note** : the output service, detailled after could work in dual mode STDXXX + logger service.
379
+
380
+ ### Service Configuration
381
+
382
+
383
+ #### Configuration
384
+
385
+ Configuration made with Registry.configure :
386
+
387
+ ```ruby
388
+ Carioca::Registry.configure do |spec|
389
+ spec.config_file = './config/settings.yml'
390
+ spec.config_root = :myappli
391
+ spec.environment = :development
392
+ end
393
+ ```
394
+
395
+ * config_file : path to the configuraion file (YAML format)
396
+ * config_root : Root of the YAML structure
397
+ * environment : current evt used for override default values
398
+
399
+ #### Configuration file format
400
+
401
+ **Note** :This file is corresponding with the presented configuration
402
+
403
+ ```yaml
404
+ ---
405
+ :myappli:
406
+ :production: {}
407
+ :staging:
408
+ :onstaging: staging
409
+ :test: {}
410
+ :development:
411
+ :ondev: test
412
+ :treeA:
413
+ :trunk1:
414
+ :branch1: leaf1
415
+ :trunk2:
416
+ :branch3: leaf3
417
+ :branch4: leaf4
418
+ :branch5: [ "val1","val2","val3" ]
419
+ :default:
420
+ :default_value: 'value'
421
+ :treeA:
422
+ :trunk1:
423
+ :branch2: leaf2
424
+ :trunk2:
425
+ :branch5: ["value"]
426
+ ```
427
+
428
+ #### Access to Configuration
429
+
430
+ ```ruby
431
+ config = Carioca::Registry.get.get_service name: :configuration
432
+ pp config.settings
433
+ ```
434
+
435
+ **Note** : You could access it as usuallly, with inject, from Carioca::Container fork or mixin of Carioca::Injector in your own class.
436
+
437
+ output :
438
+
439
+ ```
440
+ {:default_value=>"value",
441
+ :treeA=>
442
+ {:trunk1=>{:branch2=>"leaf2", :branch1=>"leaf1"},
443
+ :trunk2=>
444
+ {:branch5=>["value", "val1", "val2", "val3"],
445
+ :branch3=>"leaf3",
446
+ :branch4=>"leaf4"}},
447
+ :ondev=>"test"}
448
+ ```
449
+
450
+ **Note** : you could see the result configuration is a merge of :development path ovec :default
451
+
452
+
453
+ #### R/W on runtime
454
+
455
+ **Note** : you could override value in runtime
456
+
457
+ ```ruby
458
+ config = Carioca::Registry.get.get_service name: :configuration
459
+ config.settings.newkey = 'value'
460
+ ```
461
+
462
+
463
+
464
+ #### Princpe
465
+
466
+ ![Carioca synoptic](assets/images/description_configuration_carioca.png)
467
+
468
+
469
+ ### Service Output
470
+
471
+
472
+ #### Configuration
473
+
474
+ Configuration made with Registry.configure :
475
+
476
+ ```ruby
477
+ Carioca::Registry.configure do |spec|
478
+ spec.debug = false
479
+ spec.log_file = '/tmp/test.rge'
480
+ spec.log_level = :debug
481
+ spec.output_mode = :dual
482
+ spec.output_emoji = true
483
+ spec.output_colors = true
484
+ spec.output_target = STDOUT
485
+
486
+ end
487
+ ```
488
+
489
+ * output_mode : choose if you want to display to output_target OR/AND Logs, mode are : :mono, dual, log
490
+ * output_emoji : display levels or alias as UTF8 EMOJI
491
+ * output_colors : display output in colors
492
+ * output_target : change output STDOUT or SDTERR
493
+
494
+ **Note** : all of this have R/W accessors on output service
495
+
496
+ #### Usage
497
+
498
+
499
+ This example show a test script for displaying all type of output
500
+
501
+ ```ruby
502
+ output = Carioca::Registry.get.get_service name: :output
503
+
504
+ cycle = %i[unknown fatal error ko warn info item arrow scheduling trigger sending calling receive
505
+ ok success debug flat]
506
+ cycle.each do |verb|
507
+ output.send verb, verb.to_s
508
+ end
509
+ output.color = false
510
+ cycle.each do |verb|
511
+ output.send verb, verb.to_s
512
+ end
513
+ output.emoji = false
514
+ cycle.each do |verb|
515
+ output.send verb, verb.to_s
516
+ end
517
+ output.color = true
518
+ cycle.each do |verb|
519
+ output.send verb, verb.to_s
520
+ end
521
+
522
+ ```
523
+ **Note** : list of ordered levels or alias : **unknown fatal error ko warn info item arrow scheduling trigger sending calling receive ok success debug flat**
524
+
525
+ Output :
526
+
527
+ * Without colors nor Emojies
528
+
529
+ ![Carioca output](assets/images/carioca_output_no_emoji_no_colors.PNG)
530
+
531
+ * Without colors but with Emojies
532
+
533
+ ![Carioca output](assets/images/carioca_output_emoji_no_colors.PNG)
534
+
535
+ * With colors but no Emojies
536
+
537
+ ![Carioca output](assets/images/carioca_output_no_emoji_colors.PNG)
538
+
539
+ * With colors and Emojies
540
+
541
+ ![Carioca output](assets/images/carioca_output_emoji_colors.PNG)
542
+
543
+ ### Service Debug
544
+
545
+
546
+ For this example, we use a internal service defined programmaticalu on runtime, (we see it more in detail in the chapter dedicated to the registry)
547
+ At the beginning of you code, just add :
548
+
549
+ ```ruby
550
+ class MyService
551
+ extend Carioca::Injector
552
+ inject service: :logger
553
+
554
+ def initialize
555
+ logger.warn(self.class.to_s) { 'Init service' }
556
+ end
557
+
558
+ def hello
559
+ logger.info(self.class.to_s) { 'Hello World' }
560
+ end
561
+
562
+ def method_test(_titi, tutu:)
563
+ @tutu = tutu
564
+ yield if block_given?
565
+ "result #{@tutu}"
566
+ end
567
+ end
568
+
569
+ spec = {
570
+ service: 'MyService::new',
571
+ type: :internal
572
+ }
573
+
574
+ Carioca::Registry.init.add service: :myservice, definition: spec
575
+
576
+ ```
577
+
578
+ With a configuration like :
579
+
580
+
581
+ ```ruby
582
+ Carioca::Registry.configure do |spec|
583
+ spec.debug = true
584
+ spec.log_level = :debug
585
+ spec.output_emoji = true
586
+ spec.output_colors = false
587
+ spec.debugger_tracer = :output
588
+ end
589
+
590
+ ```
591
+
592
+
593
+ To help debug with services, Carioca come with a proxy class debugger :
594
+
595
+ ```ruby
596
+ config = Carioca::Registry.get.get_service name: :debugger
597
+ proxy = debugger.get service: :myservice
598
+ proxy.method_test 'param', tutu: 'keyword' do
599
+ puts 'titi'
600
+ end
601
+ ```
602
+
603
+ output :
604
+
605
+ ```
606
+ 🐛 BEGIN CALL for service #<MyService:0x00005635ed283290>
607
+ 🐛 Method called: method_test
608
+ 🐛 args : param
609
+ 🐛 keywords : {:tutu=>"keyword"}
610
+ 🐛 block given
611
+ titi
612
+ 🐛 => method returned: result keyword
613
+ 🐛 END CALL
614
+ ```
615
+
616
+ ### Service Finisher
617
+
618
+ ### Service Setup
619
+
620
+ ### Service SanityCheck
621
+
622
+ ### Service Toolbox
623
+
624
+ The toolbox service is a misceleanous all purpose toolbox of methods, used by carioca's services and available for you.
625
+ ### Listing of all methods and description
626
+
627
+
628
+ ```ruby
629
+ toolbox = Carioca::Registry.get.get_service name: :toolbox
630
+ pp toolbox.describe
631
+ ```
632
+
633
+ Output (actual for this version, lust increase with the time):
634
+
635
+ ```ruby
636
+ {:is_root?=>"Verify if active current processus is running as root",
637
+ :check_unicode_term=>"Check if terminal support unicode",
638
+ :user_root=>"Get the local system root username ",
639
+ :search_file_in_gem=>"Retrieve absolute path of a file in a specific gem",
640
+ :group_root=>"Get the local system root groupname ",
641
+ :get_processes=>"Get the list of running processus"}
642
+ ```
643
+
644
+ ### methods usage
645
+
646
+ ```ruby
647
+ pp toolbox.user_root
648
+ pp toolbox.search_file_in_gem('carioca','config/locales/en.yml')
649
+
650
+ ```
651
+
652
+ ```ruby
653
+ "root"
654
+ "/var/lib/gems/3.0.0/gems/carioca-2.0.12/config/locales/en.yml"
655
+ ```
656
+
657
+ ### Service SecureStore
658
+
659
+
660
+
661
+ #### Exemple of usage of the Secure Store
662
+
663
+ This simplist example show how to store current time in Secure Data Store
664
+
665
+ **Note** : if the Data store not exist nor the master.key, when injecting the service, the two item are created on initialisation
666
+
667
+ ```ruby
668
+ securestore = Carioca::Registry.get.get_service name: :securestore
669
+ res = (securestore.data.empty?)? "first time" : securestore.data.to_s
670
+ puts res
671
+ securestore.data[:time] = Time.now
672
+ securestore.save!
673
+ ```
674
+
675
+ Output, on the first iteration :
676
+
677
+ ```
678
+ first time
679
+ ```
680
+
681
+ Output, on the second iteration :
682
+
683
+ ```
684
+ {:time=>2023-06-02 14:27:39.8903567 +0200}
685
+ ```
686
+
687
+ **Note** : by default Secure store : secure.store and Master key : master.key (chmod 400, owned by the running user), are created in "~/.carioca" of the running user.
688
+
689
+ #### Configuration in Carioca
690
+
691
+ You could change path for master.key and secure.store with :
692
+
693
+ ```ruby
694
+ Carioca::Registry.configure do |spec|
695
+ spec.user_config_path = "~/.carioca" # default user path (folder)
696
+ spec.master_key_file = "#{spec.user_config_path}/master.key" # default OpenSSL secret key for service SecureStore
697
+ sepc.secure_store_file = "#{spec.user_config_path}/secure.Store" # default OpenSSL YAM secure store file for service SecureStore
698
+ end
699
+ ```
700
+
701
+
702
+
703
+ ## Carioca Configuration
704
+
705
+ Carioca use a bloc given mapping object of to configure like :
706
+
707
+ ```ruby
708
+ Carioca::Registry.configure do |spec|
709
+ spec.xxxxx = <SOMETHING>
710
+ ...
711
+ end
712
+
713
+ ```
714
+ ### list of accessors over the spec object :
715
+
716
+ ```ruby
717
+ attr_accessor :filename, :name, :builtins, :log_target, :default_locale, :locales_load_path, :debugger_tracer,
718
+ :config_file, :config_root, :environment, :supported_environments, :output_mode, :log_level, :output_target, :user_config_path,
719
+ :master_key_file, :secure_store_file
720
+ attr_writer :init_from_file, :output_colors, :output_emoji
721
+ attr_reader :log_file, :locales_availables, :debug
722
+
723
+ ```
724
+
725
+ ### Publique usage (with default values and possibles values)
726
+
727
+ ```ruby
728
+ Carioca::Registry.configure do |spec|
729
+
730
+ spec.filename = './config/carioca.registry' # the carioca registry of services configuration
731
+ spec.name = 'Carioca' # the name of the application
732
+ spec.debug = false # activate debug, display debug Carioca message
733
+ spec.init_from_file = true # use the registry file to init services : (spec.filename)
734
+ spec.log_file = '' # path to a log file for carioca logger service
735
+ spec.config_file = './config/settings.yml' # path to the YAMl COnfiguration file for :configuration Carioca service
736
+ spec.config_root = :carioca # the config root in the YAMl COnfiguration file for :configuration Carioca service
737
+ spec.environment = :development # the current environment running with Carioca
738
+ spec.default_locale = :en # the default locales Carioca fot I18n Carioca Service
739
+ spec.log_level = :info # the current log level (see logger ) for Carioca in :debug,:info,:warn,:error,:fatal,:unknown
740
+ spec.output_mode = :mono # the current output mode in :mono, :dual, :log (see Carioca Service Output)
741
+ spec.output_emoji = true # the current output status for emoji (see Carioca Service Output)
742
+ spec.output_target = STDOUT # the current output target STDOUT or STDERR (see Carioca Service Output)
743
+ spec.output_colors = true # the current output status for colors (see Carioca Service Output)
744
+ spec.locales_load_path << Dir["#{File.expand_path('./config/locales')}/*.yml"]
745
+ spec.debugger_tracer = :output # the Debbugger service output in #log , :output
746
+ spec.user_config_path = "~/.carioca" # default user path (folder)
747
+ spec.master_key_file = "#{spec.user_config_path}/master.key" # default OpenSSL secret key for service SecureStore
748
+ sepc.secure_store_file = "#{spec.user_config_path}/secure.Store" # default OpenSSL YAM secure store file for service SecureStore
749
+
750
+ end
751
+ ```
752
+ ## Registry access and methods
753
+
754
+ ### Init or getting Registry
755
+
756
+ Carioca::Registry is a Singleton Object
757
+
758
+ You cloud init or get it by #get, #instance or #init, like :
759
+
760
+ ```ruby
761
+ registry = Carioca::Registry.init
762
+ registry = Carioca::Registry.instance
763
+ registry = Carioca::Registry.get
764
+ ```
765
+
766
+ ### Direct access to Registry and getting service Without Injector or Carioca::Container
767
+
768
+ Example : for output service
769
+
770
+ ```ruby
771
+ output = Carioca::Registry.get.get_service name: :output
772
+ ```
773
+
774
+
775
+ ### Adding a service programatically
776
+
777
+ To add a service, you could insert it in the registry file (before run) or adding it programatically
778
+
779
+ ```ruby
780
+ class MyService
781
+ extend Carioca::Injector
782
+ inject service: :logger
783
+
784
+ def initialize
785
+ logger.warn(self.class.to_s) { 'Init service' }
786
+ end
787
+
788
+ def hello
789
+ logger.info(self.class.to_s) { 'Hello World' }
790
+ end
791
+
792
+ def method_test(_titi, tutu:)
793
+ @tutu = tutu
794
+ yield if block_given?
795
+ "result #{@tutu}"
796
+ end
797
+ end
798
+
799
+ spec = {
800
+ service: 'MyService::new',
801
+ type: :internal
802
+ }
803
+
804
+ Carioca::Registry.init.add service: :myservice, definition: spec
805
+
806
+ ```
807
+
808
+
809
+ ### Decription of type of Service
810
+
811
+
812
+ ```ruby
813
+ SERVICES_MANDATORY_SPECS = { type: Symbol, service: String }.freeze
814
+ SERVICES_FULL_LIST_SPECS = SERVICES_MANDATORY_SPECS.merge({ depends: Array, description: String,
815
+ resource: String })
816
+ ```
817
+
818
+
819
+ * :type must be : :gem, :file, :stdlib all engage requirement of the resource field, tje last :internal is usable if the code is internal in your application.
820
+
821
+ * :service : is the Ruby code to access to Class for class methods service usage or object instance
822
+ example : MYCLASS or MyClass::new(params)
823
+
824
+ * :resource is respectively a name of a gem, an absolut path of a ruby file, the name of a Ruby Stdlib correspondingly to :type
825
+ * depends : is a list of requiered services for this service. (all services in depends are load before getting the wanted service (from builtin and in registry file or added at runtime ).
826
+ * Description is not mandatory
827
+
192
828
 
193
- ## A step further
194
829
 
195
830
 
196
831
  ## Development
data/Rakefile CHANGED
@@ -44,3 +44,18 @@ namespace :yardoc do
44
44
  end
45
45
  end
46
46
  task clobber: 'yardoc:clobber'
47
+
48
+ desc "Run CVE security audit over bundle"
49
+ task :audit do
50
+ system('bundle audit')
51
+ end
52
+
53
+ desc "Run dead line of code detection"
54
+ task :debride do
55
+ system('debride -w .debride_withelist .')
56
+ end
57
+
58
+ desc "Run SBOM CycloneDX Xml format file"
59
+ task :sbom do
60
+ system('cyclonedx-ruby -p .')
61
+ end