carioca 1.1 → 2.0.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 (57) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/main.yml +18 -0
  3. data/.gitignore +11 -0
  4. data/.rspec +3 -0
  5. data/Gemfile +6 -1
  6. data/Gemfile.lock +42 -34
  7. data/README.md +12 -220
  8. data/Rakefile +5 -59
  9. data/bin/console +15 -0
  10. data/bin/setup +8 -0
  11. data/carioca.gemspec +41 -25
  12. data/config/locales/en.yml +15 -0
  13. data/config/locales/fr.yml +19 -0
  14. data/lib/carioca/configuration.rb +47 -0
  15. data/lib/carioca/constants.rb +45 -0
  16. data/lib/carioca/container.rb +16 -0
  17. data/lib/carioca/dependencies.rb +19 -0
  18. data/lib/carioca/helpers.rb +44 -31
  19. data/lib/carioca/mixin.rb +32 -0
  20. data/lib/carioca/{tasks/rake.rb → rake/manage.rb} +4 -6
  21. data/lib/carioca/rake/tasks/registry.tasks +57 -0
  22. data/lib/carioca/registry.rb +93 -0
  23. data/lib/carioca/registry_file.rb +62 -0
  24. data/lib/carioca/services/config.rb +140 -0
  25. data/lib/carioca/services/i18n.rb +20 -0
  26. data/lib/carioca/services/init.rb +2 -0
  27. data/lib/carioca/validator.rb +49 -0
  28. data/lib/carioca.rb +2 -319
  29. data/samples/Rakefile +2 -0
  30. data/samples/config/carioca.registry +22 -0
  31. data/samples/config/locales/en.yml +2 -0
  32. data/samples/config/locales/es.yml +2 -0
  33. data/samples/config/locales/fr.yml +2 -0
  34. data/samples/config/settings.yml +24 -0
  35. data/samples/test.rb +71 -0
  36. metadata +59 -152
  37. data/AUTHORS +0 -8
  38. data/COPYRIGHT +0 -24
  39. data/ChangeLog +0 -7
  40. data/INSTALL +0 -7
  41. data/doc/manual.rdoc +0 -225
  42. data/lib/carioca/exceptions.rb +0 -9
  43. data/lib/carioca/private.rb +0 -170
  44. data/lib/carioca/services/configuration.rb +0 -187
  45. data/lib/carioca/services/debug.rb +0 -73
  46. data/lib/carioca/services/logger.rb +0 -58
  47. data/lib/carioca/services.rb +0 -143
  48. data/lib/carioca/tasks/registry_init.rake +0 -11
  49. data/spec/carioca_spec.rb +0 -459
  50. data/spec/config/services.registry +0 -55
  51. data/spec/init_spec.rb +0 -1
  52. data/spec/samples/dummy.rb +0 -10
  53. data/spec/samples/otherdummy.rb +0 -10
  54. data/spec/samples/requireddummy.rb +0 -10
  55. data/spec/spec_helper.rb +0 -11
  56. data/test.rb +0 -12
  57. data/ultragreen_roodi_coding_convention.yml +0 -25
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 5725ebfdae23b3175784bfc8f961a8ee5d31c455
4
- data.tar.gz: 564985d9a48ab2e72017dca0b08d0c556ae0627b
2
+ SHA256:
3
+ metadata.gz: c349ebcb566a9571f7cd424b6cb3a95dd3b6871a99caf992ac04af996a35259a
4
+ data.tar.gz: d4f4a5db811c978fe0390f41a757a352452c844f72775c21435c6ca1656213c1
5
5
  SHA512:
6
- metadata.gz: 7690724ad858c0f2a29f48bde4b7dd1674afdc9ed9a3cb0a5adfecb00b55e0338a33ddee6842829783140684f3e3bd2f014eabee48ab07c45f0468ce1d33207d
7
- data.tar.gz: 6a3ab862d8c13fab2ddb0ac9fb7de1fd3ef4d6ce47e83750254e242dc36de6a68eaee9efe720840421744d39540f4c5b7f964b6895983c50b5dc14303bf43b6e
6
+ metadata.gz: d05baa11c7379fe052161140fef4a17dd075ce2998c600ad5023d947edf76769fe2020829438863bc4adf4ee4c62f50da2bfb73c2937a5837fe6a48be87de1fb
7
+ data.tar.gz: 1e12daba542a3e103205f1f7f7fcd71f82a924b2e247fc48ca6a0ee0feb9e4fca85e3a22d2b6baf9c2b7c705b6ef71d0e70611cd9509928eb25584b423a8578a
@@ -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
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/Gemfile CHANGED
@@ -1,4 +1,9 @@
1
- source "http://rubygems.org"
1
+ source "https://rubygems.org"
2
2
 
