carioca 1.4 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/main.yml +18 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/Gemfile +6 -1
- data/Gemfile.lock +49 -0
- data/README.md +12 -220
- data/Rakefile +5 -66
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/carioca.gemspec +32 -23
- data/config/locales/en.yml +15 -0
- data/config/locales/fr.yml +19 -0
- data/lib/carioca/configuration.rb +47 -0
- data/lib/carioca/constants.rb +45 -0
- data/lib/carioca/container.rb +16 -0
- data/lib/carioca/dependencies.rb +19 -0
- data/lib/carioca/helpers.rb +44 -31
- data/lib/carioca/mixin.rb +32 -0
- data/lib/carioca/{tasks/rake.rb → rake/manage.rb} +2 -4
- data/lib/carioca/rake/tasks/registry.tasks +57 -0
- data/lib/carioca/registry.rb +93 -0
- data/lib/carioca/registry_file.rb +62 -0
- data/lib/carioca/services/config.rb +140 -0
- data/lib/carioca/services/i18n.rb +20 -0
- data/lib/carioca/services/init.rb +2 -0
- data/lib/carioca/validator.rb +49 -0
- data/lib/carioca.rb +2 -319
- data/samples/Rakefile +2 -0
- data/samples/config/carioca.registry +22 -0
- data/samples/config/locales/en.yml +2 -0
- data/samples/config/locales/es.yml +2 -0
- data/samples/config/locales/fr.yml +2 -0
- data/samples/config/settings.yml +24 -0
- data/samples/test.rb +71 -0
- metadata +46 -187
- data/AUTHORS +0 -8
- data/COPYRIGHT +0 -24
- data/ChangeLog +0 -10
- data/INSTALL +0 -7
- data/doc/manual.rdoc +0 -225
- data/lib/carioca/exceptions.rb +0 -9
- data/lib/carioca/private.rb +0 -168
- data/lib/carioca/services/configuration.rb +0 -203
- data/lib/carioca/services/debug.rb +0 -71
- data/lib/carioca/services/logger.rb +0 -58
- data/lib/carioca/services.rb +0 -143
- data/lib/carioca/tasks/registry_init.rake +0 -12
- data/spec/carioca_spec.rb +0 -468
- data/spec/config/.config +0 -14
- data/spec/config/services.registry +0 -55
- data/spec/init_spec.rb +0 -2
- data/spec/samples/dummy.rb +0 -11
- data/spec/samples/otherdummy.rb +0 -11
- data/spec/samples/requireddummy.rb +0 -11
- data/spec/spec_helper.rb +0 -18
- data/ultragreen_roodi_coding_convention.yml +0 -25
metadata
CHANGED
@@ -1,233 +1,92 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: carioca
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Romain GEORGES
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-03-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: tty-prompt
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: 13.0.1
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rspec
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: 3.9.0
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: 3.9.0
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: yard
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: 0.9.24
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: 0.9.24
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rdoc
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: 6.2.1
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: 6.2.1
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: roodi
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: 5.0.0
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "~>"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: 5.0.0
|
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
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: yard-rspec
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - "~>"
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '0.1'
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - "~>"
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '0.1'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: uuid
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - "~>"
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: 2.3.9
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - "~>"
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: 2.3.9
|
125
|
-
- !ruby/object:Gem::Dependency
|
126
|
-
name: dorsal
|
127
|
-
requirement: !ruby/object:Gem::Requirement
|
128
|
-
requirements:
|
129
|
-
- - "~>"
|
130
|
-
- !ruby/object:Gem::Version
|
131
|
-
version: '1.0'
|
19
|
+
version: 0.23.1
|
132
20
|
type: :runtime
|
133
21
|
prerelease: false
|
134
22
|
version_requirements: !ruby/object:Gem::Requirement
|
135
23
|
requirements:
|
136
24
|
- - "~>"
|
137
25
|
- !ruby/object:Gem::Version
|
138
|
-
version:
|
139
|
-
- !ruby/object:Gem::Dependency
|
140
|
-
name: methodic
|
141
|
-
requirement: !ruby/object:Gem::Requirement
|
142
|
-
requirements:
|
143
|
-
- - "~>"
|
144
|
-
- !ruby/object:Gem::Version
|
145
|
-
version: '1.3'
|
146
|
-
- - ">="
|
147
|
-
- !ruby/object:Gem::Version
|
148
|
-
version: '1.3'
|
149
|
-
type: :runtime
|
150
|
-
prerelease: false
|
151
|
-
version_requirements: !ruby/object:Gem::Requirement
|
152
|
-
requirements:
|
153
|
-
- - "~>"
|
154
|
-
- !ruby/object:Gem::Version
|
155
|
-
version: '1.3'
|
156
|
-
- - ">="
|
157
|
-
- !ruby/object:Gem::Version
|
158
|
-
version: '1.3'
|
159
|
-
- !ruby/object:Gem::Dependency
|
160
|
-
name: xml-simple
|
161
|
-
requirement: !ruby/object:Gem::Requirement
|
162
|
-
requirements:
|
163
|
-
- - "~>"
|
164
|
-
- !ruby/object:Gem::Version
|
165
|
-
version: '1.1'
|
166
|
-
- - ">="
|
167
|
-
- !ruby/object:Gem::Version
|
168
|
-
version: 1.1.5
|
169
|
-
type: :runtime
|
170
|
-
prerelease: false
|
171
|
-
version_requirements: !ruby/object:Gem::Requirement
|
172
|
-
requirements:
|
173
|
-
- - "~>"
|
174
|
-
- !ruby/object:Gem::Version
|
175
|
-
version: '1.1'
|
176
|
-
- - ">="
|
177
|
-
- !ruby/object:Gem::Version
|
178
|
-
version: 1.1.5
|
26
|
+
version: 0.23.1
|
179
27
|
- !ruby/object:Gem::Dependency
|
180
|
-
name:
|
28
|
+
name: pastel
|
181
29
|
requirement: !ruby/object:Gem::Requirement
|
182
30
|
requirements:
|
183
31
|
- - "~>"
|
184
32
|
- !ruby/object:Gem::Version
|
185
|
-
version:
|
33
|
+
version: 0.8.0
|
186
34
|
type: :runtime
|
187
35
|
prerelease: false
|
188
36
|
version_requirements: !ruby/object:Gem::Requirement
|
189
37
|
requirements:
|
190
38
|
- - "~>"
|
191
39
|
- !ruby/object:Gem::Version
|
192
|
-
version:
|
40
|
+
version: 0.8.0
|
193
41
|
description: 'Carioca : provide a full IoC light Container for designing your applications'
|
194
|
-
email:
|
42
|
+
email:
|
43
|
+
- romain@ultragreen.net
|
195
44
|
executables: []
|
196
45
|
extensions: []
|
197
46
|
extra_rdoc_files: []
|
198
47
|
files:
|
199
|
-
-
|
200
|
-
-
|
201
|
-
-
|
48
|
+
- ".github/workflows/main.yml"
|
49
|
+
- ".gitignore"
|
50
|
+
- ".rspec"
|
202
51
|
- Gemfile
|
203
|
-
-
|
52
|
+
- Gemfile.lock
|
204
53
|
- README.md
|
205
54
|
- Rakefile
|
55
|
+
- bin/console
|
56
|
+
- bin/setup
|
206
57
|
- carioca.gemspec
|
207
|
-
-
|
58
|
+
- config/locales/en.yml
|
59
|
+
- config/locales/fr.yml
|
208
60
|
- lib/carioca.rb
|
209
|
-
- lib/carioca/
|
61
|
+
- lib/carioca/configuration.rb
|
62
|
+
- lib/carioca/constants.rb
|
63
|
+
- lib/carioca/container.rb
|
64
|
+
- lib/carioca/dependencies.rb
|
210
65
|
- lib/carioca/helpers.rb
|
211
|
-
- lib/carioca/
|
212
|
-
- lib/carioca/
|
213
|
-
- lib/carioca/
|
214
|
-
- lib/carioca/
|
215
|
-
- lib/carioca/
|
216
|
-
- lib/carioca/
|
217
|
-
- lib/carioca/
|
218
|
-
-
|
219
|
-
-
|
220
|
-
-
|
221
|
-
-
|
222
|
-
-
|
223
|
-
-
|
224
|
-
-
|
225
|
-
-
|
226
|
-
-
|
66
|
+
- lib/carioca/mixin.rb
|
67
|
+
- lib/carioca/rake/manage.rb
|
68
|
+
- lib/carioca/rake/tasks/registry.tasks
|
69
|
+
- lib/carioca/registry.rb
|
70
|
+
- lib/carioca/registry_file.rb
|
71
|
+
- lib/carioca/services/config.rb
|
72
|
+
- lib/carioca/services/i18n.rb
|
73
|
+
- lib/carioca/services/init.rb
|
74
|
+
- lib/carioca/validator.rb
|
75
|
+
- samples/Rakefile
|
76
|
+
- samples/config/carioca.registry
|
77
|
+
- samples/config/locales/en.yml
|
78
|
+
- samples/config/locales/es.yml
|
79
|
+
- samples/config/locales/fr.yml
|
80
|
+
- samples/config/settings.yml
|
81
|
+
- samples/test.rb
|
227
82
|
homepage: https://github.com/Ultragreen/carioca
|
228
83
|
licenses:
|
229
|
-
- BSD-
|
230
|
-
metadata:
|
84
|
+
- BSD-3-Clause
|
85
|
+
metadata:
|
86
|
+
allowed_push_host: https://rubygems.org
|
87
|
+
homepage_uri: https://github.com/Ultragreen/carioca
|
88
|
+
source_code_uri: https://github.com/Ultragreen/carioca
|
89
|
+
changelog_uri: https://github.com/Ultragreen/carioca
|
231
90
|
post_install_message:
|
232
91
|
rdoc_options: []
|
233
92
|
require_paths:
|
@@ -236,7 +95,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
236
95
|
requirements:
|
237
96
|
- - ">="
|
238
97
|
- !ruby/object:Gem::Version
|
239
|
-
version:
|
98
|
+
version: 2.3.0
|
240
99
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
241
100
|
requirements:
|
242
101
|
- - ">="
|
data/AUTHORS
DELETED
data/COPYRIGHT
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
carioca Copyright (c) 2013 Ultragreen Software, Romain GEORGES
|
2
|
-
All rights reserved.
|
3
|
-
|
4
|
-
Redistribution and use in source and binary forms, with or without
|
5
|
-
modification, are permitted provided that the following conditions
|
6
|
-
are met:
|
7
|
-
1. Redistributions of source code must retain the above copyright
|
8
|
-
notice, this list of conditions and the following disclaimer.
|
9
|
-
2. Redistributions in binary form must reproduce the above copyright
|
10
|
-
notice, this list of conditions and the following disclaimer in the
|
11
|
-
documentation and/or other materials provided with the distribution.
|
12
|
-
|
13
|
-
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
14
|
-
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
15
|
-
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
16
|
-
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
17
|
-
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
18
|
-
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
19
|
-
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
20
|
-
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
21
|
-
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
22
|
-
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
23
|
-
SUCH DAMAGE.
|
24
|
-
|
data/ChangeLog
DELETED
data/INSTALL
DELETED
data/doc/manual.rdoc
DELETED
@@ -1,225 +0,0 @@
|
|
1
|
-
= Carioca
|
2
|
-
|
3
|
-
== Content
|
4
|
-
|
5
|
-
Author:: Romain GEORGES <romain@ultragreen.net>
|
6
|
-
Version:: 1.0
|
7
|
-
WWW:: http://www.ultragreen.net/projects/carioca
|
8
|
-
|
9
|
-
== Description
|
10
|
-
|
11
|
-
CARIOCA is Configuration Agent and Registry with Inversion Of Control for your Applications
|
12
|
-
Carioca provide a full IoC light Container for designing your applications
|
13
|
-
Carioca provide :
|
14
|
-
- a complete Configuration Agent
|
15
|
-
- A service Registry (base on IOC/DI pattern)
|
16
|
-
|
17
|
-
|
18
|
-
== Installation
|
19
|
-
|
20
|
-
In a valid Ruby environment :
|
21
|
-
|
22
|
-
$ sudo zsh
|
23
|
-
# gem ins carioca
|
24
|
-
|
25
|
-
== Implementation
|
26
|
-
|
27
|
-
* [Carioca]
|
28
|
-
* [Carioca::Services]
|
29
|
-
* [Carioca:Services::Registry]
|
30
|
-
|
31
|
-
== Utilisation
|
32
|
-
|
33
|
-
Carioca may be used to create Ruby applications, based on a service registry
|
34
|
-
Carioca come with somes builtin services :
|
35
|
-
* logger : an Internal logger based on the logger gem.
|
36
|
-
* Configuration : a Configuration Service, with Yaml percistance, and pretty accessors.
|
37
|
-
* Debug : a Class Debugger, based on Proxy Design pattern and meta-programation like method_missing
|
38
|
-
|
39
|
-
|
40
|
-
=== Getting start
|
41
|
-
|
42
|
-
==== Preparing Gem
|
43
|
-
|
44
|
-
Just after Installation, Carioca :
|
45
|
-
|
46
|
-
$ gem ins bundler # if needed
|
47
|
-
$ bunlde gem myapp
|
48
|
-
$ cd myapp
|
49
|
-
|
50
|
-
|
51
|
-
Edit your myapp.gemspec, add this line in Gem::Specification bloc :
|
52
|
-
|
53
|
-
gem.add_dependency 'carioca'
|
54
|
-
gem.add_development_dependency 'rake'
|
55
|
-
gem.add_development_dependency 'carioca'
|
56
|
-
|
57
|
-
Description and summary need to be changed to be correctly displayed on Rubygems.
|
58
|
-
|
59
|
-
so, execute bundle :
|
60
|
-
|
61
|
-
$ bundle
|
62
|
-
|
63
|
-
Your environment, is ready to create your app
|
64
|
-
|
65
|
-
==== Prepare Carioca
|
66
|
-
|
67
|
-
|
68
|
-
$ mkdir config
|
69
|
-
$ mkdir bin
|
70
|
-
|
71
|
-
edit bin/myapp :
|
72
|
-
|
73
|
-
require 'rubygems'
|
74
|
-
require 'carioca'
|
75
|
-
|
76
|
-
registry = Carioca::Services::Registry.init :file => 'config/myservices.registry'
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
After, you could Run Carioca and discover Builtins Services, you need the write access to config path
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
$ ruby -e 'require "rubygems"; require "carioca"; reg = Carioca::Services::Registry.init :file => "config/myservices.registry"; reg.discover_builtins; reg.save!'
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
this create you, a New Registry config, with all builtins registered.
|
89
|
-
Default path :
|
90
|
-
* config file : ./.config
|
91
|
-
* log file : /tmp/log.file
|
92
|
-
Carioca Registry is a Singleton, and services also be unique instance.
|
93
|
-
|
94
|
-
Now you could continue coding your bin/myapp
|
95
|
-
|
96
|
-
==== Using Configuration Service
|
97
|
-
|
98
|
-
|
99
|
-
require 'rubygems'
|
100
|
-
require 'carioca'
|
101
|
-
|
102
|
-
registry = Carioca::Services::Registry.init :file => 'config/myservices.registry'
|
103
|
-
config = registry.start_service :name => 'configuration'
|
104
|
-
config.setings.db = { :name => 'mydb' }
|
105
|
-
config.settings.db.host = "myhost"
|
106
|
-
config.settings.db.port = "4545"
|
107
|
-
config.settings.email = "my@email.com"
|
108
|
-
config.save!
|
109
|
-
|
110
|
-
|
111
|
-
==== Using Logger Service
|
112
|
-
|
113
|
-
logger is automatically loaded with Carioca, loading registry with :debug => true, let you see the Carioca traces.
|
114
|
-
|
115
|
-
|
116
|
-
require 'rubygems'
|
117
|
-
require 'carioca'
|
118
|
-
|
119
|
-
registry = Carioca::Services::Registry.init :file => 'config/myservices.registry' :debug => true
|
120
|
-
log = registry.get_service :name => 'logger'
|
121
|
-
log.info('myapp') {'my message' }
|
122
|
-
|
123
|
-
|
124
|
-
==== Creating and using your own service
|
125
|
-
|
126
|
-
before create your own service :
|
127
|
-
|
128
|
-
|
129
|
-
$ mkdir services
|
130
|
-
|
131
|
-
|
132
|
-
Services, must be a class, if not do a wrapper
|
133
|
-
edit services/myservice.rb
|
134
|
-
|
135
|
-
class MyService
|
136
|
-
def initialize
|
137
|
-
end
|
138
|
-
|
139
|
-
def test(arg = nil)
|
140
|
-
return 'OK'
|
141
|
-
end
|
142
|
-
end
|
143
|
-
end
|
144
|
-
|
145
|
-
|
146
|
-
You could use the #service_register API (See spec for all details)
|
147
|
-
but, you could write it directly in YAML in your config/myservices.registry :
|
148
|
-
add the following lines :
|
149
|
-
|
150
|
-
...
|
151
|
-
myservice:
|
152
|
-
:type: :file
|
153
|
-
:resource: services/myservice.rb
|
154
|
-
:description: a test service
|
155
|
-
:service: MyServices
|
156
|
-
...
|
157
|
-
|
158
|
-
So in your app :
|
159
|
-
|
160
|
-
|
161
|
-
require 'rubygems'
|
162
|
-
require 'carioca'
|
163
|
-
|
164
|
-
registry = Carioca::Services::Registry.init :file => 'config/myservices.registry'
|
165
|
-
service = registry.start_service :name => 'myservice'
|
166
|
-
service.test('titi')
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
==== Using Debug in multiple service instance
|
171
|
-
|
172
|
-
|
173
|
-
in your app, for debug you could use the Proxy Debug (you need to run Carioca Registry in debug mode ) :
|
174
|
-
(Using "debug_", you create an instance of service debug, so with this syntaxe you could create multiple services instances, with different parameters calling.)
|
175
|
-
|
176
|
-
|
177
|
-
require 'rubygems'
|
178
|
-
require 'carioca'
|
179
|
-
|
180
|
-
registry = Carioca::Services::Registry.init :file => 'config/myservices.registry' :debug => true
|
181
|
-
proxy1 = registry.get_service :name => 'debug_myservice', :params => {:service => 'myservice'}
|
182
|
-
proxy1.test('titi')
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
see the log /tmp/log.file :
|
187
|
-
|
188
|
-
|
189
|
-
D, [2013-03-23T18:20:39.839826 #76641] DEBUG -- ProxyDebug: BEGIN CALL for mapped service myservice
|
190
|
-
D, [2013-03-23T18:20:39.839875 #76641] DEBUG -- ProxyDebug: called: test
|
191
|
-
D, [2013-03-23T18:20:39.839920 #76641] DEBUG -- ProxyDebug: args : titi
|
192
|
-
D, [2013-03-23T18:20:39.839970 #76641] DEBUG -- ProxyDebug: => returned: OK
|
193
|
-
D, [2013-03-23T18:20:39.840014 #76641] DEBUG -- ProxyDebug: END CALL
|
194
|
-
|
195
|
-
==== Using Gem for a service
|
196
|
-
|
197
|
-
|
198
|
-
For exemple install uuid gem :
|
199
|
-
|
200
|
-
$ gem ins uuid
|
201
|
-
|
202
|
-
|
203
|
-
add to your YAML config config/myservices.registry :
|
204
|
-
|
205
|
-
uuid:
|
206
|
-
:type: :gem
|
207
|
-
:resource: uuid
|
208
|
-
:description: a Rubygems called uuid to build UUID ids.
|
209
|
-
:service: UUID
|
210
|
-
|
211
|
-
|
212
|
-
in your app :
|
213
|
-
|
214
|
-
require 'rubygems'
|
215
|
-
require 'carioca'
|
216
|
-
|
217
|
-
registry = Carioca::Services::Registry.init :file => 'config/myservices.registry' :debug => true
|
218
|
-
uuid = registry.get_service :name => 'uuid'
|
219
|
-
uuid.generate
|
220
|
-
|
221
|
-
|
222
|
-
== Copyright
|
223
|
-
|
224
|
-
<pre>carioca (c) 2012-2013 Romain GEORGES <romain@ultragreen.net> for Ultragreen Software </pre>
|
225
|
-
|