carioca 1.4 → 2.0.3
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 +3 -1
- data/Gemfile.lock +58 -0
- data/README.md +123 -190
- data/Rakefile +5 -66
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/carioca.gemspec +37 -23
- data/config/locales/en.yml +23 -0
- data/config/locales/fr.yml +23 -0
- data/lib/carioca/configuration.rb +61 -0
- data/lib/carioca/constants.rb +68 -0
- data/lib/carioca/container.rb +16 -0
- data/lib/carioca/dependencies.rb +20 -0
- data/lib/carioca/helpers.rb +44 -31
- data/lib/carioca/mixin.rb +32 -0
- data/lib/carioca/{tasks/rake.rb → rake/manage.rb} +5 -4
- 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 +64 -0
- data/lib/carioca/registry.rb +94 -0
- data/lib/carioca/registry_file.rb +62 -0
- data/lib/carioca/services/config.rb +141 -0
- data/lib/carioca/services/debug.rb +48 -61
- data/lib/carioca/services/i18n.rb +20 -0
- data/lib/carioca/services/init.rb +2 -0
- data/lib/carioca/services/output.rb +189 -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 +118 -0
- metadata +77 -143
- 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/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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 99fbf2409631fe5afb97b9807059612f5eaa0e237bf44685a8f9aa993db1b87b
|
4
|
+
data.tar.gz: 36636acf529dc8610985e3bd96310482a0e0f9003836c6a902411cf908735166
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c9dccd95e578ea578f226c273c132f6021a23b856a25606557044cbaa0aea3403e0522b236c87a581a69653fc0264c8c3c38eb643baf4e9538db5534ffe0a316
|
7
|
+
data.tar.gz: b64096695a61f14423ca8d90363b3fd1d09317aa3eac742e4e9aef4b4ff0381cfd0f443fca2d498092673fd122d639e8b93f182ba1854d38fe138e742e19dc5d
|
@@ -0,0 +1,18 @@
|
|
1
|
+
name: Ruby
|
2
|
+
|
3
|
+
on: [push,pull_request]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
build:
|
7
|
+
runs-on: ubuntu-latest
|
8
|
+
steps:
|
9
|
+
- uses: actions/checkout@v2
|
10
|
+
- name: Set up Ruby
|
11
|
+
uses: ruby/setup-ruby@v1
|
12
|
+
with:
|
13
|
+
ruby-version: 3.0.0
|
14
|
+
- name: Run the default task
|
15
|
+
run: |
|
16
|
+
gem install bundler -v 2.2.3
|
17
|
+
bundle install
|
18
|
+
bundle exec rake
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/Gemfile
CHANGED
data/Gemfile.lock
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
carioca (2.0.3)
|
5
|
+
deep_merge (~> 1.2)
|
6
|
+
i18n (~> 1.10)
|
7
|
+
locale (~> 2.1)
|
8
|
+
pastel (~> 0.8.0)
|
9
|
+
tty-prompt (~> 0.23.1)
|
10
|
+
|
11
|
+
GEM
|
12
|
+
remote: https://rubygems.org/
|
13
|
+
specs:
|
14
|
+
concurrent-ruby (1.1.9)
|
15
|
+
deep_merge (1.2.2)
|
16
|
+
diff-lcs (1.5.0)
|
17
|
+
i18n (1.10.0)
|
18
|
+
concurrent-ruby (~> 1.0)
|
19
|
+
locale (2.1.3)
|
20
|
+
pastel (0.8.0)
|
21
|
+
tty-color (~> 0.5)
|
22
|
+
rake (13.0.6)
|
23
|
+
rspec (3.9.0)
|
24
|
+
rspec-core (~> 3.9.0)
|
25
|
+
rspec-expectations (~> 3.9.0)
|
26
|
+
rspec-mocks (~> 3.9.0)
|
27
|
+
rspec-core (3.9.3)
|
28
|
+
rspec-support (~> 3.9.3)
|
29
|
+
rspec-expectations (3.9.4)
|
30
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
31
|
+
rspec-support (~> 3.9.0)
|
32
|
+
rspec-mocks (3.9.1)
|
33
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
34
|
+
rspec-support (~> 3.9.0)
|
35
|
+
rspec-support (3.9.4)
|
36
|
+
tty-color (0.6.0)
|
37
|
+
tty-cursor (0.7.1)
|
38
|
+
tty-prompt (0.23.1)
|
39
|
+
pastel (~> 0.8)
|
40
|
+
tty-reader (~> 0.8)
|
41
|
+
tty-reader (0.9.0)
|
42
|
+
tty-cursor (~> 0.7)
|
43
|
+
tty-screen (~> 0.8)
|
44
|
+
wisper (~> 2.0)
|
45
|
+
tty-screen (0.8.1)
|
46
|
+
wisper (2.0.1)
|
47
|
+
|
48
|
+
PLATFORMS
|
49
|
+
arm64-darwin-20
|
50
|
+
ruby
|
51
|
+
|
52
|
+
DEPENDENCIES
|
53
|
+
carioca!
|
54
|
+
rake (~> 13.0)
|
55
|
+
rspec (~> 3.0)
|
56
|
+
|
57
|
+
BUNDLED WITH
|
58
|
+
2.2.3
|
data/README.md
CHANGED
@@ -1,239 +1,172 @@
|
|
1
1
|
# Carioca
|
2
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
|
-
[![Build Status](https://travis-ci.org/lecid/carioca.png?branch=master)](https://travis-ci.org/lecid/carioca)
|
18
|
-
|
19
|
-
|
20
3
|
## Installation
|
21
4
|
|
22
|
-
|
23
|
-
|
24
|
-
```
|
25
|
-
$ sudo zsh
|
26
|
-
# gem ins carioca
|
27
|
-
```
|
28
|
-
## Implementation
|
29
|
-
|
30
|
-
* [Carioca]
|
31
|
-
* [Carioca::Services]
|
32
|
-
* [Carioca:Services::Registry]
|
33
|
-
|
34
|
-
## Utilisation
|
35
|
-
|
36
|
-
Carioca may be used to create Ruby applications, based on a service registry
|
37
|
-
Carioca come with somes builtin services :
|
38
|
-
* logger : an Internal logger based on the logger gem.
|
39
|
-
* Configuration : a Configuration Service, with Yaml percistance, and pretty accessors.
|
40
|
-
* Debug : a Class Debugger, based on Proxy Design pattern and meta-programation like method_missing
|
41
|
-
|
42
|
-
### Getting start
|
43
|
-
|
44
|
-
#### Preparing Gem
|
45
|
-
|
46
|
-
Just after Installation, Carioca :
|
5
|
+
Install it yourself as:
|
47
6
|
|
48
|
-
|
49
|
-
$ gem ins bundler # if needed
|
50
|
-
$ bunlde gem myapp
|
51
|
-
$ cd myapp
|
52
|
-
```
|
7
|
+
$ gem install carioca
|
53
8
|
|
54
|
-
|
55
|
-
|
56
|
-
```ruby
|
57
|
-
gem.add_dependency 'carioca'
|
58
|
-
gem.add_development_dependency 'rake'
|
59
|
-
gem.add_development_dependency 'carioca'
|
60
|
-
```
|
9
|
+
## Usage
|
61
10
|
|
62
|
-
Description and summary need to be changed to be correctly displayed on Rubygems.
|
63
11
|
|
64
|
-
|
12
|
+
### Basic usage
|
65
13
|
|
66
|
-
|
67
|
-
$ bundle
|
68
|
-
```
|
14
|
+
Create you own gem :
|
69
15
|
|
70
|
-
|
16
|
+
$ bundle gem yourgem
|
17
|
+
$ cd yourgem
|
18
|
+
$ vi yourgem.gemspec
|
71
19
|
|
72
|
-
|
73
|
-
|
74
|
-
```
|
75
|
-
$ mkdir config
|
76
|
-
$ mkdir bin
|
77
|
-
```
|
78
|
-
|
79
|
-
edit bin/myapp :
|
20
|
+
check all the TODO in your gemspec, specify concretly you Gem specification, add the following line :
|
80
21
|
|
81
22
|
```ruby
|
82
|
-
|
83
|
-
require 'carioca'
|
84
|
-
|
85
|
-
registry = Carioca::Services::Registry.init :file => 'config/myservices.registry'
|
86
|
-
```
|
87
|
-
|
88
|
-
|
89
|
-
After, you could Run Carioca and discover Builtins Services, you need the write access to config path
|
90
|
-
|
91
|
-
|
23
|
+
spec.add_dependency "carioca", "~> 2.0"
|
92
24
|
```
|
93
|
-
|
94
|
-
```
|
95
|
-
|
25
|
+
and after :
|
96
26
|
|
97
|
-
|
98
|
-
|
99
|
-
* config file : ./.config
|
100
|
-
* log file : /tmp/log.file
|
101
|
-
Carioca Registry is a Singleton, and services also be unique instance.
|
27
|
+
$ bundle add carioca
|
28
|
+
$ mkdir -p config/locales
|
102
29
|
|
103
|
-
|
104
|
-
|
105
|
-
#### Using Configuration Service
|
30
|
+
Edit the Rakefil, and add the following line :
|
106
31
|
|
107
32
|
```ruby
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
33
|
+
require "carioca/rake/manage"
|
34
|
+
```
|
35
|
+
Verify, all is right with :
|
36
|
+
|
37
|
+
$ rake -T
|
38
|
+
rake build # Build yourgem-0.1.0.gem into the pkg directory
|
39
|
+
rake carioca:registry:add_service # Adding service to Carioca Registry file
|
40
|
+
rake clean # Remove any temporary products
|
41
|
+
rake clobber # Remove any generated files
|
42
|
+
rake install # Build and install yourgem-0.1.0.gem into system gems
|
43
|
+
rake install:local # Build and install yourgem-0.1.0.gem into system gems without network access
|
44
|
+
rake release[remote] # Create tag v0.1.0 and build and push yourgem-0.1.0.gem to Set to 'http://mygemserver.com'
|
45
|
+
rake spec # Run RSpec code examples
|
46
|
+
|
47
|
+
You could now initialize the Carioca registry following the wizard, with (sample with a simple UUID generator gem):
|
48
|
+
|
49
|
+
$ rake carioca:registry:add_service
|
50
|
+
Carioca : registering service :
|
51
|
+
Registry File path ? ./config/carioca.registry
|
52
|
+
Service name ? uuid
|
53
|
+
Choose the service type ? gem
|
54
|
+
Description ? The uuid service
|
55
|
+
Service [uuid] inline Proc Ruby code ? UUID
|
56
|
+
Give the Rubygem name ? uuid
|
57
|
+
Did this service have dependencies ? no
|
58
|
+
|
59
|
+
=> Service : uuid
|
60
|
+
Definition
|
61
|
+
* type: gem
|
62
|
+
* description: The uuid service
|
63
|
+
* service: UUID
|
64
|
+
* resource: uuid
|
65
|
+
Is it correct ? Yes
|
66
|
+
Carioca : Registry saved
|
67
|
+
|
68
|
+
This will initiate a Carioca Registry (YAML file, the format will be describe after, the wizard support all type of services, managed by Carioca, all keys are Symbols):
|
69
|
+
|
70
|
+
$ cat config/carioca.registry
|
71
|
+
---
|
72
|
+
:uuid:
|
73
|
+
:type: :gem
|
74
|
+
:description: The uuid service
|
75
|
+
:service: UUID
|
76
|
+
:resource: uuid
|
77
|
+
|
78
|
+
Now your are ready to use Carioca :
|
79
|
+
|
80
|
+
In this sample, we are going th create a demo command.
|
81
|
+
Firstly, we have to configure a basic usage of Carioca, this could be made in the lib path, in the root gem library.
|
82
|
+
|
83
|
+
$ emacs lib/yourgem.rb
|
84
|
+
|
85
|
+
content of the destination file
|
123
86
|
|
124
87
|
```ruby
|
125
|
-
require 'rubygems'
|
126
|
-
require 'carioca'
|
127
88
|
|
128
|
-
|
129
|
-
log = registry.get_service :name => 'logger'
|
130
|
-
log.info('myapp') {'my message' }
|
131
|
-
```
|
89
|
+
# frozen_string_literal: true
|
132
90
|
|
133
|
-
|
91
|
+
require_relative "yourgem/version"
|
92
|
+
require 'carioca'
|
134
93
|
|
135
|
-
before create your own service :
|
136
94
|
|
137
|
-
|
138
|
-
|
139
|
-
|
95
|
+
Carioca::Registry.configure do |spec|
|
96
|
+
spec.debug = true
|
97
|
+
end
|
140
98
|
|
141
|
-
|
142
|
-
|
99
|
+
module Yourgem
|
100
|
+
class Error < StandardError; end
|
143
101
|
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
def test(arg = nil)
|
150
|
-
return 'OK'
|
151
|
-
end
|
102
|
+
class YourgemCMD < Carioca::Container
|
103
|
+
def test
|
104
|
+
logger.info(self.to_s) { "Log me as an instance method" }
|
105
|
+
logger.warn(self.class.to_s) {"Give me an UUID : " + uuid.generate}
|
152
106
|
end
|
153
|
-
end
|
154
|
-
```
|
155
107
|
|
156
|
-
|
157
|
-
but, you could write it directly in YAML in your config/myservices.registry :
|
158
|
-
add the following lines :
|
108
|
+
inject service: :uuid
|
159
109
|
|
160
|
-
|
161
|
-
...
|
162
|
-
myservice:
|
163
|
-
:type: :file
|
164
|
-
:resource: services/myservice.rb
|
165
|
-
:description: a test service
|
166
|
-
:service: MyServices
|
167
|
-
...
|
110
|
+
logger.info(self.to_s) { "Log me as class method" }
|
168
111
|
|
169
|
-
|
112
|
+
end
|
170
113
|
|
171
|
-
|
172
|
-
require 'rubygems'
|
173
|
-
require 'carioca'
|
114
|
+
end
|
174
115
|
|
175
|
-
registry = Carioca::Services::Registry.init :file => 'config/myservices.registry'
|
176
|
-
service = registry.start_service :name => 'myservice'
|
177
|
-
service.test('titi')
|
178
116
|
```
|
179
117
|
|
180
|
-
|
118
|
+
$ emacs exe/yourgem_cmd
|
181
119
|
|
182
|
-
|
183
|
-
in your app, for debug you could use the Proxy Debug (you need to run Carioca Registry in debug mode ) :
|
184
|
-
(Using "debug_", you create an instance of service debug, so with this syntaxe you could create multiple services instances, with different parameters calling.)
|
120
|
+
content of the file
|
185
121
|
|
186
122
|
```ruby
|
187
|
-
|
188
|
-
require 'carioca'
|
123
|
+
require 'yourgem'
|
189
124
|
|
190
|
-
|
191
|
-
|
192
|
-
proxy1.test('titi')
|
125
|
+
yourgem_cmd = Yourgem::YourgemCMD::new
|
126
|
+
yourgem_cmd.test
|
193
127
|
```
|
194
128
|
|
129
|
+
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 :
|
195
130
|
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
D, [
|
201
|
-
D, [
|
202
|
-
D, [
|
203
|
-
D, [
|
204
|
-
|
131
|
+
$ git add config/ exe/
|
132
|
+
$ rake install && yourgem_cmd
|
133
|
+
yourgem 0.1.0 built to pkg/yourgem-0.1.0.gem.
|
134
|
+
yourgem (0.1.0) installed.
|
135
|
+
D, [2022-03-04T23:11:52.663459 #88808] DEBUG -- Carioca: Preloaded service :i18n on locale : en
|
136
|
+
D, [2022-03-04T23:11:52.663519 #88808] DEBUG -- Carioca: Preloaded service :logger ready on STDOUT
|
137
|
+
D, [2022-03-04T23:11:52.663537 #88808] DEBUG -- Carioca: Initializing Carioca registry
|
138
|
+
D, [2022-03-04T23:11:52.663550 #88808] DEBUG -- Carioca: Preparing builtins services
|
139
|
+
D, [2022-03-04T23:11:52.663580 #88808] DEBUG -- Carioca: Adding service configuration
|
140
|
+
D, [2022-03-04T23:11:52.663609 #88808] DEBUG -- Carioca: Adding service i18n
|
141
|
+
D, [2022-03-04T23:11:52.663649 #88808] DEBUG -- Carioca: Initializing registry from file : ./config/carioca.registry
|
142
|
+
D, [2022-03-04T23:11:52.663773 #88808] DEBUG -- Carioca: Adding service uuid
|
143
|
+
D, [2022-03-04T23:11:52.663794 #88808] DEBUG -- Carioca: Registry initialized successfully
|
144
|
+
I, [2022-03-04T23:11:52.663802 #88808] INFO -- Sample::YourGemCMD: Log me as class method
|
145
|
+
I, [2022-03-04T23:11:52.663813 #88808] INFO -- #<Sample::YourGemCMD:0x00000001312c0bf0>: Log me as an instance method
|
146
|
+
D, [2022-03-04T23:11:52.663844 #88808] DEBUG -- Carioca: Starting service uuid
|
147
|
+
W, [2022-03-04T23:11:52.682812 #88808] WARN -- Sample::YourGemCMD: Give me an UUID : 0505f3f0-7e36-013a-22c7-1e00870a7189
|
205
148
|
|
206
|
-
|
149
|
+
You could see, somme interesting things :
|
150
|
+
* Carioca have an internationalisation service (this service will be explain in detail after):
|
151
|
+
* default configured on :en locale
|
152
|
+
* must be in French (:fr) or English (:en), other traductions are welcome
|
153
|
+
* Carioca have a builtin logger service using regular Logger from Stdlib (also explain in detail in this document)
|
154
|
+
* default logging on STDOUT, but could be redirect in the configure bloc
|
155
|
+
* Carioca give us some usefull traces in debug
|
156
|
+
* Carioca come with a Container Class Template
|
157
|
+
* the Container automatically inject :logger, :i18n and a :configuration service (explain in detail after)
|
158
|
+
* the Container provide a class method macro :inject
|
159
|
+
* this macro give a way to use other services defined in the registry file (service could be register inline, presented after)
|
207
160
|
|
161
|
+
## A step further
|
208
162
|
|
209
|
-
For exemple install uuid gem :
|
210
163
|
|
211
|
-
|
212
|
-
$ gem ins uuid
|
213
|
-
```
|
164
|
+
## Development
|
214
165
|
|
215
|
-
|
216
|
-
|
217
|
-
```yaml
|
218
|
-
uuid:
|
219
|
-
:type: :gem
|
220
|
-
:resource: uuid
|
221
|
-
:description: a Rubygems called uuid to build UUID ids.
|
222
|
-
:service: UUID
|
223
|
-
```
|
224
|
-
|
225
|
-
in your app :
|
226
|
-
|
227
|
-
```ruby
|
228
|
-
require 'rubygems'
|
229
|
-
require 'carioca'
|
230
|
-
|
231
|
-
registry = Carioca::Services::Registry.init :file => 'config/myservices.registry' :debug => true
|
232
|
-
uuid = registry.get_service :name => 'uuid'
|
233
|
-
uuid.generate
|
234
|
-
```
|
166
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
235
167
|
|
236
|
-
|
168
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
237
169
|
|
238
|
-
|
170
|
+
## Contributing
|
239
171
|
|
172
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/Ultragreen/carioca.
|
data/Rakefile
CHANGED
@@ -1,69 +1,8 @@
|
|
1
|
-
|
2
|
-
require "bundler/gem_tasks"
|
3
|
-
require 'rspec'
|
4
|
-
require 'rake'
|
5
|
-
require "rake/clean"
|
6
|
-
require "rubygems/package_task"
|
7
|
-
require "rdoc/task"
|
8
|
-
require 'rspec/core/rake_task'
|
9
|
-
require 'yard'
|
10
|
-
require 'yard/rake/yardoc_task.rb'
|
11
|
-
require "rake/tasklib"
|
12
|
-
require "roodi"
|
13
|
-
require "roodi_task"
|
14
|
-
require 'code_statistics'
|
15
|
-
|
16
|
-
|
17
|
-
RoodiTask.new() do | t |
|
18
|
-
t.patterns = %w(lib/**/*.rb)
|
19
|
-
t.config = "ultragreen_roodi_coding_convention.yml"
|
20
|
-
end
|
21
|
-
|
22
|
-
|
23
|
-
CLEAN.include('*.tmp','*.old')
|
24
|
-
CLOBBER.include('*.tmp', 'build/*','#*#')
|
25
|
-
|
26
|
-
|
27
|
-
content = File::readlines(File.join(File.dirname(__FILE__), 'carioca.gemspec')).join
|
28
|
-
spec = eval(content)
|
29
|
-
|
30
|
-
RSpec::Core::RakeTask.new('spec')
|
1
|
+
# frozen_string_literal: true
|
31
2
|
|
3
|
+
require "bundler/gem_tasks"
|
4
|
+
require "rspec/core/rake_task"
|
32
5
|
|
6
|
+
RSpec::Core::RakeTask.new(:spec)
|
33
7
|
|
34
|
-
|
35
|
-
t.files = [ 'lib/**/*.rb', '-', 'doc/**/*','spec/**/*_spec.rb']
|
36
|
-
t.options += ['--title', "Gem Documentation"]
|
37
|
-
t.options += ['-o', "yardoc"]
|
38
|
-
t.options += ['-r', "doc/manual.rdoc"]
|
39
|
-
end
|
40
|
-
YARD::Config.load_plugin('yard-rspec')
|
41
|
-
|
42
|
-
namespace :yardoc do
|
43
|
-
task :clobber do
|
44
|
-
rm_r "yardoc" rescue nil
|
45
|
-
rm_r ".yardoc" rescue nil
|
46
|
-
end
|
47
|
-
end
|
48
|
-
task :clobber => "yardoc:clobber"
|
49
|
-
|
50
|
-
|
51
|
-
Gem::PackageTask.new(spec) do |pkg|
|
52
|
-
pkg.need_tar = true
|
53
|
-
pkg.need_zip = true
|
54
|
-
end
|
55
|
-
|
56
|
-
Rake::RDocTask.new('rdoc') do |d|
|
57
|
-
d.rdoc_files.include('doc/**/*','bin/*')
|
58
|
-
d.main = 'doc/manual.rdoc'
|
59
|
-
d.title = 'Uglibs : Ultragreen libraries'
|
60
|
-
d.options << '--line-numbers' << '--diagram' << '-SHN'
|
61
|
-
end
|
62
|
-
|
63
|
-
task :default => [:gem]
|
64
|
-
|
65
|
-
task :stage do
|
66
|
-
Rake::Task["clean"].invoke
|
67
|
-
Rake::Task["clobber"].invoke
|
68
|
-
Rake::Task["install"].invoke
|
69
|
-
end
|
8
|
+
task default: :spec
|
data/bin/console
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require "bundler/setup"
|
5
|
+
require "carioca"
|
6
|
+
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
9
|
+
|
10
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
+
# require "pry"
|
12
|
+
# Pry.start
|
13
|
+
|
14
|
+
require "irb"
|
15
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/carioca.gemspec
CHANGED
@@ -1,32 +1,46 @@
|
|
1
|
-
|
2
|
-
s.name = %q{carioca}
|
3
|
-
s.author = "Romain GEORGES"
|
4
|
-
s.version = "1.4"
|
5
|
-
s.license = "BSD-2-Clause"
|
6
|
-
s.summary = %q{Carioca : Configuration Agent and Registry with Inversion Of Control for your Applications}
|
7
|
-
s.email = %q{romain@ultragreen.net}
|
8
|
-
s.homepage = %q{https://github.com/Ultragreen/carioca}
|
9
|
-
s.description = %q{Carioca : provide a full IoC light Container for designing your applications}
|
10
|
-
s.files = `git ls-files`.split($/)
|
1
|
+
# frozen_string_literal: true
|
11
2
|
|
3
|
+
require_relative "lib/carioca/constants"
|
12
4
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
s.add_development_dependency 'code_statistics', '~> 0.2.13'
|
19
|
-
s.add_development_dependency 'yard-rspec', '~> 0.1'
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "carioca"
|
7
|
+
spec.version = Carioca::Constants::VERSION
|
8
|
+
spec.authors = ["Romain GEORGES"]
|
9
|
+
spec.email = ["romain@ultragreen.net"]
|
20
10
|
|
21
11
|
|
22
|
-
s.add_development_dependency 'uuid', '~> 2.3.9'
|
23
12
|
|
24
13
|
|
14
|
+
spec.license = "BSD-3-Clause"
|
15
|
+
|
16
|
+
spec.summary = %q{Carioca : Container And Registry with Inversion Of Control for your Applications}
|
17
|
+
spec.homepage = %q{https://github.com/Ultragreen/carioca}
|
18
|
+
spec.description = %q{Carioca 2: is a complete rewrite who provide a full IoC/DI light Container and a services registry, build with logs, config and Internationalization facilities for designing your applications}
|
19
|
+
|
20
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
21
|
+
|
22
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
23
|
+
|
24
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
25
|
+
spec.metadata["source_code_uri"] = spec.homepage
|
26
|
+
spec.metadata["changelog_uri"] = spec.homepage
|
27
|
+
|
28
|
+
|
29
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
30
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
|
31
|
+
end
|
32
|
+
spec.bindir = "exe"
|
33
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
34
|
+
spec.require_paths = ["lib"]
|
35
|
+
|
36
|
+
# Uncomment to register a new dependency of your gem
|
37
|
+
spec.add_dependency "tty-prompt", "~>0.23.1"
|
38
|
+
spec.add_dependency "pastel", "~>0.8.0"
|
39
|
+
spec.add_dependency 'i18n', "~> 1.10"
|
40
|
+
spec.add_dependency 'locale', "~> 2.1"
|
41
|
+
spec.add_dependency "deep_merge", "~> 1.2"
|
42
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
43
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
25
44
|
|
26
|
-
s.add_dependency 'dorsal', "~> 1.0"
|
27
|
-
s.add_dependency 'methodic', "~> 1.3", '>= 1.3'
|
28
|
-
s.add_dependency 'xml-simple', "~> 1.1", '>= 1.1.5'
|
29
|
-
s.add_dependency 'activesupport', "~> 6.0.2.2"
|
30
|
-
s.required_ruby_version = '>= 1.8.1'
|
31
45
|
|
32
46
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
en:
|
2
|
+
service:
|
3
|
+
adding: "Adding service %{name}"
|
4
|
+
starting: "Starting service %{name}"
|
5
|
+
getting: "Getting service %{name}"
|
6
|
+
depends: "Dependencie service %{name}"
|
7
|
+
notify:
|
8
|
+
locale: "Preloaded service :i18n on locale : %{loc}"
|
9
|
+
logger: "Preloaded service :logger ready on %{target}"
|
10
|
+
useless_entry: "Useless entry in registry (builtin service) %{altered} in %{filename}"
|
11
|
+
init:
|
12
|
+
carioca: "Initializing Carioca registry"
|
13
|
+
builtins: "Preparing builtins services"
|
14
|
+
registry:
|
15
|
+
processing: "Initializing registry from file : %{filename}"
|
16
|
+
success: "Registry initialized successfully"
|
17
|
+
config:
|
18
|
+
load:
|
19
|
+
error: "Config file ignored, error : %{message}"
|
20
|
+
success: "Configuration Service successfully initialized from : %{from}"
|
21
|
+
output:
|
22
|
+
load:
|
23
|
+
context: "Output service initialized in mode : %{confset}"
|