3
3
  gemspec
4
4
 
5
+ gem "rake", "~> 13.0"
6
+ gem "rspec", "~> 3.0"
7
+ gem 'i18n', "~> 1.10"
8
+ gem 'locale', "~> 2.1"
9
+ gem "deep_merge", "~> 1.2"
data/Gemfile.lock CHANGED
@@ -1,41 +1,49 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ carioca (2.0.0)
5
+ tty-prompt (~> 0.23.1)
6
+
1
7
  GEM
2
- remote: http://rubygems.org/
8
+ remote: https://rubygems.org/
3
9
  specs:
4
- diff-lcs (1.2.1)
5
- macaddr (1.6.1)
6
- systemu (~> 2.5.0)
7
- methodic (1.2)
8
- rake (10.0.4)
9
- rdoc (4.0.0)
10
- roodi (2.2.0)
11
- ruby_parser (~> 2.3.0)
12
- rspec (2.13.0)
13
- rspec-core (~> 2.13.0)
14
- rspec-expectations (~> 2.13.0)
15
- rspec-mocks (~> 2.13.0)
16
- rspec-core (2.13.1)
17
- rspec-expectations (2.13.0)
18
- diff-lcs (>= 1.1.3, < 2.0)
19
- rspec-mocks (2.13.0)
20
- ruby_parser (2.3.1)
21
- sexp_processor (~> 3.0)
22
- sexp_processor (3.2.0)
23
- systemu (2.5.2)
24
- uuid (2.3.7)
25
- macaddr (~> 1.0)
26
- yard (0.8.5.2)
27
- yard-rspec (0.1)
28
- yard
10
+ diff-lcs (1.5.0)
11
+ pastel (0.8.0)
12
+ tty-color (~> 0.5)
13
+ rake (13.0.6)
14
+ rspec (3.9.0)
15
+ rspec-core (~> 3.9.0)
16
+ rspec-expectations (~> 3.9.0)
17
+ rspec-mocks (~> 3.9.0)
18
+ rspec-core (3.9.3)
19
+ rspec-support (~> 3.9.3)
20
+ rspec-expectations (3.9.4)
21
+ diff-lcs (>= 1.2.0, < 2.0)
22
+ rspec-support (~> 3.9.0)
23
+ rspec-mocks (3.9.1)
24
+ diff-lcs (>= 1.2.0, < 2.0)
25
+ rspec-support (~> 3.9.0)
26
+ rspec-support (3.9.4)
27
+ tty-color (0.6.0)
28
+ tty-cursor (0.7.1)
29
+ tty-prompt (0.23.1)
30
+ pastel (~> 0.8)
31
+ tty-reader (~> 0.8)
32
+ tty-reader (0.9.0)
33
+ tty-cursor (~> 0.7)
34
+ tty-screen (~> 0.8)
35
+ wisper (~> 2.0)
36
+ tty-screen (0.8.1)
37
+ wisper (2.0.1)
29
38
 
30
39
  PLATFORMS
40
+ arm64-darwin-20
31
41
  ruby
32
42
 
33
43
  DEPENDENCIES
