rack-rscript 1.1.1 → 1.1.2
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/rack-rscript.rb +47 -6
- data.tar.gz.sig +5 -2
- metadata +2 -2
- metadata.gz.sig +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 67eaf987c95218ab325c90f6cdc5950a91d83ec4
|
4
|
+
data.tar.gz: b351e24514900fd5f9d9ac6db045e69799af0c75
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90139ab92d16f29258861fc9cfc11df3126aa4a59d41e511bcb5c9dd5fec15231dde62b287210a213da8452dd50604e4544727cb1772758274093f253c43fb7c
|
7
|
+
data.tar.gz: d220fbc8ee425c9e93bb61176eea4a51b5eb8176e5507e89559ff7df9deece05e90d32beacded05365e7a6bcebb86c253e86eff864802aa9313f9790d30cd67d
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/rack-rscript.rb
CHANGED
@@ -31,17 +31,22 @@ class RackRscript
|
|
31
31
|
|
32
32
|
|
33
33
|
def initialize(log: nil, pkg_src: '', cache: 5, rsc_host: 'rse',
|
34
|
-
rsc_package_src: nil, pxlinks: nil, debug: false
|
34
|
+
rsc_package_src: nil, pxlinks: nil, debug: false,
|
35
|
+
root: 'www', static: [])
|
36
|
+
|
37
|
+
@log, @debug, @static = log, debug, static
|
38
|
+
|
39
|
+
puts '@app_root: ' + @app_root.inspect if @debug
|
40
|
+
puts 'root: ' + root.inspect if @debug
|
35
41
|
|
36
42
|
@params = {}
|
43
|
+
|
37
44
|
@templates = {}
|
38
45
|
|
39
46
|
@rrscript = RScript.new log: log, pkg_src: pkg_src, cache: cache
|
40
47
|
|
41
48
|
@url_base = pkg_src # web server serving the RSF files
|
42
|
-
@url_base += '/' unless @url_base[-1] == '/'
|
43
|
-
|
44
|
-
@log, @debug = log, debug
|
49
|
+
@url_base += '/' unless @url_base[-1] == '/'
|
45
50
|
|
46
51
|
if pxlinks then
|
47
52
|
|
@@ -65,6 +70,12 @@ class RackRscript
|
|
65
70
|
|
66
71
|
@rsc = nil
|
67
72
|
@rsc = RSC.new rsc_host, rsc_package_src if rsc_package_src
|
73
|
+
|
74
|
+
@filetype = {xml: 'application/xml', html: 'text/html', png: 'image/png',
|
75
|
+
jpg: 'image/jpeg', txt: 'text/plain', css: 'text/css',
|
76
|
+
xsl: 'application/xml', svg: 'image/svg+xml'}
|
77
|
+
|
78
|
+
@root, @static = root, static
|
68
79
|
|
69
80
|
end
|
70
81
|
|
@@ -130,7 +141,7 @@ class RackRscript
|
|
130
141
|
'application/json' => passthru_proc,
|
131
142
|
'image/png' => passthru_proc,
|
132
143
|
'image/jpeg' => passthru_proc,
|
133
|
-
'image/svg+xml' => passthru_proc
|
144
|
+
'image/svg+xml' => passthru_proc
|
134
145
|
}
|
135
146
|
|
136
147
|
content_type ||= 'text/html'
|
@@ -263,7 +274,37 @@ class RackRscript
|
|
263
274
|
'application/json']
|
264
275
|
|
265
276
|
end
|
266
|
-
|
277
|
+
|
278
|
+
get /^(\/(?:#{@static.join('|')}).*)/ do |path|
|
279
|
+
|
280
|
+
puts 'path: ' + path.inspect if @debug
|
281
|
+
filepath = File.join(@app_root, @root, path )
|
282
|
+
|
283
|
+
if @log then
|
284
|
+
@log.info 'DandelionS1/default_routes: ' +
|
285
|
+
"root: %s path: %s" % [@root, path]
|
286
|
+
end
|
287
|
+
|
288
|
+
if path.length < 1 or path[-1] == '/' then
|
289
|
+
path += 'index.html'
|
290
|
+
File.read filepath
|
291
|
+
elsif File.directory? filepath then
|
292
|
+
Redirect.new (path + '/')
|
293
|
+
elsif File.exists? filepath then
|
294
|
+
|
295
|
+
content_type = @filetype[filepath[/\w+$/].to_sym]
|
296
|
+
[File.read(filepath), content_type || 'text/plain']
|
297
|
+
else
|
298
|
+
'oops, file ' + filepath + ' not found'
|
299
|
+
end
|
300
|
+
|
301
|
+
end
|
302
|
+
|
303
|
+
get /^\/$/ do
|
304
|
+
|
305
|
+
file = File.join(@root, 'index.html')
|
306
|
+
File.read file
|
307
|
+
end
|
267
308
|
|
268
309
|
end
|
269
310
|
|
data.tar.gz.sig
CHANGED
@@ -1,2 +1,5 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
[��M�K�P�zM4b*���Y�Y)n%A �<��S��i4Y��̇�vx��3x�TeF��6�F<|
|
2
|
+
��r!-GcWe�9Ż0�/Mb��=(Ft����q��qN���#�P|��s��-��,v�2�O��o}
|
3
|
+
�˞��
|
4
|
+
^�w��%D�#��
|
5
|
+
���sp���у����}Ge�o�喘}�V�s%�eEB#;����������=r
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-rscript
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
31
31
|
vvLi4Y0qQy/Uz/kHVXzfeLcG657aNIu8ogA1I3Xnlz0sqlNoDhk5sSBd2BsfkVFS
|
32
32
|
sTo/69YTrLx1zw==
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date: 2018-
|
34
|
+
date: 2018-07-22 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rack
|
metadata.gz.sig
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
T��ѝ`�G��g�.�PŦâ(e,�k^UU/L/���F�~`>�@@��4��h=[ad��|�YGC�c`li',U�חM��ؾ+(�j�xF ��=q�vM"sss O�:���.dpg�~10u+#�:K�="����3�*�4�Y�H��F����qvT�"fL�G�'��RqW�cj��&f��;�O�D���1<����ok�����v����ܧF%|��ܷX�9�P�%�>C*THt;`L�
|