rack-rscript 1.0.3 → 1.1.0

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: 9db9fa568d06145a2a371e101192f7f3ba83cf84
4
- data.tar.gz: c9f8c35902f09eded70172c9029e50b50d619c0e
3
+ metadata.gz: 523ccdc7482629668d72db9ae7d19f32489d3c03
4
+ data.tar.gz: 2af4afa75c948b00471848a332baf8f1ed6d037d
5
5
  SHA512:
6
- metadata.gz: 5a3b657413de54bb9cc2f009cbb1506a5d18b64aeb66d1c0b70ba9adf0bfbbe164bd5cdb695bd575537b80e23b2e9b40856a22761a7da454762dc20515d1cd4a
7
- data.tar.gz: efbd6e4c1cb895e358cd4e58eccd255a4114da8f93125029451ab45d84562274eac41a958efa56ab203c48fd5b6e7324b73ad1faa0089b71cfcda89afb0185c0
6
+ metadata.gz: a55dc1a1acf4ea09685297d88bf66dce79b30f5b96320d4236ba3a58b7cb15cd923ba1d77a4a3da7514e53d9b444dcaf15442729281134c524db87f3c7e7623e
7
+ data.tar.gz: ce31ddb9811cce088e7ec76f8734dedf59f1f6270e00a2c7301d643779f58ab72a90627e8f72d6baa95f851a728d18786baa6e6a54ca9e1911c503dbb60aa3e2
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -12,6 +12,7 @@ require 'rexslt'
12
12
  require 'rscript'
13
13
  require 'app-routes'
14
14
  require 'uri'
15
+ require 'polyrex-links'
15
16
 
16
17
 
17
18
  class Redirect
@@ -29,8 +30,8 @@ class RackRscript
29
30
  include AppRoutes
30
31
 
31
32
 
32
- def initialize(log: nil, pkg_src: '', cache: 5,
33
- rsc_host: 'rse', rsc_package_src: nil)
33
+ def initialize(log: nil, pkg_src: '', cache: 5, rsc_host: 'rse',
34
+ rsc_package_src: nil, pxlinks: nil, debug: false)
34
35
 
35
36
  @params = {}
36
37
  @templates = {}
@@ -40,9 +41,24 @@ class RackRscript
40
41
  @url_base = pkg_src # web server serving the RSF files
41
42
  @url_base += '/' unless @url_base[-1] == '/'
42
43
 
43
- @log = log
44
-
45
-
44
+ @log, @debug = log, debug
45
+
46
+ if pxlinks then
47
+
48
+ src, _ = RXFHelper.read(pxlinks)
49
+
50
+ if src =~ /^<\?/ then
51
+
52
+ @pxlinks = PolyrexLinks.new src
53
+
54
+ else
55
+
56
+ @pxlinks = PolyrexLinks.new
57
+ @pxlinks.parse pxlinks
58
+
59
+ end
60
+
61
+ end
46
62
 
47
63
  super() # required for app-routes initialize method to exectue
48
64
  default_routes(@env, @params)
@@ -55,13 +71,21 @@ class RackRscript
55
71
  def call(env)
56
72
 
57
73
  @env = env
58
- request = env['REQUEST_URI'][/https?:\/\/[^\/]+(.*)/,1]
74
+ raw_request = env['REQUEST_URI'][/https?:\/\/[^\/]+(.*)/,1]
59
75
 
60
76
  @log.info 'RackRscript/call: ' + env.inspect if @log
61
77
  req = Rack::Request.new(env)
62
78
 
63
79
  @req_params = req.params
64
80
  default_routes(env,@params)
81
+
82
+ request = if @pxlinks then
83
+ found = @pxlinks.locate(raw_request)
84
+ found ? found.join : raw_request
85
+ else
86
+ raw_request
87
+ end
88
+
65
89
  content, content_type, status_code = run_route(request, env['REQUEST_METHOD'])
66
90
 
67
91
  if content.is_a? Redirect then
@@ -117,7 +141,7 @@ class RackRscript
117
141
 
118
142
  [status_code, {"Content-Type" => content_type}, [content]]
