carioca 1.1 → 1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5725ebfdae23b3175784bfc8f961a8ee5d31c455
4
- data.tar.gz: 564985d9a48ab2e72017dca0b08d0c556ae0627b
3
+ metadata.gz: 7452e3def3859f67723245f65eaca57325c02df7
4
+ data.tar.gz: e62a5e8df75b45796408e2b23b8ffa3f7272b9dc
5
5
  SHA512:
6
- metadata.gz: 7690724ad858c0f2a29f48bde4b7dd1674afdc9ed9a3cb0a5adfecb00b55e0338a33ddee6842829783140684f3e3bd2f014eabee48ab07c45f0468ce1d33207d
7
- data.tar.gz: 6a3ab862d8c13fab2ddb0ac9fb7de1fd3ef4d6ce47e83750254e242dc36de6a68eaee9efe720840421744d39540f4c5b7f964b6895983c50b5dc14303bf43b6e
6
+ metadata.gz: da22b8fb540c74436f8a594500a8be39a6f40c5fa449b4354a2499da95b9e67a4557a117a544f11645a67a68178eeb3c3b1c54c52eedea4767a43a78f60ce924
7
+ data.tar.gz: 226b261c12350b1b31729bc42631c7e4ba4f62d6d69de13da218e4daa11c81fdf362082eeb3ab2f7d795f19013609a7fd17dfc21d6cc44cd329c37db04542a45
@@ -1,11 +1,21 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ carioca (1.0)
5
+ dorsal
6
+ methodic
7
+
1
8
  GEM
2
9
  remote: http://rubygems.org/
3
10
  specs:
11
+ code_statistics (0.2.13)
12
+ daemons (1.1.9)
4
13
  diff-lcs (1.2.1)
14
+ dorsal (1.0)
15
+ daemons
5
16
  macaddr (1.6.1)
6
17
  systemu (~> 2.5.0)
7
18
  methodic (1.2)
8
- rake (10.0.4)
9
19
  rdoc (4.0.0)
10
20
  roodi (2.2.0)
11
21
  ruby_parser (~> 2.3.0)
@@ -31,11 +41,14 @@ PLATFORMS
31
41
  ruby
32
42
 
33
43
  DEPENDENCIES
34
- methodic
35
- rake
44
+ carioca!
45
+ code_statistics
36
46
  rdoc
37
47
  roodi
38
48
  rspec
39
49
  uuid
40
50
  yard
41
51
  yard-rspec
52
+
53
+ BUNDLED WITH
54
+ 1.10.3
@@ -1,7 +1,8 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = %q{carioca}
3
3
  s.author = "Romain GEORGES"
4
- s.version = "1.1"
4
+ s.version = "1.3"
5
+ s.license = "BSD-2"
5
6
  s.date = %q{2013-02-18}
6
7
  s.summary = %q{Carioca : Configuration Agent and Registry with Inversion Of Control for your Applications}
7
8
  s.email = %q{romain@ultragreen.net}
@@ -9,17 +10,24 @@ Gem::Specification.new do |s|
9
10
  s.description = %q{Carioca : provide a full IoC light Container for designing your applications}
10
11
  s.has_rdoc = true
11
12
  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')
13
+
14
+ s.add_development_dependency "bundler", "~> 1.5"
15
+ s.add_development_dependency "rake", "~> 10.5"
16
+ s.add_development_dependency 'rspec', '~> 2.14', '>= 2.14.1'
17
+ s.add_development_dependency 'yard', '~> 0.8', '>= 0.8.7.2'
18
+ s.add_development_dependency 'rdoc', '~> 4.0', '>= 4.0.1'
19
+ s.add_development_dependency 'roodi', '~> 3.1', '>= 3.1.1'
20
+ s.add_development_dependency 'code_statistics', '~> 0.2', '>= 0.2.13'
21
+ s.add_development_dependency 'yard-rspec', '~> 0.1'
22
+
23
+
24
+
25
+ s.add_dependency 'dorsal', "~> 1.0"
26
+ s.add_dependency 'methodic', "~> 1.2", '>= 1.2'
27
+ s.add_dependency 'xml-simple', "~> 1.1", '>= 1.1.5'
28
+
21
29
  s.required_ruby_version = '>= 1.8.1'
22
30
  s.rdoc_options << '--title' << 'Carioca : Gem documentation' << '--main' << 'doc/manual.rdoc' << '--line-numbers'
