rsf_services 0.9.4 → 0.9.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/rsf_services.rb +73 -72
- data.tar.gz.sig +0 -0
- metadata +27 -26
- metadata.gz.sig +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 43feef11d6b29d948bffbd0b15dbb6ffc0824ccc300710c2c00a53cbcbddddd7
|
4
|
+
data.tar.gz: 960d006b9687bd9c11ef998750b83555b0a065f4348983c882b9ba41d5c9779b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32c7760f8ddb53a3f81f54dba12dbe742502ab80de5d241391a7123474667d64f928a7751068f9ba63d195e4290429500ebf515e04a3f135a7d1874e9bc30a52
|
7
|
+
data.tar.gz: fb07b09dd1db29349bdf876528b9b143b4f0265c9c872607dc9db26a3002f2a28943ff28e9ea6860d12ae2d401694134a0eaf5407cb235aee827ea3213028b04
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/rsf_services.rb
CHANGED
@@ -8,48 +8,48 @@ require 'dws-registry'
|
|
8
8
|
|
9
9
|
|
10
10
|
class RSFServices < RScriptRW
|
11
|
-
|
11
|
+
|
12
12
|
class PackageMethod
|
13
|
-
|
14
|
-
def initialize(parent, type: :get)
|
13
|
+
|
14
|
+
def initialize(parent, type: :get)
|
15
15
|
@parent = parent
|
16
16
|
@parent.type = type
|
17
17
|
end
|
18
|
-
|
18
|
+
|
19
19
|
private
|
20
|
-
|
20
|
+
|
21
21
|
def method_missing(method_name, *args)
|
22
22
|
Package.new @parent, method_name.to_s
|
23
|
-
end
|
24
|
-
|
25
|
-
end
|
26
|
-
|
27
|
-
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
|
28
28
|
class Package
|
29
|
-
|
29
|
+
|
30
30
|
def initialize(obj, package, debug: false)
|
31
31
|
|
32
|
-
|
32
|
+
|
33
33
|
puts 'inside Package#initialize' if debug
|
34
|
-
|
34
|
+
|
35
35
|
@obj, @package, @debug = obj, package, debug
|
36
36
|
|
37
37
|
@url = File.join(@obj.package_basepath, package + '.rsf')
|
38
|
-
|
38
|
+
|
39
39
|
puts 'before Rexle' if @debug
|
40
40
|
puts '@url: ' + @url.inspect if @debug
|
41
|
-
|
41
|
+
|
42
42
|
s, _ = RXFHelper.read(@url)
|
43
43
|
puts 's: ' + s.inspect if @debug
|
44
|
-
|
44
|
+
|
45
45
|
doc = Rexle.new s
|
46
46
|
puts 'before xpath' if @debug
|
47
|
-
|
47
|
+
|
48
48
|
a = doc.root.xpath 'job/attribute::id'
|
49
|
-
|
49
|
+
|
50
50
|
a.each do |attr|
|
51
|
-
|
52
|
-
method_name = attr.value.gsub('-','_')
|
51
|
+
|
52
|
+
method_name = attr.value.gsub('-','_')
|
53
53
|
|
54
54
|
define_singleton_method method_name.to_sym do |*args|
|
55
55
|
run_job method_name, args
|
@@ -60,39 +60,39 @@ class RSFServices < RScriptRW
|
|
60
60
|
end
|
61
61
|
|
62
62
|
private
|
63
|
-
|
63
|
+
|
64
64
|
def run_job(method_name, *args)
|
65
|
-
|
65
|
+
|
66
66
|
puts 'inside Package::run_job: args: ' + args.inspect if @debug
|
67
|
-
|
67
|
+
|
68
68
|
args.flatten!(1)
|
69
69
|
params = args.find {|x| x.is_a? Hash} ? args.pop : {}
|
70
70
|
a = ['//job:' + method_name, @url, args].flatten(1)
|
71
|
-
|
71
|
+
|
72
72
|
if @debug then
|
73
73
|
puts 'a: ' + a.inspect
|
74
74
|
puts 'params: ' + params.inspect
|
75
75
|
end
|
76
|
-
|
76
|
+
|
77
77
|
@obj.run a, params
|
78
78
|
end
|
79
|
-
|
80
79
|
|
81
|
-
|
80
|
+
|
81
|
+
end
|
82
82
|
|
83
83
|
attr_reader :services, :package_basepath, :registry
|
84
84
|
|
85
|
-
def initialize(reg=nil, package_basepath: '', log: nil, debug: false,
|
85
|
+
def initialize(reg=nil, package_basepath: '', log: nil, debug: false,
|
86
86
|
app_rsf: nil)
|
87
|
-
|
87
|
+
|
88
88
|
@log, @debug = log, debug
|
89
|
-
|
89
|
+
|
90
90
|
puts 'inside RSF_services' if @debug
|
91
91
|
|
92
92
|
super(log: log, debug: debug)
|
93
93
|
|
94
94
|
@package_basepath, @services = package_basepath, {}
|
95
|
-
|
95
|
+
|
96
96
|
@initialized = {}
|
97
97
|
|
98
98
|
if reg then
|
@@ -102,62 +102,63 @@ class RSFServices < RScriptRW
|
|
102
102
|
else
|
103
103
|
reg
|
104
104
|
end
|
105
|
-
|
105
|
+
|
106
106
|
# load the system/startup RSF jobs
|
107
107
|
|
108
108
|
startup = reg.get_key('system/startup')
|
109
|
-
|
109
|
+
|
110
110
|
jobs = startup.xpath('*[load="1"]').inject({}) do |r, job|
|
111
111
|
settings = reg.get_keys("system/packages/#{job.name}/*")\
|
112
112
|
.inject({}){|r,x| r.merge(x.name.to_sym => x.text) }
|
113
113
|
r.merge(job.name => settings)
|
114
114
|
end
|
115
|
-
|
116
|
-
jobs.each do |package, settings|
|
117
|
-
r = run_job(package.to_s, 'load', settings,
|
115
|
+
|
116
|
+
jobs.each do |package, settings|
|
117
|
+
r = run_job(package.to_s, 'load', settings,
|
118
118
|
package_path: settings[:url])
|
119
119
|
end
|
120
120
|
end
|
121
|
-
|
121
|
+
|
122
122
|
@app = AppMgr.new(rsf: app_rsf, reg: reg, rsc: self) if app_rsf
|
123
123
|
|
124
124
|
end
|
125
|
-
|
126
|
-
|
125
|
+
|
126
|
+
|
127
127
|
def delete()
|
128
128
|
PackageMethod.new self, type: :delete
|
129
|
-
end
|
130
|
-
|
129
|
+
end
|
130
|
+
|
131
131
|
def get()
|
132
132
|
PackageMethod.new self
|
133
|
-
end
|
134
|
-
|
133
|
+
end
|
134
|
+
|
135
135
|
def put()
|
136
136
|
PackageMethod.new self, type: :put
|
137
|
-
end
|
138
|
-
|
137
|
+
end
|
138
|
+
|
139
139
|
def post()
|
140
140
|
PackageMethod.new self, type: :post
|
141
141
|
end
|
142
142
|
|
143
143
|
def run_job(package, jobs, params={}, *qargs)
|
144
|
-
|
144
|
+
|
145
145
|
puts 'inside run_job' #if @debug
|
146
146
|
|
147
147
|
package_path = "%s/%s.rsf" % [@package_basepath, package]
|
148
|
-
|
148
|
+
|
149
149
|
if @log or @debug then
|
150
|
-
msg = 'RSFServices/run job: ' +
|
150
|
+
msg = 'RSFServices/run job: ' +
|
151
151
|
("package: %s jobs: %s params: %s qargs: %s " + \
|
152
152
|
" package_path: %s" % [package, jobs, params, qargs, package_path])
|
153
153
|
@log.info msg if @log
|
154
154
|
puts msg if @debug
|
155
155
|
end
|
156
|
-
|
157
|
-
yield(params) if block_given?
|
158
|
-
|
156
|
+
|
157
|
+
yield(params) if block_given?
|
158
|
+
|
159
159
|
a = [package_path, jobs.split(/\s/).map{|x| "//job:%s" % x} ,qargs].flatten(2)
|
160
|
-
|
160
|
+
@log.info 'RSFServices/run job: a: ' + a.inspect if @log
|
161
|
+
|
161
162
|
puts 'a: ' + a.inspect if @debug
|
162
163
|
|
163
164
|
c, args, _ = read(a)
|
@@ -165,53 +166,53 @@ class RSFServices < RScriptRW
|
|
165
166
|
rws, reg, app = self, @registry, @app
|
166
167
|
|
167
168
|
begin
|
168
|
-
|
169
|
+
|
169
170
|
@log.info 'RSFServices/run job: code: ' + c if @log and c.is_a? String
|
170
171
|
|
171
|
-
# if there is a job id called *initialize* then execute if it hasn't
|
172
|
+
# if there is a job id called *initialize* then execute if it hasn't
|
172
173
|
# already been executed
|
173
174
|
|
174
|
-
if self.jobs(package_path).include? :initialize and
|
175
|
+
if self.jobs(package_path).include? :initialize and
|
175
176
|
!@initialized[package_path] and jobs != 'initialize' then
|
176
177
|
run_job(package, 'initialize')
|
177
178
|
@initialized[package_path] = true
|
178
179
|
end
|
179
180
|
|
180
|
-
r =
|
181
|
+
r = instance_eval c
|
181
182
|
puts 'r: ' + r.inspect if @debug
|
182
183
|
#thread = Thread.new {Thread.current[:v] = eval c}
|
183
184
|
#thread.join
|
184
|
-
#r = thread[:v]
|
185
|
-
|
185
|
+
#r = thread[:v]
|
186
|
+
|
186
187
|
@log.info 'RSFServices/run job: result: ' + r if @log and r.is_a? String
|
187
|
-
|
188
|
+
|
188
189
|
return r
|
189
190
|
|
190
|
-
rescue Exception => e
|
191
|
-
|
191
|
+
rescue Exception => e
|
192
|
+
|
192
193
|
params = {}
|
193
|
-
err_label = e.message.to_s + " :: \n" + e.backtrace.join("\n")
|
194
|
+
err_label = e.message.to_s + " :: \n" + e.backtrace.join("\n")
|
194
195
|
@log.debug 'RSFServices/run_job/error: ' + err_label if @log
|
195
196
|
|
196
197
|
end
|
197
|
-
|
198
|
+
|
198
199
|
end
|
199
|
-
|
200
|
+
|
200
201
|
def package_methods(package)
|
201
|
-
|
202
|
-
url = File.join(@package_basepath, package + '.rsf')
|
203
|
-
doc = Rexle.new open(url, 'UserAgent' => 'ClientRscript').read
|
202
|
+
|
203
|
+
url = File.join(@package_basepath, package + '.rsf')
|
204
|
+
doc = Rexle.new URI.open(url, 'UserAgent' => 'ClientRscript').read
|
204
205
|
doc.root.xpath('job/attribute::id').map {|x| x.value.to_s.gsub('-','_') }
|
205
206
|
|
206
207
|
end
|
207
|
-
|
208
|
+
|
208
209
|
private
|
209
|
-
|
210
|
+
|
210
211
|
def method_missing(method_name, *args)
|
211
|
-
|
212
|
+
|
212
213
|
puts 'inside method_missing' if @debug
|
213
214
|
self.type = :get
|
214
215
|
Package.new self, method_name.to_s, debug: @debug
|
215
|
-
end
|
216
|
-
|
216
|
+
end
|
217
|
+
|
217
218
|
end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rsf_services
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -11,31 +11,31 @@ cert_chain:
|
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
13
|
MIIEXjCCAsagAwIBAgIBATANBgkqhkiG9w0BAQsFADAsMSowKAYDVQQDDCFnZW1t
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
/
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
14
|
+
YXN0ZXIvREM9amFtZXNyb2JlcnRzb24vREM9ZXUwHhcNMjExMTE4MTEyMDIxWhcN
|
15
|
+
MjIxMTE4MTEyMDIxWjAsMSowKAYDVQQDDCFnZW1tYXN0ZXIvREM9amFtZXNyb2Jl
|
16
|
+
cnRzb24vREM9ZXUwggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQDK496w
|
17
|
+
8Wo4lOqJB1ND/vi4gyws3E8jHUqWt1YyV2YHL/+P2UUiili7z4qohHstpgBUUQtY
|
18
|
+
ve6g602bAmxayqqRYUTugyi/R6LRL5GSiKBFpfxWj5tUJh41frNoVjZk6AKoti4K
|
19
|
+
gU0ZdMhcz56zaDNQM/QDH8vaMrbs/+AcsTVKeZ+Sw930NI2QPuzyF3vgp1lGAqY8
|
20
|
+
j8BmT9mWzyXjjsrGV1hfzFYwoObk9SE6clyF5K6CrCsoqVzhwOhGvJShOr0kQWUo
|
21
|
+
x0MalRtTvMnUrtjveFmQTJhEGNjIkPiYsiSP+50otwlRqvUbY2NRkL9bq/YPQj9s
|
22
|
+
clxIRLdok0XE6Z6C83yHKbhSFp0WfygOM2oGFiVM1Fsaok6XKimTNj8Q5koS523a
|
23
|
+
pega/q9X9tHyPzeAMGTKymJteEcR7qdDYrXxOcHWVna68btSL5gaIlWCQPvyLZ+P
|
24
|
+
f7UVDsRCQttoB+arcmEy4JmiwHnG/6tWs+bfyhPf86uEErNBm24IkEgPLnMCAwEA
|
25
|
+
AaOBijCBhzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQUT1Vuql+w
|
26
|
+
8qUbu0Amwqd3msON9YswJgYDVR0RBB8wHYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0
|
27
27
|
c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1hc3RlckBqYW1lc3JvYmVydHNvbi5ldTAN
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
28
|
+
BgkqhkiG9w0BAQsFAAOCAYEAUQLpouWyYhkD5a18Z7qbypaOD3nnc4YXMdUdB9Qy
|
29
|
+
01NARPgklfbwJKImoq2VMT96JbBZX9nOdC2MAjo+0cK9duApEA6Sm+0n71Fub5Xn
|
30
|
+
9K43tJLAe3DPsW5CY4b/e1nxEiSQYntRF6tSQvjjpEHdSNyPYsvt7dN9ZwjaMo8U
|
31
|
+
8DeKxPlN+7fHcGZP3p4oYlRg0bRGwueO7aX8BYGzuOYrsmoq3swsE2/rz6zlC0DX
|
32
|
+
QyaSxFtZFOYYc4GrcixS2kX5i54MYZNpiRYMVJT3/ICbyIwtorKezJxkO7vKQiQj
|
33
|
+
OosD65e1Gn1rhQW6mAcblsvvMHvdfFA/uTvD77A8MgCYQa5llIZEx0Bd7ExPDPZn
|
34
|
+
e86Mje12aZQAyilVfeqbv5u3EZlw6kLbigLmw7BlUk7Zi2X84+iz7W8EdU3GSv8a
|
35
|
+
y347QSdvzPRHMpmi1wAJh+koAo4s8Noi64GU5+4xUDRUh02AV/sXFxRdJne2WDW0
|
36
|
+
4wvjYJ8JEXo2AHNQSXG3FQmn
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date:
|
38
|
+
date: 2021-11-18 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: dws-registry
|
@@ -78,7 +78,7 @@ dependencies:
|
|
78
78
|
- !ruby/object:Gem::Version
|
79
79
|
version: 0.3.1
|
80
80
|
description:
|
81
|
-
email:
|
81
|
+
email: digital.robertson@gmail.com
|
82
82
|
executables: []
|
83
83
|
extensions: []
|
84
84
|
extra_rdoc_files: []
|
@@ -103,7 +103,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
103
103
|
- !ruby/object:Gem::Version
|
104
104
|
version: '0'
|
105
105
|
requirements: []
|
106
|
-
|
106
|
+
rubyforge_project:
|
107
|
+
rubygems_version: 2.7.10
|
107
108
|
signing_key:
|
108
109
|
specification_version: 4
|
109
110
|
summary: Runs within a DRb server to run RSF jobs, as well as other services.
|
metadata.gz.sig
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
|
2
|
-
o
|
1
|
+
!��C2r�R�Cdݫ���F��q; ���S6�R���خ��\Hb�8������I�<�����݊����f�QM;�+���������ʏ맙{F��3���O:Z����5�osM�P{2~�_�RJNMu�Om�g�}�MC<��$�k�,�����nw9�s[
|
2
|
+
h��5�B���<��&�B�����*�� �o�,��c9G1��(���y�ò)��-���0�y_Ւ %��Lݴ��7X-7����RPg�9��Z�?��xa�
|