34
- methodic
35
- rake
36
- rdoc
37
- roodi
38
- rspec
39
- uuid
40
- yard
41
- yard-rspec
44
+ carioca!
45
+ rake (~> 13.0)
46
+ rspec (~> 3.0)
47
+
48
+ BUNDLED WITH
49
+ 2.2.3
data/README.md CHANGED
@@ -1,239 +1,31 @@
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
- In a valid Ruby environment :
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 :
47
-
48
- ```
49
- $ gem ins bundler # if needed
50
- $ bunlde gem myapp
51
- $ cd myapp
52
- ```
53
-
54
- Edit your myapp.gemspec, add this line in Gem::Specification bloc :
55
-
56
- ```ruby
57
- gem.add_dependency 'carioca'
58
- gem.add_development_dependency 'rake'
59
- gem.add_development_dependency 'carioca'
60
- ```
61
-
62
- Description and summary need to be changed to be correctly displayed on Rubygems.
63
-
64
- so, execute bundle :
65
-
66
- ```
67
- $ bundle
68
- ```
69
-
70
- Your environment, is ready to create your app
71
-
72
- #### Prepare Carioca
73
-
74
- ```
75
- $ mkdir config
76
- $ mkdir bin
77
- ```
78
-
79
- edit bin/myapp :
80
-
81
- ```ruby
82
- require 'rubygems'
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
-
92
- ```
93
- $ ruby -e 'require "rubygems"; require "carioca"; reg = Carioca::Services::Registry.init :file => "config/myservices.registry"; reg.discover_builtins; reg.save!'
94
- ```
95
-
96
-
97
- this create you, a New Registry config, with all builtins registered.
98
- Default path :
99
- * config file : ./.config
100
- * log file : /tmp/log.file
101
- Carioca Registry is a Singleton, and services also be unique instance.
102
-
103
- Now you could continue coding your bin/myapp
104
-
105
- #### Using Configuration Service
106
-
107
- ```ruby
108
- require 'rubygems'
109
- require 'carioca'
110
-
111
- registry = Carioca::Services::Registry.init :file => 'config/myservices.registry'
112
- config = registry.start_service :name => 'configuration'
113
- config.setings.db = { :name => 'mydb' }
114
- config.settings.db.host = "myhost"
115
- config.settings.db.port = "4545"
116
- config.settings.email = "my@email.com"
117
- config.save!
118
- ```
119
-
120
- #### Using Logger Service
121
-
122
- logger is automatically loaded with Carioca, loading registry with :debug => true, let you see the Carioca traces.
123
-
124
- ```ruby
125
- require 'rubygems'
126
- require 'carioca'
127
-
128
- registry = Carioca::Services::Registry.init :file => 'config/myservices.registry' :debug => true
129
- log = registry.get_service :name => 'logger'
130
- log.info('myapp') {'my message' }
131
- ```
132
-
133
- #### Creating and using your own service
134
-
135
- before create your own service :
136
-
137
- ```
138
- $ mkdir services
139
- ```
140
-
141
- Services, must be a class, if not do a wrapper
142
- edit services/myservice.rb
143
-
144
- ```ruby
145
- class MyService
146
- def initialize
147
- end
148
-
149
- def test(arg = nil)
150
- return 'OK'
151
- end
152
- end
153
- end
154
- ```
155
-
156
- You could use the #service_register API (See spec for all details)
157
- but, you could write it directly in YAML in your config/myservices.registry :
158
- add the following lines :
159
-
160
- ```yaml
161
- ...
162
- myservice:
163
- :type: :file
164
- :resource: services/myservice.rb
165
- :description: a test service
166
- :service: MyServices
167
- ...
168
-
169
- So in your app :
170
-
171
- ```ruby
172
- require 'rubygems'
173
- require 'carioca'
174
-
175
- registry = Carioca::Services::Registry.init :file => 'config/myservices.registry'
176
- service = registry.start_service :name => 'myservice'
177
- service.test('titi')
178
- ```
179
-
180
- #### Using Debug in multiple service instance
181
-
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.)
5
+ Add this line to your application's Gemfile:
185
6
 
186
7
  ```ruby
187
- require 'rubygems'
188
- require 'carioca'
189
-
190
- registry = Carioca::Services::Registry.init :file => 'config/myservices.registry' :debug => true
191
- proxy1 = registry.get_service :name => 'debug_myservice', :params => {:service => 'myservice'}
192
- proxy1.test('titi')
8
+ gem 'carioca'
193
9
  ```
194
10
 
11
+ And then execute:
195
12
 
196
- see the log /tmp/log.file :
13
+ $ bundle install
197
14
 