23
31
  # << '--diagram'
24
32
  s.rubyforge_project = "nowarning"
25
- end
33
+ end
@@ -17,9 +17,10 @@
17
17
 
18
18
  require 'rubygems'
19
19
  require 'methodic'
20
- require 'carioca/services'
20
+ require_relative '../services'
21
21
  require 'yaml'
22
22
  require 'drb/drb'
23
+ require 'xmlsimple'
23
24
 
24
25
  # overwriting Hash class
25
26
  # @private
@@ -66,22 +67,35 @@ module Carioca
66
67
  # the name of the config file in YAML format
67
68
  attr_accessor :config_file
68
69
 
69
- # constructor (pre-open the config file in YAML)
70
+ # constructor (pre-open the config file in default:YAML)
70
71
  # @param [Hash] options the options records
71
72
  # @option options [String] :config_file (REQUIRED) the name of the config file
72
73
  # @option options [String] :context a context (root) name to bind in YAML Structure
74
+ # @option options [String] :content a string (xml or yaml) content for configuration
75
+ # @option options [String] :xml_input a boolean if you want load and save in XML
73
76
  def initialize(options = {})
74
77
  @config_file = options[:config_file]
78
+ @xml_input = options[:xml_input]
79
+ @content = options[:content]
75
80
  newsets = {}
76
- if File::exist?(@config_file) then
77
- newsets = YAML::load_file(@config_file).deep_symbolize
78
- newsets = newsets[options[:context].to_sym] if options[:context] && newsets[options[:context].to_sym]
79
- deep_merge!(self, newsets)
81
+ if @config_file then
82
+ @content = File::readlines(@config_file).join if File::exist?(@config_file)
80
83
  end
84
+ if options[:xml_input] then
85
+ newsets = XmlSimple.xml_in( @content, {
86
+ 'ForceArray' => [ 'sequence', 'step' ],
87
+ 'KeepRoot' => true,
88
+ }).deep_symbolize_keys
89
+ else
90
+ newsets = YAML::load(@content).deep_symbolize_keys
91
+ end
92
+ newsets = newsets[options[:context].to_sym] if options[:context] && newsets[options[:context].to_sym]
93
+ deep_merge!(self, newsets)
81
94
  end
82
95
 
83
96
  # save the Hash(self) in the file named by @config_file
84
97
  # @return [TrueClass,FalseClass] true if save! successfull
98
+ # @note TODO save in XML format
85
99
  def save!
86
100
  res = false
87
101
  File.open(@config_file, "w") do |f|
@@ -1,6 +1,7 @@
1
1
  require'rubygems'
2
2
  require'rspec'
3
3
  require 'carioca'
4
+ require 'fileutils'
4
5
 
5
6
  $debug = true
6
7
 
@@ -35,7 +36,7 @@ describe Carioca do
35
36
  carioca1 = Carioca::Services::Registry.init
36
37
  carioca2 = Carioca::Services::Registry.init
37
38
  test = (carioca1.inspect == carioca2.inspect)
38
- test.should be_true
39
+ test.should be true
39
40
  end
40
41
 
41
42
 
@@ -175,7 +176,7 @@ describe Carioca do
175
176
 
176
177
  it "should be saved in other file" do
177
178
  $conf.config_file = '/tmp/.config'
178
- $conf.save!.should be_true
179
+ $conf.save!.should be true
179
180
 
180
181
  end
181
182
  it "should stop the configuration service" do
@@ -221,7 +222,7 @@ describe Carioca do
221
222
  $dummy_dist = subject.start_service :name => 'distdummy'
222
223
  end
223
224
  it "should exist a processus Ring server" do
224
- File::exist?('/tmp/dorsal/ringserver.pid').should be_true
225
+ File::exist?('/tmp/dorsal/ringserver.pid').should be true
225
226
  pid = `ps aux|grep ruby|grep -v grep |grep 'Ultragreen Ring Server'|awk '{ print $2}'`
226
227
  pid.should_not be_empty
227
228
  end
@@ -283,14 +284,14 @@ describe Carioca do
283
284
  context "Distributed Service" do
284
285
  it "should be possible to stop a distributed service" do
285
286
  $dummy_dist = subject.start_service :name => 'distdummy'
286
- subject.stop_service({:name => 'distdummy'}).should be_true
287
+ subject.stop_service({:name => 'distdummy'}).should be true
287
288
  end
