dorsal 1.2 → 1.3
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.
- checksums.yaml +5 -5
- data/Rakefile +7 -1
- data/dorsal.gemspec +3 -6
- data/lib/dorsal/implementation.rb +16 -16
- data/lib/dorsal/privates.rb +4 -4
- data/lib/dorsal/version.rb +1 -1
- data/spec/dorsal_spec.rb +24 -23
- data/ultragreen_roodi_coding_convention.yml +4 -4
- metadata +14 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 17aed30994068bc642a06e371081599f8793ba046fc98a5e8f72443114a79036
|
4
|
+
data.tar.gz: d93c0e8c4ae70b50e4d633d0328585d9c14b32048b49576830f577a9e1939a07
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f879ec0cfda000f3f743545e58138945245bb42515ff39999585ab4f06f19e1f0fcf59fd9e094a5fbb33497616b4e68ff38d0bb2bee0f0d5c28ce85a1e94c79b
|
7
|
+
data.tar.gz: b26178a503329071a11ecd56ac8cef3a6f4bf5961ad8148c58a1b5f3cce6a5ed4237ef0a11540a572f4c7321c9aa72553705f569f39f58f203434e64800476b6
|
data/Rakefile
CHANGED
@@ -58,4 +58,10 @@ Rake::RDocTask.new('rdoc') do |d|
|
|
58
58
|
d.options << '--line-numbers' << '--diagram' << '-SHN'
|
59
59
|
end
|
60
60
|
|
61
|
-
task :default => [:gem]
|
61
|
+
task :default => [:gem]
|
62
|
+
|
63
|
+
task :stage do
|
64
|
+
Rake::Task["clean"].invoke
|
65
|
+
Rake::Task["clobber"].invoke
|
66
|
+
Rake::Task["install"].invoke
|
67
|
+
end
|
data/dorsal.gemspec
CHANGED
@@ -11,23 +11,20 @@ Gem::Specification.new do |spec|
|
|
11
11
|
spec.description = %q{Dorsal : Druby Objects's Ring Server as an simple Alternative to Linda}
|
12
12
|
spec.summary = %q{Dorsal provide a simple and easy to use Ring Server for DRuby Objects based services architectures}
|
13
13
|
spec.homepage = "http://www.ultragreen.net/projects/dorsal"
|
14
|
-
spec.license = "BSD"
|
14
|
+
spec.license = "BSD-2-Clause"
|
15
15
|
|
16
16
|
spec.files = `git ls-files`.split($/)
|
17
17
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
|
-
spec.add_development_dependency('methodic', '>= 1.
|
20
|
+
spec.add_development_dependency('methodic', '>= 1.3')
|
21
21
|
spec.add_development_dependency('rspec')
|
22
22
|
spec.add_development_dependency('yard')
|
23
23
|
spec.add_development_dependency('rdoc')
|
24
24
|
spec.add_development_dependency('roodi')
|
25
|
+
spec.add_development_dependency('rake')
|
25
26
|
spec.add_development_dependency('code_statistics')
|
26
27
|
spec.add_development_dependency('yard-rspec')
|
27
|
-
spec.add_development_dependency "bundler", "~> 1.3"
|
28
28
|
spec.add_dependency "daemons"
|
29
29
|
|
30
|
-
spec.required_ruby_version = '>= 1.8.1'
|
31
|
-
spec.rubyforge_project = "nowarning"
|
32
|
-
spec.has_rdoc = true
|
33
30
|
end
|
@@ -10,20 +10,20 @@ require 'dorsal/privates'
|
|
10
10
|
|
11
11
|
# the dorsal namespace
|
12
12
|
module Dorsal
|
13
|
-
|
13
|
+
|
14
14
|
# the Ring Server DRbObject Implementation
|
15
15
|
# @note should NOT be instantiate
|
16
|
-
# @note this classe is made to be instantiate as a ring server
|
16
|
+
# @note this classe is made to be instantiate as a ring server
|
17
17
|
# @private
|
18
18
|
class ImplementationServer
|
19
|
-
|
19
|
+
|
20
20
|
include DRbUndumped
|
21
21
|
include Dorsal::Privates
|
22
|
-
|
22
|
+
|
23
23
|
# @attr_reader [Hash] data the internal Hash of the ring server
|
24
24
|
# @note for debug only
|
25
25
|
attr_reader :data
|
26
|
-
|
26
|
+
|
27
27
|
# the contructor of the Ring Server
|
28
28
|
# @param [Hash] _options the params of the constructor, keys must be symbols
|
29
29
|
# @note :description (default) 'Dorsal::DEFAULT_RINGSERVER_DESCRIPTION'
|
@@ -32,10 +32,10 @@ module Dorsal
|
|
32
32
|
# @note :port (default) 'Dorsal::DEFAULT_PORT'
|
33
33
|
# @note :dir (default) 'Dorsal::DEFAULT_DIR'
|
34
34
|
# @note :name (default) 'Dorsal::DEFAULT_RINGSERVER_NAME'
|
35
|
-
# @note :uri rule 'druby://(:host):(:port)'
|
36
|
-
# @note :pid_file rule '(:dir)/(:name).pid'
|
37
|
-
# @option _options [String] :description the description of ring server
|
38
|
-
# @option _options [TrueClass,FalseClass] :debug the deubg mode
|
35
|
+
# @note :uri rule 'druby://(:host):(:port)'
|
36
|
+
# @note :pid_file rule '(:dir)/(:name).pid'
|
37
|
+
# @option _options [String] :description the description of ring server
|
38
|
+
# @option _options [TrueClass,FalseClass] :debug the deubg mode
|
39
39
|
# @option _options [String] :host the host for ring server and services
|
40
40
|
# @option _options [String] :port the port for the ring server
|
41
41
|
# @option _options [String] :dir the writable path for pids files
|
@@ -58,8 +58,8 @@ module Dorsal
|
|
58
58
|
# @return [Fixnum,FalseClass] the pid of the process who host the DRb service, false if already started
|
59
59
|
# @param [Hash] _options the params of the constructor, keys must be symbols
|
60
60
|
# @option _options [String] :name the name of the service
|
61
|
-
# @option _options [String] :description the long name of the service, use for $0
|
62
|
-
# @option _options [Object] :object an object to be served by DRb
|
61
|
+
# @option _options [String] :description the long name of the service, use for $0
|
62
|
+
# @option _options [Object] :object an object to be served by DRb
|
63
63
|
# @note access by Dorsal::Controller::new.bind_to_ring.start_service
|
64
64
|
# @example usage
|
65
65
|
# Dorsal::Controller::new.bind_to_ring.start_service :name => 'service', :description => 'a service', :object => MyService::new
|
@@ -79,10 +79,10 @@ module Dorsal
|
|
79
79
|
end
|
80
80
|
else
|
81
81
|
return false
|
82
|
-
end
|
82
|
+
end
|
83
83
|
end
|
84
|
-
|
85
|
-
# stop a service in the ring
|
84
|
+
|
85
|
+
# stop a service in the ring
|
86
86
|
# @return [TrueClass,FalseClass] true if really stop, false if already down
|
87
87
|
# @param [Hash] _options the params of the constructor, keys must be symbols
|
88
88
|
# @option _options [String] :name the name of the service
|
@@ -97,7 +97,7 @@ module Dorsal
|
|
97
97
|
options[:pid_file] = @data[options[:name]][:pid_file]
|
98
98
|
options[:description] = @data[options[:name]][:description]
|
99
99
|
if stop(options) then
|
100
|
-
@data.delete(options[:name])
|
100
|
+
@data.delete(options[:name])
|
101
101
|
return true
|
102
102
|
end
|
103
103
|
return false
|
@@ -146,6 +146,6 @@ module Dorsal
|
|
146
146
|
end
|
147
147
|
return false
|
148
148
|
end
|
149
|
-
|
149
|
+
|
150
150
|
end
|
151
151
|
end
|
data/lib/dorsal/privates.rb
CHANGED
@@ -61,9 +61,9 @@ module Dorsal
|
|
61
61
|
options.validate
|
62
62
|
return yield if options[:debug]
|
63
63
|
pid = fork do
|
64
|
-
trap("SIGINT"){
|
65
|
-
trap("SIGTERM"){
|
66
|
-
trap("SIGHUP"){
|
64
|
+
trap("SIGINT"){ eit! 0 }
|
65
|
+
trap("SIGTERM"){ eit! 0 }
|
66
|
+
trap("SIGHUP"){ eit! 0 }
|
67
67
|
Process.daemon
|
68
68
|
$0 = options[:description]
|
69
69
|
yield
|
@@ -143,7 +143,7 @@ module Dorsal
|
|
143
143
|
options.specify_presences_of :description, :pid_file
|
144
144
|
options.validate
|
145
145
|
File::unlink(options[:pid_file]) if File::exist?(options[:pid_file])
|
146
|
-
pid = `COLUMNS=160 ps aux|grep
|
146
|
+
pid = `COLUMNS=160 ps aux|grep -v grep |grep '#{options[:description]}'|awk '{ print $2}'`
|
147
147
|
if pid.empty? then
|
148
148
|
return false
|
149
149
|
else
|
data/lib/dorsal/version.rb
CHANGED
data/spec/dorsal_spec.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
# -*- coding: utf-8 -*-
|
3
3
|
#---
|
4
4
|
# Author : Romain GEORGES
|
5
|
-
# type : Rspec
|
5
|
+
# type : Rspec
|
6
6
|
# obj : Dorsal Spec
|
7
7
|
#---
|
8
8
|
require 'dorsal'
|
@@ -28,7 +28,7 @@ end
|
|
28
28
|
describe "Dorsal" do
|
29
29
|
before :all do
|
30
30
|
File::unlink('/tmp/dorsal/ringserver.pid') if File::exist?('/tmp/dorsal/ringserver.pid')
|
31
|
-
pid = `ps aux|grep
|
31
|
+
pid = `ps aux|grep -v grep |grep 'Dorsal Ring Server'|awk '{ print $2}'`
|
32
32
|
unless pid.empty? then
|
33
33
|
res = `kill -TERM #{pid.chomp}`
|
34
34
|
end
|
@@ -39,7 +39,7 @@ describe "Dorsal" do
|
|
39
39
|
it { should be_an_instance_of Module}
|
40
40
|
context "Dorsal::Controller" do
|
41
41
|
subject { $controller }
|
42
|
-
it { should be_an_instance_of Dorsal::Controller }
|
42
|
+
it { should be_an_instance_of Dorsal::Controller }
|
43
43
|
context "#initialize" do
|
44
44
|
|
45
45
|
end
|
@@ -63,34 +63,35 @@ describe "Dorsal" do
|
|
63
63
|
# lambda { subject.start_ring_server}.should raise_error Dorsal::RingServerError
|
64
64
|
subject.start_ring_server.should be false
|
65
65
|
end
|
66
|
-
it "should exist an instance process of the Ring server" do
|
66
|
+
it "should exist an instance process of the Ring server" do
|
67
67
|
pid = `ps aux|grep -v grep |grep 'Dorsal Ring Server'|awk '{ print $2}'`.chomp
|
68
68
|
pid.should_not be_empty
|
69
69
|
end
|
70
|
-
|
70
|
+
|
71
71
|
end
|
72
|
-
|
72
|
+
|
73
73
|
context "#bind_to_ring_server" do
|
74
74
|
it { should respond_to :bind_to_ring }
|
75
|
-
it "should be possible to
|
75
|
+
it "should be possible to bind distributed Ring Server" do
|
76
76
|
$ring = subject.bind_to_ring
|
77
77
|
end
|
78
78
|
context "Ring server Instance" do
|
79
|
-
it "should be an Instance of DRb::DRbObject" do
|
79
|
+
it "should be an Instance of DRb::DRbObject" do
|
80
80
|
$ring.should be_an_instance_of DRb::DRbObject
|
81
81
|
end
|
82
82
|
it "should Ring server respond to start_service" do
|
83
|
-
$ring.should respond_to :start_service
|
83
|
+
$ring.should respond_to :start_service
|
84
84
|
end
|
85
|
-
it "should start a service" do
|
85
|
+
it "should start a service" do
|
86
86
|
$ring.start_service({ :name => 'dummy', :object => Dummy::new, :description => 'A dummy distributed service' }).should > 0
|
87
|
+
|
87
88
|
end
|
88
|
-
it "should exist an instance process of dummy service" do
|
89
|
-
pid = `ps aux|grep
|
89
|
+
it "should exist an instance process of dummy service" do
|
90
|
+
pid = `ps aux|grep -v grep |grep 'A dummy distributed service'|awk '{ print $2}'`.chomp
|
90
91
|
pid.should_not be_empty
|
91
92
|
end
|
92
93
|
it "should Ring server respond to list_services" do
|
93
|
-
$ring.should respond_to :list_services
|
94
|
+
$ring.should respond_to :list_services
|
94
95
|
end
|
95
96
|
it "should list_services return a Hash" do
|
96
97
|
$ring.list_services.should be_an_instance_of Hash
|
@@ -105,7 +106,7 @@ describe "Dorsal" do
|
|
105
106
|
File::exist?('/tmp/dorsal/service-dummy.pid').should be true
|
106
107
|
end
|
107
108
|
it "should ring server respond to bind_to_service" do
|
108
|
-
$ring.should respond_to :bind_to_service
|
109
|
+
$ring.should respond_to :bind_to_service
|
109
110
|
end
|
110
111
|
it "should bind the dummy service" do
|
111
112
|
$dummy = $ring.bind_to_service :name => 'dummy'
|
@@ -113,20 +114,20 @@ describe "Dorsal" do
|
|
113
114
|
$dummy.test.should eq 'OK'
|
114
115
|
end
|
115
116
|
it "should have a running daemon instance of the service dummy" do
|
116
|
-
pid = `ps aux|grep
|
117
|
+
pid = `ps aux|grep -v grep |grep 'A dummy distributed service'|awk '{ print $2}'`.chomp
|
117
118
|
pid.should_not be_empty
|
118
119
|
end
|
119
120
|
|
120
121
|
it "should ring server respond to destroy_service" do
|
121
|
-
$ring.should respond_to :destroy_service
|
122
|
-
|
122
|
+
$ring.should respond_to :destroy_service
|
123
|
+
|
123
124
|
end
|
124
|
-
|
125
|
+
|
125
126
|
it "should be possible to stop the dummy_service" do
|
126
127
|
res = $ring.destroy_service({ :name => 'dummy'})
|
127
128
|
res.should be true
|
128
129
|
$ring.list_services.should be_empty
|
129
|
-
|
130
|
+
|
130
131
|
end
|
131
132
|
it "should not exist pid_file : /tmp/dorsal/service-dummy.pid" do
|
132
133
|
File::exist?('/tmp/dorsal/service-dummy.pid').should be false
|
@@ -145,18 +146,18 @@ describe "Dorsal" do
|
|
145
146
|
subject.ring_server_status.should be true
|
146
147
|
end
|
147
148
|
end
|
148
|
-
|
149
|
+
|
149
150
|
context "#stop_ring_server" do
|
150
|
-
it "should re-start a service dummy for testing auto_destroy when stop Ring Server" do
|
151
|
+
it "should re-start a service dummy for testing auto_destroy when stop Ring Server" do
|
151
152
|
$ring.start_service({ :name => 'dummy', :object => Dummy::new, :description => 'A dummy distributed service' }).should > 0
|
152
153
|
end
|
153
154
|
it { should respond_to :stop_ring_server }
|
154
155
|
it { subject.stop_ring_server.should eq true }
|
155
|
-
it "should no longer exist an instance process of the Ring server" do
|
156
|
+
it "should no longer exist an instance process of the Ring server" do
|
156
157
|
pid = `ps aux|grep ruby|grep -v grep |grep 'Dorsal Ring Server'|awk '{ print $2}'`.chomp
|
157
158
|
pid.should be_empty
|
158
159
|
end
|
159
|
-
it "should not exist an instance process of dummy service" do
|
160
|
+
it "should not exist an instance process of dummy service" do
|
160
161
|
pid = `ps aux|grep ruby|grep -v grep |grep 'A dummy distributed service'|awk '{ print $2}'`.chomp
|
161
162
|
pid.should be_empty
|
162
163
|
end
|
@@ -5,10 +5,10 @@ ClassLineCountCheck:
|
|
5
5
|
ClassNameCheck:
|
6
6
|
pattern: !ruby/regexp /^[A-Z][a-zA-Z0-9]*$/
|
7
7
|
#ClassVariableCheck:
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
CyclomaticCompleityBlockCheck:
|
9
|
+
compleity: 5
|
10
|
+
CyclomaticCompleityMethodCheck:
|
11
|
+
compleity: 10
|
12
12
|
EmptyRescueBodyCheck:
|
13
13
|
ForLoopCheck:
|
14
14
|
MethodLineCountCheck:
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dorsal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '1.
|
4
|
+
version: '1.3'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Romain GEORGES
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-04-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: methodic
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1.
|
19
|
+
version: '1.3'
|
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: '1.
|
26
|
+
version: '1.3'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rspec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -81,7 +81,7 @@ dependencies:
|
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: rake
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - ">="
|
@@ -95,7 +95,7 @@ dependencies:
|
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
98
|
+
name: code_statistics
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - ">="
|
@@ -109,19 +109,19 @@ dependencies:
|
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
112
|
+
name: yard-rspec
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- - "
|
115
|
+
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: '
|
117
|
+
version: '0'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- - "
|
122
|
+
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: '
|
124
|
+
version: '0'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: daemons
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -161,7 +161,7 @@ files:
|
|
161
161
|
- ultragreen_roodi_coding_convention.yml
|
162
162
|
homepage: http://www.ultragreen.net/projects/dorsal
|
163
163
|
licenses:
|
164
|
-
- BSD
|
164
|
+
- BSD-2-Clause
|
165
165
|
metadata: {}
|
166
166
|
post_install_message:
|
167
167
|
rdoc_options: []
|
@@ -171,15 +171,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
171
171
|
requirements:
|
172
172
|
- - ">="
|
173
173
|
- !ruby/object:Gem::Version
|
174
|
-
version:
|
174
|
+
version: '0'
|
175
175
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
176
176
|
requirements:
|
177
177
|
- - ">="
|
178
178
|
- !ruby/object:Gem::Version
|
179
179
|
version: '0'
|
180
180
|
requirements: []
|
181
|
-
|
182
|
-
rubygems_version: 2.4.7
|
181
|
+
rubygems_version: 3.1.2
|
183
182
|
signing_key:
|
184
183
|
specification_version: 4
|
185
184
|
summary: Dorsal provide a simple and easy to use Ring Server for DRuby Objects based
|