198
- ```
199
- D, [2013-03-23T18:20:39.839826 #76641] DEBUG -- ProxyDebug: BEGIN CALL for mapped service myservice
200
- D, [2013-03-23T18:20:39.839875 #76641] DEBUG -- ProxyDebug: called: test
201
- D, [2013-03-23T18:20:39.839920 #76641] DEBUG -- ProxyDebug: args : titi
202
- D, [2013-03-23T18:20:39.839970 #76641] DEBUG -- ProxyDebug: => returned: OK
203
- D, [2013-03-23T18:20:39.840014 #76641] DEBUG -- ProxyDebug: END CALL
204
- ```
15
+ Or install it yourself as:
205
16
 
206
- #### Using Gem for a service
17
+ $ gem install carioca
207
18
 
19
+ ## Usage
208
20
 
209
- For exemple install uuid gem :
210
21
 
211
- ```
212
- $ gem ins uuid
213
- ```
214
22
 
215
- add to your YAML config config/myservices.registry :
23
+ ## Development
216
24
 
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
- ```
25
+ 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
26
 
236
- == Copyright
27
+ 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
28
 
238
- <pre>carioca (c) 2012-2013 Romain GEORGES <romain@ultragreen.net> for Ultragreen Software </pre>
29
+ ## Contributing
239
30
 
31
+ Bug reports and pull requests are welcome on GitHub at https://github.com/Ultragreen/carioca.
data/Rakefile CHANGED
@@ -1,62 +1,8 @@
1
- require 'rubygems'
1
+ # frozen_string_literal: true
2
2
 
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
-
15
-
16
- RoodiTask.new() do | t |
17
- t.patterns = %w(lib/**/*.rb)
18
- t.config = "ultragreen_roodi_coding_convention.yml"
19
- end
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
20
5
 
6
+ RSpec::Core::RakeTask.new(:spec)
21
7
 
22
- CLEAN.include('*.tmp','*.old')
23
- CLOBBER.include('*.tmp', 'build/*','#*#')
24
-
25
-
26
- content = File::readlines(File.join(File.dirname(__FILE__), 'carioca.gemspec')).join
27
- spec = eval(content)
28
-
29
- RSpec::Core::RakeTask.new('spec')
30
-
31
-
32
-
33
- YARD::Rake::YardocTask.new do |t|
34
- t.files = [ 'lib/**/*.rb', '-', 'doc/**/*','spec/**/*_spec.rb']
35
- t.options += ['--title', "Gem Documentation"]
36
- t.options += ['-o', "yardoc"]
37
- t.options += ['-r', "doc/manual.rdoc"]
38
- end
39
- YARD::Config.load_plugin('yard-rspec')
40
-
41
- namespace :yardoc do
42
- task :clobber do
43
- rm_r "yardoc" rescue nil
44
- rm_r ".yardoc" rescue nil
45
- end
46
- end
47
- task :clobber => "yardoc:clobber"
48
-
49
-
50
- Gem::PackageTask.new(spec) do |pkg|
51
- pkg.need_tar = true
52
- pkg.need_zip = true
53
- end
54
-
55
- Rake::RDocTask.new('rdoc') do |d|
56
- d.rdoc_files.include('doc/**/*','bin/*')
57
- d.main = 'doc/manual.rdoc'
58
- d.title = 'Uglibs : Ultragreen libraries'
59
- d.options << '--line-numbers' << '--diagram' << '-SHN'
60
- end
61
-
62
- task :default => [:gem]
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
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/carioca.gemspec CHANGED
@@ -1,25 +1,41 @@
1
- Gem::Specification.new do |s|
2
- s.name = %q{carioca}
3
- s.author = "Romain GEORGES"
4
- s.version = "1.1"
5
- s.date = %q{2013-02-18}
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{http://www.ultragreen.net}
9
- s.description = %q{Carioca : provide a full IoC light Container for designing your applications}
10
- s.has_rdoc = true
11
- s.files = Dir['*/*/*/*'] + Dir['*/*/*'] + Dir['*/*'] + Dir['*']
12
- s.add_development_dependency('rspec')
13
- s.add_development_dependency('yard')
14
- s.add_development_dependency('rdoc')
15
- s.add_development_dependency('roodi')
16
- s.add_development_dependency('uuid')
17
- s.add_development_dependency('code_statistics')
18
- s.add_development_dependency('yard-rspec')
19
- s.add_dependency('dorsal')
20
- s.add_dependency('methodic')
21
- s.required_ruby_version = '>= 1.8.1'
22
- s.rdoc_options << '--title' << 'Carioca : Gem documentation' << '--main' << 'doc/manual.rdoc' << '--line-numbers'
23
- # << '--diagram'
24
- s.rubyforge_project = "nowarning"
25
- end
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/carioca/constants"
4
+
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"]
10
+
11
+
12
+
13
+
14
+ spec.license = "BSD-3-Clause"
15
+
16
+ spec.summary = %q{Carioca : Configuration Agent and Registry with Inversion Of Control for your Applications}
17
+ spec.homepage = %q{https://github.com/Ultragreen/carioca}
18
+ spec.description = %q{Carioca : provide a full IoC light Container 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
+
40
+
41
+ end
@@ -0,0 +1,15 @@
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
+ init:
11
+ carioca: "Initializing Carioca registry"
12
+ builtins: "Preparing builtins services"
13
+ registry:
14
+ processing: "Initializing registry from file : %{filename}"
15
+ success: "Registry initialized successfully"
@@ -0,0 +1,19 @@
1
+ fr:
2
+ service:
3
+ adding: "Service %{name} Ajouté"
4
+ starting: "Démarrage du service %{name}"
5
+ getting: "Appel du service %{name}"
6
+ depends: "Dépendence du service %{name}"
7
+ notify:
8
+ locale: "Service pré-chargé :i18n sur la locale : %{loc}"
9
+ logger: "Service pré-chargé :logger sur la cible : %{target}"
10
+ useless_entry: "Entrée inutile dans le registre (service pré-defini) %{altered} dans %{filename}"
11
+ init:
12
+ carioca: "Initialisation du registre Carioca"
13
+ builtins: "Préparation des services pré-définis"
14
+ registry:
15
+ processing: "Initialisation du registre depuis le fichier : %{filename}"
16
+ success: "Registre initialisé avec succès"
17
+ config:
18
+ load:
19
+ error: "Fichier de configuration ignoré, erreur : %{message}"
@@ -0,0 +1,47 @@
1
+ module Carioca
2
+ class Configuration
3
+ include Carioca::Constants
4
+ include Carioca::Helpers
5
+ attr_accessor :filename, :name, :builtins, :log_target, :default_locale, :locales_load_path
6
+ attr_accessor :config_file, :config_root, :environment, :supported_environment
7
+ attr_writer :debug, :init_from_file
8
+ attr_reader :log_file, :locales_availables
9
+ def initialize
10
+ @init_from_file = true
11
+ @filename = DEFAULT_REGISTRY_FILE.dup
12
+ @debug = false
13
+ @name = 'Carioca'
14
+ @builtins = BUILTINS
15
+ @log_file = ''
16
+ @config_file = DEFAULT_CONFIG_FILE.dup
17
+ @environment = DEFAULT_ENVIRONMENT.dup
18
+ @config_root = DEFAULT_CONFIG_ROOT.dup
19
+ @log_target = '::Logger::new(STDOUT)'
20
+ @supported_environment = DEFAULT_ENVIRONMENTS_LIST.dup
21
+ @default_locale = DEFAULT_LOCALE
22
+ @locales_availables = []
23
+ path = search_file_in_gem('carioca',"config/locales")
24
+ @locales_load_path = Dir[File.expand_path(path) + "/*.yml"]
25
+ Dir[path + '/*.yml'].sort.each do |file|
26
+ @locales_availables.push File::basename(file,'.yml').to_sym
27
+ end
28
+ end
29
+
30
+ def debug?
31
+ return @debug
32
+ end
33
+
34
+ def init_from_file?
35
+ return @init_from_file
36
+ end
37
+
38
+ def log_file?
39
+ return !@log_file.empty?
40
+ end
41
+
42
+ def log_file=(name)
43
+ @log_file = name
44
+ @log_target = "::Logger::new('#{name}')"
45
+ end
46
+ end
47
+ end