288
289
  it "should not exist forked daemon instance for this stopped service" do
289
290
  pid = `ps aux|grep ruby|grep -v grep |grep 'a dummy test service'|awk '{ print $2}'`
290
291
  pid.should be_empty
291
292
  end
292
293
  it "should not exist the pid file of this stopped services" do
293
- File::exist?('/tmp/dorsal/service-distdummy.pid').should be_false
294
+ File::exist?('/tmp/dorsal/service-distdummy.pid').should be false
294
295
  $dummy_dist = subject.start_service :name => 'distdummy'
295
296
  end
296
297
  end
@@ -398,7 +399,7 @@ describe Carioca do
398
399
  prev = subject.registry_filename
399
400
  subject.registry_filename = '/tmp/test.reg'
400
401
  subject.save!
401
- File::exist?('/tmp/test.reg').should be_true
402
+ File::exist?('/tmp/test.reg').should be true
402
403
  subject.registry_filename = prev
403
404
  subject.registry_filename.should eq "spec/config/services.registry"
404
405
  end
@@ -449,6 +450,20 @@ describe Carioca do
449
450
  end
450
451
  end
451
452
  end
453
+ after :all do
454
+ FileUtils.rm_rf("/tmp/log.file")
455
+ File::unlink('/tmp/dorsal/ringserver.pid') if File::exist?('/tmp/dorsal/ringserver.pid')
456
+ File::unlink('/tmp/dorsal/service-distdummy.pid') if File::exist?('/tmp/dorsal/service-distdummy.pid')
457
+ pid = `ps aux|grep ruby|grep -v grep |grep 'Ultragreen Ring Server'|awk '{ print $2}'`
458
+ unless pid.empty? then
459
+ res = `kill -TERM #{pid.chomp}`
460
+ end
461
+ pid = `ps aux|grep ruby|grep -v grep |grep 'a dummy test service'|awk '{ print $2}'`
462
+ unless pid.empty? then
463
+ res = `kill -TERM #{pid.chomp}`
464
+ end
465
+ end
466
+
452
467
  end
453
468
 
454
469
 
@@ -5,7 +5,14 @@
5
5
  #
6
6
  # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
7
7
  RSpec.configure do |config|
8
- config.treat_symbols_as_metadata_keys_with_true_values = true
8
+ # config.treat_symbols_as_metadata_keys_with_true_values = true
9
9
  config.run_all_when_everything_filtered = true
10
10
  # config.filter_run :focus
11
+ config.mock_with :rspec do |c|
12
+ c.syntax = [:should, :expect]
13
+ end
14
+ config.expect_with :rspec do |c|
15
+ c.syntax = [:should, :expect]
16
+ end
11
17
  end
18
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: carioca
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.1'
4
+ version: '1.3'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Romain GEORGES
@@ -11,191 +11,262 @@ cert_chain: []
11
11
  date: 2013-02-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rspec
14
+ name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: '1.5'
20
20
  type: :development
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: '0'
26
+ version: '1.5'
27
27
  - !ruby/object:Gem::Dependency
28
- name: yard
28
+ name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: '10.5'
34
34
  type: :development
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: '0'
40
+ version: '10.5'
41
41
  - !ruby/object:Gem::Dependency
42
- name: rdoc
42
+ name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '2.14'
48
+ - - ">="
46
49
  - !ruby/object:Gem::Version
47
- version: '0'
50
+ version: 2.14.1
48
51
  type: :development
49
52
  prerelease: false
50
53
  version_requirements: !ruby/object:Gem::Requirement
51
54
  requirements:
52
- - - '>='
55
+ - - "~>"
56
+ - !ruby/object:Gem::Version
57
+ version: '2.14'
58
+ - - ">="
53
59
  - !ruby/object:Gem::Version
54
- version: '0'
60
+ version: 2.14.1
55
61
  - !ruby/object:Gem::Dependency
56
- name: roodi
62
+ name: yard
57
63
  requirement: !ruby/object:Gem::Requirement
58
64
  requirements:
59
- - - '>='
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '0.8'
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: 0.8.7.2
71
+ type: :development
72
+ prerelease: false
73
+ version_requirements: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - "~>"
76
+ - !ruby/object:Gem::Version
77
+ version: '0.8'
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: 0.8.7.2
81
+ - !ruby/object:Gem::Dependency
82
+ name: rdoc
83
+ requirement: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - "~>"
86
+ - !ruby/object:Gem::Version
87
+ version: '4.0'
88
+ - - ">="
60
89
  - !ruby/object:Gem::Version
