riddl 0.99.220 → 0.99.221
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 +4 -4
- data/lib/ruby/riddl/utils/oauth2-helper.rb +1 -1
- data/lib/ruby/riddl/utils/oauth2-univie.rb +4 -4
- data/riddl.gemspec +1 -1
- metadata +1 -14
- data/lib/ruby/riddl/description.rb +0 -33
- data/lib/ruby/riddl/docoverlay.html +0 -255
- data/lib/ruby/riddl/docoverlay.rb +0 -14
- data/lib/ruby/riddl/downloadify.rb +0 -14
- data/lib/ruby/riddl/erbserve.rb +0 -24
- data/lib/ruby/riddl/fileserve.rb +0 -45
- data/lib/ruby/riddl/notifications_producer.rb +0 -328
- data/lib/ruby/riddl/oauth2-helper.rb +0 -135
- data/lib/ruby/riddl/oauth2-univie.rb +0 -167
- data/lib/ruby/riddl/properties.rb +0 -479
- data/lib/ruby/riddl/turtle.rb +0 -72
- data/lib/ruby/riddl/xmlserve.rb +0 -40
- data/lib/ruby/riddl/xsloverlay.rb +0 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d5cf129b80641d4c8065f26e8d0ef4ab4826f61d
|
4
|
+
data.tar.gz: 0037ac8bd56d521e825201f1a13195056d41aeb0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63d54e200b15c4701f67384b3d9c35a1489eddcf0bc73f4e8464c899765bac510618ff1b9b92b9a4d52ac85113331c3edc73e410c9d0baa326a20acf61e5aca2
|
7
|
+
data.tar.gz: dfc2a396ca3cc988dc08f1ced7dd7313dc700a32004b7a29d0ff6991e9295d4bbcfbd08ab0316e9b653419a6f87477ad62fc385fcd199683eb696ef7abbaf8c0
|
@@ -55,7 +55,7 @@ module Riddl
|
|
55
55
|
}.to_json)
|
56
56
|
end
|
57
57
|
|
58
|
-
@headers << Riddl::Header.new('AUTHORIZATION_BEARER', access_tokens
|
58
|
+
@headers << Riddl::Header.new('AUTHORIZATION_BEARER', access_tokens.get(token))
|
59
59
|
end
|
60
60
|
|
61
61
|
@p
|
@@ -145,15 +145,15 @@ module Riddl
|
|
145
145
|
return Riddl::Parameter::Complex.new('data', 'application/json', {
|
146
146
|
:error => 'Token must be refreshed by issuer.'
|
147
147
|
}.to_json)
|
148
|
-
elsif refresh_tokens
|
148
|
+
elsif !refresh_tokens.key?(refresh_token) || token_data['exp'] <= Time.now.to_i
|
149
149
|
@status = 403
|
150
|
-
puts "i dont know #{refresh_token}", "#{refresh_tokens
|
150
|
+
puts "i dont know #{refresh_token}", "#{refresh_tokens.get(refresh_token)}"
|
151
151
|
return Riddl::Parameter::Complex.new('data', 'application/json', {
|
152
152
|
:error => 'Invalid refresh token.'
|
153
153
|
}.to_json)
|
154
154
|
end
|
155
155
|
|
156
|
-
old_token = refresh_tokens
|
156
|
+
old_token = refresh_tokens.get(refresh_token)
|
157
157
|
user = access_tokens.delete old_token
|
158
158
|
|
159
159
|
token = Riddl::Utils::OAuth2::Helper::generate_access_token(client_id, client_id + ':' + client_secret, adur)
|
data/riddl.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: riddl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.99.
|
4
|
+
version: 0.99.221
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juergen 'eTM' Mangler
|
@@ -387,13 +387,7 @@ files:
|
|
387
387
|
- lib/ruby/riddl/client.rb
|
388
388
|
- lib/ruby/riddl/commonlogger.rb
|
389
389
|
- lib/ruby/riddl/constants.rb
|
390
|
-
- lib/ruby/riddl/description.rb
|
391
|
-
- lib/ruby/riddl/docoverlay.html
|
392
|
-
- lib/ruby/riddl/docoverlay.rb
|
393
|
-
- lib/ruby/riddl/downloadify.rb
|
394
|
-
- lib/ruby/riddl/erbserve.rb
|
395
390
|
- lib/ruby/riddl/error.rb
|
396
|
-
- lib/ruby/riddl/fileserve.rb
|
397
391
|
- lib/ruby/riddl/handlers.rb
|
398
392
|
- lib/ruby/riddl/handlers/oauth.rb
|
399
393
|
- lib/ruby/riddl/handlers/plain-type.rb
|
@@ -401,7 +395,6 @@ files:
|
|
401
395
|
- lib/ruby/riddl/handlers/xmlschema.rb
|
402
396
|
- lib/ruby/riddl/header.rb
|
403
397
|
- lib/ruby/riddl/implementation.rb
|
404
|
-
- lib/ruby/riddl/notifications_producer.rb
|
405
398
|
- lib/ruby/riddl/ns/common-patterns/addon-security/request.xml
|
406
399
|
- lib/ruby/riddl/ns/common-patterns/addon-security/response.xml
|
407
400
|
- lib/ruby/riddl/ns/common-patterns/downloadify/1.0/downloadify.xml
|
@@ -420,11 +413,8 @@ files:
|
|
420
413
|
- lib/ruby/riddl/ns/common/relaxng.rng
|
421
414
|
- lib/ruby/riddl/ns/declaration/1.0/declaration.rng
|
422
415
|
- lib/ruby/riddl/ns/description/1.0/description.rng
|
423
|
-
- lib/ruby/riddl/oauth2-helper.rb
|
424
|
-
- lib/ruby/riddl/oauth2-univie.rb
|
425
416
|
- lib/ruby/riddl/option.rb
|
426
417
|
- lib/ruby/riddl/parameter.rb
|
427
|
-
- lib/ruby/riddl/properties.rb
|
428
418
|
- lib/ruby/riddl/protocols/http/generator.rb
|
429
419
|
- lib/ruby/riddl/protocols/http/parser.rb
|
430
420
|
- lib/ruby/riddl/protocols/utils.rb
|
@@ -437,7 +427,6 @@ files:
|
|
437
427
|
- lib/ruby/riddl/roles/http%3A%2F%2Foauth.net%2F1.0%2Frequest_token.rb
|
438
428
|
- lib/ruby/riddl/roles/http%3A%2F%2Foauth.net%2F1.0/base.rb
|
439
429
|
- lib/ruby/riddl/server.rb
|
440
|
-
- lib/ruby/riddl/turtle.rb
|
441
430
|
- lib/ruby/riddl/utils/description.rb
|
442
431
|
- lib/ruby/riddl/utils/docoverlay.html
|
443
432
|
- lib/ruby/riddl/utils/docoverlay.rb
|
@@ -463,8 +452,6 @@ files:
|
|
463
452
|
- lib/ruby/riddl/wrapper/layerchecker.rb
|
464
453
|
- lib/ruby/riddl/wrapper/messageparser.rb
|
465
454
|
- lib/ruby/riddl/wrapper/resourcechecker.rb
|
466
|
-
- lib/ruby/riddl/xmlserve.rb
|
467
|
-
- lib/ruby/riddl/xsloverlay.rb
|
468
455
|
- ns/common-patterns/addon-security/request.xml
|
469
456
|
- ns/common-patterns/addon-security/response.xml
|
470
457
|
- ns/common-patterns/downloadify/1.0/downloadify.xml
|
@@ -1,33 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/../client')
|
2
|
-
|
3
|
-
module Riddl
|
4
|
-
module Utils
|
5
|
-
module Description
|
6
|
-
|
7
|
-
class RDR < Riddl::Implementation
|
8
|
-
def response
|
9
|
-
@headers << Riddl::Header.new("RIDDL_DESCRIPTION", 'oh my, a riddl description')
|
10
|
-
return Riddl::Parameter::Complex.new("riddl-description","text/xml",@a[0])
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
class Call < Riddl::Implementation
|
15
|
-
def response
|
16
|
-
client = Riddl::Client.new @a[3]
|
17
|
-
|
18
|
-
path = client.resource "/" + @a[4]
|
19
|
-
@status, result, headers = if @a[0].nil?
|
20
|
-
path.request @m => [ Riddl::Header.new("RIDDL_DECLARATION_RESOURCE", @a[2]), Riddl::Header.new("RIDDL-DECLARATION-PATH", @a[1]) ] + @h.map{|a,b| Riddl::Header.new(a,b)} + @p
|
21
|
-
else
|
22
|
-
path.request @m => [ Riddl::Header.new("RIDDL_DECLARATION_RESOURCE", @a[2]), Riddl::Header.new("RIDDL-DECLARATION-PATH", @a[1]) ] + @a[0].headers.map{|a,b| Riddl::Header.new(a,b)} + @a[0].response
|
23
|
-
end
|
24
|
-
headers.each do |k,v|
|
25
|
-
@headers << Riddl::Header.new(k,v) unless ["CONTENT_TYPE", "CONTENT_DISPOSITION", "RIDDL_TYPE", "CONTENT_ID", "CONTENT_LENGTH", "CONNECTION", "SERVER"].include?(k)
|
26
|
-
end
|
27
|
-
result
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
@@ -1,255 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<meta charset="UTF-8"/>
|
5
|
-
<meta http-equiv="X-UA-Compatible" content="IE=EDGE"/>
|
6
|
-
|
7
|
-
<title>Documentation</title>
|
8
|
-
|
9
|
-
<style>
|
10
|
-
body {
|
11
|
-
counter-reset: h1counter;
|
12
|
-
}
|
13
|
-
h1 { font-size: 1.5em; counter-reset: h2counter; }
|
14
|
-
h2 { font-size: 1.2em; }
|
15
|
-
h3 { font-size: 1.0em }
|
16
|
-
h1:before {
|
17
|
-
content: counter(h1counter) ".\0000a0\0000a0";
|
18
|
-
counter-increment: h1counter;
|
19
|
-
}
|
20
|
-
h2:before {
|
21
|
-
content: counter(h1counter) "." counter(h2counter) ".\0000a0\0000a0";
|
22
|
-
counter-increment: h2counter;
|
23
|
-
}
|
24
|
-
.code {
|
25
|
-
border: 1px dashed #425d73; background-color: #DEE6EE; margin:0px; padding: 0.5em 1em; font-family: monospace; font-size:0.9em;
|
26
|
-
}
|
27
|
-
</style>
|
28
|
-
|
29
|
-
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
|
30
|
-
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/3.5.0/lodash.min.js"></script>
|
31
|
-
<script src="https://cdnjs.cloudflare.com/ajax/libs/marked/0.3.2/marked.min.js"></script>
|
32
|
-
<script src="https://cdn.rawgit.com/vkiryukhin/vkBeautify/master/vkbeautify.js"></script>
|
33
|
-
<script>//<![CDATA[
|
34
|
-
$.fn.serializeXML = function(){
|
35
|
-
var out = '';
|
36
|
-
if (typeof XMLSerializer == 'function') {
|
37
|
-
var xs = new XMLSerializer();
|
38
|
-
this.each(function() {
|
39
|
-
out += xs.serializeToString(this);
|
40
|
-
});
|
41
|
-
} else if (this[0] && this[0].xml != 'undefined') {
|
42
|
-
this.each(function() {
|
43
|
-
out += this.xml;
|
44
|
-
});
|
45
|
-
}
|
46
|
-
return out;
|
47
|
-
};
|
48
|
-
|
49
|
-
function docChildren(path,name,data){
|
50
|
-
var ret= [];
|
51
|
-
var subject = path ? $(path,data) : $(data);
|
52
|
-
subject.children().each(function(k,ele){
|
53
|
-
if (ele.localName == name && ele.namespaceURI == "http://riddl.org/ns/documentation/1.0") {
|
54
|
-
ret.push(ele);
|
55
|
-
}
|
56
|
-
});
|
57
|
-
return $(ret);
|
58
|
-
}
|
59
|
-
|
60
|
-
function codeFormat(temp) {
|
61
|
-
temp = temp.replace(/\&/g,"&").replace(/\"/g,""").replace(/>/g,">").replace(/</g,"<").replace(/'/g,"'");
|
62
|
-
temp = temp.replace(/\t/g,' ');
|
63
|
-
temp = temp.replace(/\r/g,'');
|
64
|
-
temp = temp.replace(/^$/g,' ');
|
65
|
-
temp = temp.replace(/^ */gm,function mf(m){
|
66
|
-
var tm = (m.length + 2) * 0.6 + 2 * 0.6;
|
67
|
-
return "<div style='text-indent:-" + tm + "em;margin-left:" + tm + "em'>" + (Array(m.length + 1).join(" "));
|
68
|
-
});
|
69
|
-
temp = temp.replace(/ /g,"  ");
|
70
|
-
temp = temp.replace(/\n/g,"</div>\n");
|
71
|
-
temp += "</div>\n";
|
72
|
-
temp = temp.replace(/href="([^&]+)"/g,'href="<a href="/__doc_includes/$1">$1</a>"')
|
73
|
-
return temp;
|
74
|
-
}
|
75
|
-
|
76
|
-
$(document).ready(function(){
|
77
|
-
var rpath = "<%= @h['RIDDL_DECLARATION_PATH'] %>";
|
78
|
-
var pathele = _.compact(rpath.split('/'));
|
79
|
-
|
80
|
-
var t = $('#breadcrumblink')[0];
|
81
|
-
var link = "";
|
82
|
-
_.each(pathele,function(e){
|
83
|
-
link = link + "/" + e;
|
84
|
-
var clone = document.importNode(t.content, true);
|
85
|
-
$('a',clone).attr('href',link + "/?doc=true");
|
86
|
-
$('a',clone).text(e);
|
87
|
-
$('#breadcrumb').append(clone);
|
88
|
-
});
|
89
|
-
|
90
|
-
$.ajax({
|
91
|
-
url: rpath + "?riddl-resource-description",
|
92
|
-
success: function(data){
|
93
|
-
$('#main').append(marked(docChildren('description > resource','documentation',data).text()));
|
94
|
-
|
95
|
-
var subr = $('description > resource > resource',data);
|
96
|
-
if (subr.length == 0) {
|
97
|
-
$('#subresources').remove();
|
98
|
-
} else {
|
99
|
-
$('description > resource > resource',data).each(function(k,ele){
|
100
|
-
var sum = docChildren(null,'documentation',ele).attr('summary');
|
101
|
-
var exa = docChildren(null,'example',ele);
|
102
|
-
exa = exa.length == 0 ? null : exa.text();
|
103
|
-
if (exa) {
|
104
|
-
var rell = exa;
|
105
|
-
if ($(ele).attr('relative')) {
|
106
|
-
var relt = exa + ' (' + $(ele).attr('relative') + ')';
|
107
|
-
} else {
|
108
|
-
var relt = '{} (any string possible)';
|
109
|
-
}
|
110
|
-
} else {
|
111
|
-
var rell = $(ele).attr('relative');
|
112
|
-
var relt = _.trim(rell);
|
113
|
-
}
|
114
|
-
var t = $('#subresourceitem')[0];
|
115
|
-
var clone = document.importNode(t.content, true);
|
116
|
-
$('a',clone).attr('href','./' + rell + '/?doc=true');
|
117
|
-
if (relt != "") {
|
118
|
-
$('a',clone).text(relt);
|
119
|
-
}
|
120
|
-
if (sum) { $('.content',clone).text(sum); }
|
121
|
-
$('#subresources .anchor').append(clone);
|
122
|
-
});
|
123
|
-
}
|
124
|
-
|
125
|
-
var oprs = $('description > resource > get, description > resource > post, description > resource > put, description > resource > delete, description > resource > request',data);
|
126
|
-
if (oprs.length == 0) {
|
127
|
-
$('#operations').remove();
|
128
|
-
} else {
|
129
|
-
oprs.each(function(k,ele){
|
130
|
-
var sum = docChildren(null,'documentation',ele).attr('summary');
|
131
|
-
var details = docChildren(null,'documentation',ele).text();
|
132
|
-
var example = docChildren(null,'example',ele);
|
133
|
-
var ex = null;
|
134
|
-
|
135
|
-
var tin = $(ele).attr('in');
|
136
|
-
var tout = $(ele).attr('out');
|
137
|
-
var whatl = $(ele).prop('tagName');
|
138
|
-
var whatd = tin == "*" ? '' : '( ' + tin + ' )';
|
139
|
-
whatd += tout ? ' : ' + tout : '';
|
140
|
-
|
141
|
-
var tinmess = "";
|
142
|
-
if (tin && tin != "*") {
|
143
|
-
$('description > message[name="' + tin + '"]',data).each(function(k,mess){
|
144
|
-
tinmess = mess;
|
145
|
-
_.each(mess.attributes,function(attr){
|
146
|
-
if (attr.localName == 'example' && attr.namespaceURI == "http://riddl.org/ns/documentation/1.0") {
|
147
|
-
ex = attr.nodeValue;
|
148
|
-
}
|
149
|
-
});
|
150
|
-
});
|
151
|
-
}
|
152
|
-
if (example.length > 0) { ex = example.text(); }
|
153
|
-
|
154
|
-
var toutmess = "";
|
155
|
-
if (tout && tout != "*") {
|
156
|
-
$('description > message[name="' + tout + '"]',data).each(function(k,mess){
|
157
|
-
toutmess = mess;
|
158
|
-
});
|
159
|
-
}
|
160
|
-
|
161
|
-
// Overview
|
162
|
-
var t = $('#operationitem')[0];
|
163
|
-
var clone = document.importNode(t.content, true);
|
164
|
-
$('.what .link',clone).text(whatl);
|
165
|
-
$('.what .link',clone).attr('href','#' + (whatl + '_' + whatd).replace(/ /g,'_'));
|
166
|
-
$('.what .details',clone).text(whatd);
|
167
|
-
if (ex != null) {
|
168
|
-
if (ex == "")
|
169
|
-
$('.what .try a',clone).attr('href',window.location.pathname);
|
170
|
-
else
|
171
|
-
$('.what .try a',clone).attr('href','?' + ex);
|
172
|
-
} else {
|
173
|
-
$('.what .try',clone).remove();
|
174
|
-
}
|
175
|
-
if (sum) { $('.content',clone).text(sum); }
|
176
|
-
$('#operations .anchor').append(clone);
|
177
|
-
|
178
|
-
//Details
|
179
|
-
var t = $('#operationsec')[0];
|
180
|
-
var clone = document.importNode(t.content, true);
|
181
|
-
$('.what',clone).text(whatl + ' ' + whatd);
|
182
|
-
$('.what',clone).attr('id',(whatl + '_' + whatd).replace(/ /g,'_'));
|
183
|
-
if (_.trim(details) == "") {
|
184
|
-
$('.text',clone).text(sum);
|
185
|
-
} else {
|
186
|
-
$('.text',clone).append(marked(details));
|
187
|
-
}
|
188
|
-
if (ex != null) {
|
189
|
-
if (ex == "") {
|
190
|
-
$('.try a',clone).attr('href',window.location.pathname);
|
191
|
-
} else {
|
192
|
-
$('.try a',clone).attr('href','?' + ex);
|
193
|
-
$('.try a',clone).text('?' + ex);
|
194
|
-
}
|
195
|
-
} else {
|
196
|
-
$('.try',clone).remove();
|
197
|
-
}
|
198
|
-
|
199
|
-
if (tin && tin != "*") {
|
200
|
-
$('.input .message',clone).html(codeFormat(vkbeautify.xml($(tinmess).serializeXML(),' ')));
|
201
|
-
} else {
|
202
|
-
$('.input',clone).remove();
|
203
|
-
}
|
204
|
-
if (tout) {
|
205
|
-
$('.output .message',clone).html(codeFormat(vkbeautify.xml($(toutmess).serializeXML(),' ')));
|
206
|
-
} else {
|
207
|
-
$('.output',clone).remove();
|
208
|
-
}
|
209
|
-
$('#operations').append(clone);
|
210
|
-
});
|
211
|
-
}
|
212
|
-
}
|
213
|
-
});
|
214
|
-
});
|
215
|
-
//]]></script>
|
216
|
-
</head>
|
217
|
-
<body>
|
218
|
-
<template id="breadcrumblink"><span> / </span><a href=""></a></template>
|
219
|
-
<template id="subresourceitem"><li><div class='what'><a class='details' href=''>Example missing</a></div><div class="content"></div></li></template>
|
220
|
-
<template id="operationitem"><li><div class='what'><a class='link' href=''></a> <span class='details'></span> <span class='try'>(<a href=''>Try it!</a>)</span></div><div class="content"></div></li></template>
|
221
|
-
<template id="operationsec">
|
222
|
-
<section>
|
223
|
-
<h2 class="what" id=""></h2>
|
224
|
-
<p class="try">Example: <a href=""><i>no parameters</i></a></p>
|
225
|
-
<p class="text"></p>
|
226
|
-
<div class="input">
|
227
|
-
<h3>Input</h3>
|
228
|
-
<div class='message code'></div>
|
229
|
-
</div>
|
230
|
-
<div class="output">
|
231
|
-
<h3>Output</h3>
|
232
|
-
<div class='message code'></div>
|
233
|
-
</div>
|
234
|
-
</section>
|
235
|
-
</template>
|
236
|
-
|
237
|
-
<nav id="breadcrumb">[<a href="/">TOP</a>]</nav>
|
238
|
-
<section id="main"></section>
|
239
|
-
<section id="subresources">
|
240
|
-
<h1>Sub-Resources</h1>
|
241
|
-
<p>From here on you can go to the following sub resources:</p>
|
242
|
-
<ul class="anchor"></ul>
|
243
|
-
</section>
|
244
|
-
<section id="operations">
|
245
|
-
<h1>Operations</h1>
|
246
|
-
<section>
|
247
|
-
<p>For this resource the following operations are possible:</p>
|
248
|
-
<ul class="anchor"></ul>
|
249
|
-
</section>
|
250
|
-
</section>
|
251
|
-
</body>
|
252
|
-
</html>
|
253
|
-
|
254
|
-
|
255
|
-
|
@@ -1,14 +0,0 @@
|
|
1
|
-
require 'erb'
|
2
|
-
|
3
|
-
module Riddl
|
4
|
-
module Utils
|
5
|
-
|
6
|
-
class DocOverlay < Riddl::Implementation
|
7
|
-
def response
|
8
|
-
rval = ERB.new(File.read(File.dirname(__FILE__) + '/docoverlay.html'), 0, "%<>")
|
9
|
-
Riddl::Parameter::Complex.new('documentationresponse','text/html',rval.result(binding))
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
end
|
14
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
require 'mime/types'
|
2
|
-
require 'digest/md5'
|
3
|
-
|
4
|
-
module Riddl
|
5
|
-
module Utils
|
6
|
-
class Downloadify < Riddl::Implementation
|
7
|
-
def response
|
8
|
-
mimetype = @p.find{|e|e.name == 'mimetype'}.value
|
9
|
-
content = @p.find{|e|e.name == 'content'}.value
|
10
|
-
Riddl::Parameter::Complex.new("content",mimetype,content,@r.last)
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
data/lib/ruby/riddl/erbserve.rb
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
require 'mime/types'
|
2
|
-
require 'erb'
|
3
|
-
|
4
|
-
module Riddl
|
5
|
-
module Utils
|
6
|
-
class ERBServe < Riddl::Implementation
|
7
|
-
def response
|
8
|
-
path = File.file?(@a[0]) ? @a[0] : "#{@a[0]}/#{@r[@match.length..-1].join('/')}".gsub(/\/+/,'/')
|
9
|
-
input = @a[1]
|
10
|
-
if File.directory?(path)
|
11
|
-
@status = 404
|
12
|
-
return []
|
13
|
-
end
|
14
|
-
if File.exists?(path)
|
15
|
-
__ERB_FILE__ = path
|
16
|
-
rval = ERB.new(File.read(path), 0, "%<>")
|
17
|
-
return Riddl::Parameter::Complex.new("data",MIME::Types.type_for(path)[0].to_s,rval.result(binding))
|
18
|
-
end
|
19
|
-
@status = 404
|
20
|
-
[]
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|