119
143
  end
120
- end
144
+ end
121
145
 
122
146
  def clear_cache()
123
147
  @rrscript.reset
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.0.3
4
+ version: 1.1.0
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: 2017-12-18 00:00:00.000000000 Z
34
+ date: 2018-03-31 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rack
@@ -42,7 +42,7 @@ dependencies:
42
42
  version: '2.0'
43
43
  - - ">="
44
44
  - !ruby/object:Gem::Version
45
- version: 2.0.3
45
+ version: 2.0.4
46
46
  type: :runtime
47
47
  prerelease: false
48
48
  version_requirements: !ruby/object:Gem::Requirement
@@ -52,7 +52,7 @@ dependencies:
52
52
  version: '2.0'
53
53
  - - ">="
54
54
  - !ruby/object:Gem::Version
55
- version: 2.0.3
55
+ version: 2.0.4
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: app-routes
58
58
  requirement: !ruby/object:Gem::Requirement
@@ -82,7 +82,7 @@ dependencies:
82
82
  version: '0.4'
83
83
  - - ">="
84
84
  - !ruby/object:Gem::Version
85
- version: 0.4.0
85
+ version: 0.4.1
86
86
  type: :runtime
87
87
  prerelease: false
88
88
  version_requirements: !ruby/object:Gem::Requirement
@@ -92,7 +92,7 @@ dependencies:
92
92
  version: '0.4'
93
93
  - - ">="
94
94
  - !ruby/object:Gem::Version
95
- version: 0.4.0
95
+ version: 0.4.1
96
96
  - !ruby/object:Gem::Dependency
97
97
  name: tilt
98
98
  requirement: !ruby/object:Gem::Requirement
@@ -162,7 +162,7 @@ dependencies:
162
162
  version: '0.6'
163
163
  - - ">="
164
164
  - !ruby/object:Gem::Version
165
- version: 0.6.9
165
+ version: 0.6.11
166
166
  type: :runtime
167
167
  prerelease: false
168
168
  version_requirements: !ruby/object:Gem::Requirement
@@ -172,27 +172,47 @@ dependencies:
172
172
  version: '0.6'
173
173
  - - ">="
174
174
  - !ruby/object:Gem::Version
175
- version: 0.6.9
175
+ version: 0.6.11
176
176
  - !ruby/object:Gem::Dependency
177
177
  name: rsc
178
178
  requirement: !ruby/object:Gem::Requirement
179
179
  requirements:
180
180
  - - "~>"
181
181
  - !ruby/object:Gem::Version
182
- version: '0.2'
182
+ version: '0.3'
183
183
  - - ">="
184
184
  - !ruby/object:Gem::Version
185
- version: 0.2.2
185
+ version: 0.3.2
186
186
  type: :runtime
187
187
  prerelease: false
188
188
  version_requirements: !ruby/object:Gem::Requirement
189
189
  requirements:
190
190
  - - "~>"
191
191
  - !ruby/object:Gem::Version
192
- version: '0.2'
192
+ version: '0.3'
193
193
  - - ">="
194
194
  - !ruby/object:Gem::Version
195
- version: 0.2.2
195
+ version: 0.3.2
196
+ - !ruby/object:Gem::Dependency
197
+ name: polyrex-links
198
+ requirement: !ruby/object:Gem::Requirement
199
+ requirements:
200
+ - - "~>"
201
+ - !ruby/object:Gem::Version
202
+ version: '0.1'
203
+ - - ">="
204
+ - !ruby/object:Gem::Version
205
+ version: 0.1.10
206
+ type: :runtime
207
+ prerelease: false
208
+ version_requirements: !ruby/object:Gem::Requirement
209
+ requirements:
210
+ - - "~>"
211
+ - !ruby/object:Gem::Version
212
+ version: '0.1'
213
+ - - ">="
214
+ - !ruby/object:Gem::Version
215
+ version: 0.1.10
196
216
  description:
197
217
  email: james@jamesrobertson.eu
198
218
  executables: []
metadata.gz.sig CHANGED
Binary file