61
- version: '0'
90
+ version: 4.0.1
62
91
  type: :development
63
92
  prerelease: false
64
93
  version_requirements: !ruby/object:Gem::Requirement
65
94
  requirements:
66
- - - '>='
95
+ - - "~>"
67
96
  - !ruby/object:Gem::Version
68
- version: '0'
97
+ version: '4.0'
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ version: 4.0.1
69
101
  - !ruby/object:Gem::Dependency
70
- name: uuid
102
+ name: roodi
71
103
  requirement: !ruby/object:Gem::Requirement
72
104
  requirements:
73
- - - '>='
105
+ - - "~>"
106
+ - !ruby/object:Gem::Version
107
+ version: '3.1'
108
+ - - ">="
74
109
  - !ruby/object:Gem::Version
75
- version: '0'
110
+ version: 3.1.1
76
111
  type: :development
77
112
  prerelease: false
78
113
  version_requirements: !ruby/object:Gem::Requirement
79
114
  requirements:
80
- - - '>='
115
+ - - "~>"
81
116
  - !ruby/object:Gem::Version
82
- version: '0'
117
+ version: '3.1'
118
+ - - ">="
119
+ - !ruby/object:Gem::Version
120
+ version: 3.1.1
83
121
  - !ruby/object:Gem::Dependency
84
122
  name: code_statistics
85
123
  requirement: !ruby/object:Gem::Requirement
86
124
  requirements:
87
- - - '>='
125
+ - - "~>"
126
+ - !ruby/object:Gem::Version
127
+ version: '0.2'
128
+ - - ">="
88
129
  - !ruby/object:Gem::Version
89
- version: '0'
130
+ version: 0.2.13
90
131
  type: :development
91
132
  prerelease: false
92
133
  version_requirements: !ruby/object:Gem::Requirement
93
134
  requirements:
94
- - - '>='
135
+ - - "~>"
136
+ - !ruby/object:Gem::Version
137
+ version: '0.2'
138
+ - - ">="
95
139
  - !ruby/object:Gem::Version
96
- version: '0'
140
+ version: 0.2.13
97
141
  - !ruby/object:Gem::Dependency
98
142
  name: yard-rspec
99
143
  requirement: !ruby/object:Gem::Requirement
100
144
  requirements:
101
- - - '>='
145
+ - - "~>"
102
146
  - !ruby/object:Gem::Version
103
- version: '0'
147
+ version: '0.1'
104
148
  type: :development
105
149
  prerelease: false
106
150
  version_requirements: !ruby/object:Gem::Requirement
107
151
  requirements:
108
- - - '>='
152
+ - - "~>"
109
153
  - !ruby/object:Gem::Version
110
- version: '0'
154
+ version: '0.1'
111
155
  - !ruby/object:Gem::Dependency
112
156
  name: dorsal
113
157
  requirement: !ruby/object:Gem::Requirement
114
158
  requirements:
115
- - - '>='
159
+ - - "~>"
116
160
  - !ruby/object:Gem::Version
117
- version: '0'
161
+ version: '1.0'
118
162
  type: :runtime
119
163
  prerelease: false
120
164
  version_requirements: !ruby/object:Gem::Requirement
121
165
  requirements:
122
- - - '>='
166
+ - - "~>"
123
167
  - !ruby/object:Gem::Version
124
- version: '0'
168
+ version: '1.0'
125
169
  - !ruby/object:Gem::Dependency
126
170
  name: methodic
127
171
  requirement: !ruby/object:Gem::Requirement
128
172
  requirements:
129
- - - '>='
173
+ - - "~>"
130
174
  - !ruby/object:Gem::Version
131
- version: '0'
175
+ version: '1.2'
176
+ - - ">="
177
+ - !ruby/object:Gem::Version
178
+ version: '1.2'
132
179
  type: :runtime
133
180
  prerelease: false
134
181
  version_requirements: !ruby/object:Gem::Requirement
135
182
  requirements:
136
- - - '>='
183
+ - - "~>"
184
+ - !ruby/object:Gem::Version
185
+ version: '1.2'
186
+ - - ">="
137
187
  - !ruby/object:Gem::Version
