riddl 0.99.211 → 0.99.212
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 312e41b9c6194074f78d75343365750ea2d79e3e
|
4
|
+
data.tar.gz: 110b882327acf91457b06100d53bb3609b0b3e71
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e7e033610fed585467e72dd14d4c5273df9c03767ea135b6057442427b21f822b2390303be96d2071aea8e678455505a7fb56daeba84f614365160306e9c3d5a
|
7
|
+
data.tar.gz: 127eda4baaeaa48c0bbca02d86aa939b22c39aa030fee06eb8532d8b4187cd4f3d1f81d460a5ecc4eddfc6d28faef66b8b4e8d589ae6bbea6f121b12d7863ea1
|
@@ -10,7 +10,7 @@ module Riddl
|
|
10
10
|
@base_path = @resource
|
11
11
|
#}}}
|
12
12
|
end
|
13
|
-
|
13
|
+
|
14
14
|
def visualize(mode,res=@resource,what='')
|
15
15
|
#{{{
|
16
16
|
what += res.path
|
@@ -48,23 +48,23 @@ module Riddl
|
|
48
48
|
res = add_path(path,res,rec)
|
49
49
|
res.add_access_methods(des,desres,index,interface)
|
50
50
|
res.add_custom(desres)
|
51
|
-
block.each do |bl|
|
52
|
-
bpath = bl.to_s.gsub(/\/+/,'/').gsub(/\/$/,'')
|
53
|
-
bpath = (bpath == "" ? "/" : bpath)
|
54
|
-
if interface.sub == bpath
|
55
|
-
res.remove_access_methods(des,bl.attributes)
|
56
|
-
end
|
57
|
-
end
|
58
51
|
desres.find("des:resource").each do |desres|
|
59
52
|
cpath = desres.attributes['relative'] || "{}"
|
60
53
|
rec = desres.attributes['recursive']
|
61
54
|
int = Interface.new_from_interface(interface,(interface.sub+"/"+cpath).gsub(/\/+/,'/'))
|
62
55
|
add_description(des,desres,cpath,index,int,block,rec,res)
|
63
56
|
end
|
57
|
+
block.each do |bl|
|
58
|
+
bpath = bl.to_s.gsub(/\/+/,'/').gsub(/\/$/,'')
|
59
|
+
bpath = (bpath == "" ? "/" : bpath)
|
60
|
+
if path == bpath
|
61
|
+
res.remove_access_methods(des,bl.attributes,index)
|
62
|
+
end
|
63
|
+
end
|
64
64
|
nil
|
65
65
|
#}}}
|
66
66
|
end
|
67
|
-
|
67
|
+
|
68
68
|
def compose!(res=@base_path)
|
69
69
|
#{{{
|
70
70
|
res.compose!
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Riddl
|
2
2
|
class Wrapper
|
3
3
|
class Description < WrapperUtils
|
4
|
-
|
4
|
+
|
5
5
|
class Resource
|
6
6
|
def initialize(path=nil,recursive=false)
|
7
7
|
#{{{
|
@@ -57,7 +57,7 @@ module Riddl
|
|
57
57
|
|
58
58
|
# TODO add websockets
|
59
59
|
|
60
|
-
def remove_access_methods(des,filter)
|
60
|
+
def remove_access_methods(des,filter,index)
|
61
61
|
#{{{
|
62
62
|
freq = if filter['in'] && filter['in'] != '*'
|
63
63
|
t = [RequestInOut,Riddl::Wrapper::Description::Message.new(des,filter['in'])]
|
@@ -75,7 +75,7 @@ module Riddl
|
|
75
75
|
raise BlockError, "blocking #{filter.inspect} not possible" if freq.nil?
|
76
76
|
|
77
77
|
if reqs = @access_methods[filter['method']]
|
78
|
-
reqs = reqs
|
78
|
+
reqs = reqs[index]
|
79
79
|
reqs.delete_if do |req|
|
80
80
|
if req.class == freq[0]
|
81
81
|
if req.class == RequestInOut
|
@@ -90,19 +90,20 @@ module Riddl
|
|
90
90
|
elsif req.class == RequestTransformation
|
91
91
|
true if freq[1] && freq[1].hash == req.trans.hash
|
92
92
|
elsif req.class == RequestPass
|
93
|
+
p 'rrrr'
|
93
94
|
true
|
94
95
|
end
|
95
|
-
end
|
96
|
+
end
|
96
97
|
end
|
97
|
-
end
|
98
|
+
end
|
98
99
|
#}}}
|
99
100
|
end
|
100
101
|
|
101
102
|
def compose!
|
102
103
|
#{{{
|
103
104
|
@access_methods.each do |k,v|
|
104
|
-
### remove all emtpy layers
|
105
|
-
v.compact
|
105
|
+
### remove all emtpy layers
|
106
|
+
v = v.map{|e| e.empty? ? nil: e}.compact
|
106
107
|
case v.size
|
107
108
|
when 0
|
108
109
|
when 1
|
@@ -110,10 +111,10 @@ module Riddl
|
|
110
111
|
else
|
111
112
|
@composition[k] = compose_layers(k,v)
|
112
113
|
end
|
113
|
-
end
|
114
|
+
end
|
114
115
|
#}}}
|
115
116
|
end
|
116
|
-
|
117
|
+
|
117
118
|
def compose_layers(k,layers)
|
118
119
|
#{{{
|
119
120
|
routes = []
|
@@ -152,9 +153,9 @@ module Riddl
|
|
152
153
|
if r.size > 1
|
153
154
|
teh_last = r[-2]
|
154
155
|
success = false
|
155
|
-
else
|
156
|
+
else
|
156
157
|
ret = teh_last
|
157
|
-
end
|
158
|
+
end
|
158
159
|
end
|
159
160
|
end while !success
|
160
161
|
Composition.new(r,ret)
|
@@ -171,18 +172,18 @@ module Riddl
|
|
171
172
|
#}}}
|
172
173
|
end
|
173
174
|
private :compose_plain
|
174
|
-
|
175
|
+
|
175
176
|
def traverse_layers(container,path,layers,layer)
|
176
177
|
#{{{
|
177
178
|
return if layers.count <= layer
|
178
179
|
current = path.last
|
179
|
-
current_path = path.dup
|
180
|
+
current_path = path.dup
|
180
181
|
|
181
182
|
# messages RequestInOut and RequestStarOut with no out are not processed
|
182
183
|
return if ((current.class == RequestInOut || current.class == RequestStarOut) && current.out.nil?)
|
183
184
|
|
184
|
-
if current.class == RequestInOut ||
|
185
|
-
(current.class == RequestTransformation && !current.out.nil?) ||
|
185
|
+
if current.class == RequestInOut ||
|
186
|
+
(current.class == RequestTransformation && !current.out.nil?) ||
|
186
187
|
current.class == RequestStarOut
|
187
188
|
# Find all where "in" matches
|
188
189
|
layers[layer].find_all{ |l| (l.class == RequestInOut && l.in.traverse?(current.out) && !l.used?) }.each do |r|
|
@@ -196,7 +197,7 @@ module Riddl
|
|
196
197
|
if num > 0
|
197
198
|
path = current_path.dup
|
198
199
|
container << path
|
199
|
-
end
|
200
|
+
end
|
200
201
|
path << r.transform(current)
|
201
202
|
r.used = true
|
202
203
|
traverse_layers(container,path,layers,layer+1)
|
@@ -206,7 +207,7 @@ module Riddl
|
|
206
207
|
add_to_path_and_split(container,path,layers,layer,num,current_path,r)
|
207
208
|
end
|
208
209
|
return
|
209
|
-
end
|
210
|
+
end
|
210
211
|
|
211
212
|
if (current.class == RequestTransformation && current.out.nil?) ||
|
212
213
|
current.class == RequestPass
|
@@ -214,7 +215,7 @@ module Riddl
|
|
214
215
|
layers[layer].find_all{|l| (l.class == RequestInOut && !l.used?) || (l.class != RequestInOut) }.each_with_index do |r,num|
|
215
216
|
add_to_path_and_split(container,path,layers,layer,num,current_path,r)
|
216
217
|
end
|
217
|
-
end
|
218
|
+
end
|
218
219
|
#}}}
|
219
220
|
end
|
220
221
|
private :traverse_layers
|
@@ -224,7 +225,7 @@ module Riddl
|
|
224
225
|
if num > 0
|
225
226
|
path = current_path.dup
|
226
227
|
container << path
|
227
|
-
end
|
228
|
+
end
|
228
229
|
path << r
|
229
230
|
path.last.used = true
|
230
231
|
traverse_layers(container,path,layers,layer+1)
|
@@ -239,7 +240,7 @@ module Riddl
|
|
239
240
|
result << t + "<#{k} "
|
240
241
|
else
|
241
242
|
result << t + "<request method=\"#{k}\" "
|
242
|
-
end
|
243
|
+
end
|
243
244
|
case m
|
244
245
|
when Riddl::Wrapper::Description::RequestInOut
|
245
246
|
messages[m.in.hash] ||= m.in
|
@@ -247,16 +248,15 @@ module Riddl
|
|
247
248
|
unless m.out.nil?
|
248
249
|
messages[m.out.hash] ||= m.out
|
249
250
|
result << " out=\"#{m.out.hash}\""
|
250
|
-
end
|
251
|
+
end
|
251
252
|
when Riddl::Wrapper::Description::RequestStarOut
|
252
253
|
result << "in=\"*\""
|
253
254
|
unless m.out.nil?
|
254
255
|
messages[m.out.hash] ||= m.out
|
255
256
|
result << " out=\"#{m.out.hash}\""
|
256
|
-
end
|
257
|
+
end
|
257
258
|
when Riddl::Wrapper::Description::RequestPass
|
258
|
-
|
259
|
-
result << "pass=\"#{m.pass.hash}\""
|
259
|
+
result << "pass=\"*\""
|
260
260
|
when Riddl::Wrapper::Description::RequestTransformation
|
261
261
|
messages[m.trans.hash] ||= m.trans
|
262
262
|
result << "transformation=\"#{m.trans.hash}\""
|
@@ -265,13 +265,13 @@ module Riddl
|
|
265
265
|
result << ">\n"
|
266
266
|
m.custom.each do |e|
|
267
267
|
result << e.dump + "\n"
|
268
|
-
end
|
268
|
+
end
|
269
269
|
if %w{get post put delete websocket}.include?(k)
|
270
270
|
result << t + "</#{k}>"
|
271
271
|
else
|
272
272
|
result << t + "</request>\n"
|
273
|
-
end
|
274
|
-
else
|
273
|
+
end
|
274
|
+
else
|
275
275
|
result << "/>\n"
|
276
276
|
end
|
277
277
|
result
|
@@ -290,18 +290,18 @@ module Riddl
|
|
290
290
|
@composition.each do |k,v|
|
291
291
|
v.each do |m|
|
292
292
|
result << description_xml_string_analyse(messages,t,k,m.result)
|
293
|
-
end
|
293
|
+
end
|
294
294
|
end
|
295
295
|
else
|
296
296
|
@access_methods.each do |k,v|
|
297
297
|
v.first.each do |m|
|
298
298
|
result << description_xml_string_analyse(messages,t,k,m)
|
299
|
-
end
|
299
|
+
end
|
300
300
|
end
|
301
301
|
end
|
302
302
|
result
|
303
303
|
#}}}
|
304
|
-
end
|
304
|
+
end
|
305
305
|
def description_xml_string_sub(messages,t)
|
306
306
|
#{{{
|
307
307
|
result = ''
|
@@ -371,7 +371,7 @@ module Riddl
|
|
371
371
|
@access_methods[method][index] << RequestPass.new(interface,custom)
|
372
372
|
end
|
373
373
|
private :add_request_pass
|
374
|
-
|
374
|
+
|
375
375
|
def add_websocket(index,interface,custom)
|
376
376
|
@access_methods['websocket'] ||= []
|
377
377
|
@access_methods['websocket'][index] ||= []
|
data/riddl.gemspec
CHANGED