138
- version: '0'
188
+ version: '1.2'
189
+ - !ruby/object:Gem::Dependency
190
+ name: xml-simple
191
+ requirement: !ruby/object:Gem::Requirement
192
+ requirements:
193
+ - - "~>"
194
+ - !ruby/object:Gem::Version
195
+ version: '1.1'
196
+ - - ">="
197
+ - !ruby/object:Gem::Version
198
+ version: 1.1.5
199
+ type: :runtime
200
+ prerelease: false
201
+ version_requirements: !ruby/object:Gem::Requirement
202
+ requirements:
203
+ - - "~>"
204
+ - !ruby/object:Gem::Version
205
+ version: '1.1'
206
+ - - ">="
207
+ - !ruby/object:Gem::Version
208
+ version: 1.1.5
139
209
  description: 'Carioca : provide a full IoC light Container for designing your applications'
140
210
  email: romain@ultragreen.net
141
211
  executables: []
142
212
  extensions: []
143
213
  extra_rdoc_files: []
144
214
  files:
145
- - lib/carioca/tasks/rake.rb
146
- - lib/carioca/tasks/registry_init.rake
215
+ - AUTHORS
216
+ - COPYRIGHT
217
+ - ChangeLog
218
+ - Gemfile
219
+ - Gemfile.lock
220
+ - INSTALL
221
+ - README.md
222
+ - Rakefile
223
+ - carioca.gemspec
224
+ - doc/manual.rdoc
225
+ - lib/carioca.rb
226
+ - lib/carioca/exceptions.rb
227
+ - lib/carioca/helpers.rb
228
+ - lib/carioca/private.rb
229
+ - lib/carioca/services.rb
147
230
  - lib/carioca/services/configuration.rb
148
231
  - lib/carioca/services/debug.rb
149
232
  - lib/carioca/services/logger.rb
150
- - spec/samples/dummy.rb
151
- - spec/samples/requireddummy.rb
152
- - spec/samples/otherdummy.rb
233
+ - lib/carioca/tasks/rake.rb
234
+ - lib/carioca/tasks/registry_init.rake
235
+ - spec/carioca_spec.rb
153
236
  - spec/config/services.registry
154
- - lib/carioca/services.rb
155
- - lib/carioca/private.rb
156
- - lib/carioca/exceptions.rb
157
- - lib/carioca/helpers.rb
158
- - doc/manual.rdoc
159
237
  - spec/init_spec.rb
238
+ - spec/samples/dummy.rb
239
+ - spec/samples/otherdummy.rb
240
+ - spec/samples/requireddummy.rb
160
241
  - spec/spec_helper.rb
161
- - spec/carioca_spec.rb
162
- - lib/carioca.rb
163
- - Gemfile.lock
164
- - Gemfile
165
- - ChangeLog
166
- - COPYRIGHT
167
- - ultragreen_roodi_coding_convention.yml
168
- - AUTHORS
169
- - README.md
170
242
  - test.rb
171
- - carioca.gemspec
172
- - Rakefile
173
- - INSTALL
243
+ - ultragreen_roodi_coding_convention.yml
174
244
  homepage: http://www.ultragreen.net
175
- licenses: []
245
+ licenses:
246
+ - BSD-2
176
247
  metadata: {}
177
248
  post_install_message:
178
249
  rdoc_options:
179
- - --title
250
+ - "--title"
180
251
  - 'Carioca : Gem documentation'
181
- - --main
252
+ - "--main"
182
253
  - doc/manual.rdoc
183
- - --line-numbers
254
+ - "--line-numbers"
184
255
  require_paths:
185
256
  - lib
186
257
  required_ruby_version: !ruby/object:Gem::Requirement
187
258
  requirements:
188
- - - '>='
259
+ - - ">="
189
260
  - !ruby/object:Gem::Version
190
261
  version: 1.8.1
191
262
  required_rubygems_version: !ruby/object:Gem::Requirement
192
263
  requirements:
193
- - - '>='
264
+ - - ">="
194
265
  - !ruby/object:Gem::Version
195
266
  version: '0'
196
267
  requirements: []
197
268
  rubyforge_project: nowarning
198
- rubygems_version: 2.0.7
269
+ rubygems_version: 2.4.7
199
270
  signing_key:
200
271
  specification_version: 4
201
272
  summary: 'Carioca : Configuration Agent and Registry with Inversion Of Control for