rack-rscript 1.3.0 → 1.4.1

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
  SHA256:
3
- metadata.gz: c7d34cb833bf0422cdcde6fbd6ca2af9f4c6dbb5588d83cb72a4ff53cb3ad938
4
- data.tar.gz: 4e20d1dd5709d4fbbf3bf05c6696947a0474b4c5047512cd41ca8a67181d66e4
3
+ metadata.gz: be378f63ca9f58403060beb22da0eda891f9f1f3d4472340a4062c4ea5a97cf0
4
+ data.tar.gz: 9f9fa92fd555a7c3e0ef87106d1e2daf174476ed5e46556cba62df9811d967d4
5
5
  SHA512:
6
- metadata.gz: f1ac22e48c0333b4a1892dee3d7885e14bf7aa5f8b5f8816f31a3f94718ebcc9e92f0f9faaa089f6baa781a86cf34ebeebd967d54531e444d26dd45eec9a4bdb
7
- data.tar.gz: 3b0620c345d7933bfb9bd9b0bd5f2e176e63925a6e33c1146de5939aa99bee0859d3b5a6912100857378d74d20b78f9afb1f4b9e27b2cac1315a29b9df1c34d9
6
+ metadata.gz: 9fc83c3c44f23cbcedf53d0d71092105b8fbb4e90f4f9149c84ad0208fa11b3bb96f1ee5d7ebabc0cd60fa3bfa290d746bee90d195eec559a70002629ed48ea8
7
+ data.tar.gz: 8c850d980a395a8084f5febbf43374702cb6e42330c16a0d0061b3b8111ead777e9b167e41d100ef9b3e659953909b166e007cad7445ca5727d43a90000692c2
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/rack-rscript.rb CHANGED
@@ -14,6 +14,7 @@ require 'app-routes'
14
14
  require 'uri'
15
15
  require 'polyrex-links'
16
16
  require 'nthrut'
17
+ require 'rxfreadwrite'
17
18
 
18
19
 
19
20
  class Redirect
@@ -32,7 +33,7 @@ end
32
33
 
33
34
  class RackRscript
34
35
  include AppRoutes
35
- include RXFHelperModule
36
+ include RXFReadWriteModule
36
37
  using ColouredText
37
38
 
38
39
  attr_reader :req, :rsc
@@ -43,14 +44,15 @@ class RackRscript
43
44
  pxlinks: nil, debug: false, root: '', static: {})
44
45
 
45
46
  @log, @debug, @static = log, debug, static
46
- #=begin
47
- puts '@app_root: ' + @app_root.inspect if @debug
47
+
48
48
  puts 'root: ' + root.inspect if @debug
49
+ puts 'pkg_Src: ' + pkg_src.inspect if @debug
49
50
 
50
51
  @params = {}
51
52
 
52
53
  @templates = {}
53
54
 
55
+ @log.debug 'pkg_src: ' + pkg_src.inspect if @log
54
56
  @rscript = RScriptRW.new log: log, pkg_src: pkg_src, cache: cache, debug: true
55
57
  @render = NThrut.new(self)
56
58
 
@@ -59,7 +61,7 @@ class RackRscript
59
61
 
60
62
  if pxlinks then
61
63
 
62
- src, _ = RXFHelper.read(pxlinks)
64
+ src, _ = RXFReader.read(pxlinks)
63
65
 
64
66
  if src =~ /^<\?/ then
65
67
 
@@ -89,7 +91,7 @@ class RackRscript
89
91
 
90
92
  @root, @static = root, static
91
93
  @initialized = {}
92
- #=end
94
+
93
95
  end
94
96
 
95
97
  def call(env, testmode: false)
@@ -191,7 +193,6 @@ class RackRscript
191
193
  @initialized[url] = true
192
194
  end
193
195
 
194
-
195
196
  r = eval result
196
197
 
197
198
  return r
@@ -283,7 +284,7 @@ class RackRscript
283
284
 
284
285
  begin
285
286
 
286
- [RXFHelper.read(url).first,'text/plain']
287
+ [RXFReader.read(url).first,'text/plain']
287
288
 
288
289
  rescue
289
290
 
@@ -298,7 +299,7 @@ class RackRscript
298
299
  FileX.exists? @url_base
299
300
  filepath = @url_base
300
301
 
301
- [Dir.glob(filepath + '/*.rsf').map{|x| x[/([^\/]+)\.rsf$/,1]}.to_json,\
302
+ [DirX.glob(filepath + '/*.rsf').map{|x| x[/([^\/]+)\.rsf$/,1]}.to_json,\
302
303
  'application/json']
303
304
 
304
305
  end
@@ -313,7 +314,7 @@ class RackRscript
313
314
 
314
315
  path = raw_path
315
316
  puts 'path: ' + path.inspect if @debug
316
- filepath = File.join(@app_root, @root, path )
317
+ filepath = File.join(@root, path )
317
318
 
318
319
  else
319
320
 
@@ -343,30 +344,20 @@ class RackRscript
343
344
  end
344
345
 
345
346
  end
347
+
346
348
  end
347
349
 
348
350
  get /^\/$/ do
349
351
 
350
352
  if @root.length > 0 then
351
353
  file = File.join(@root, 'index.html')
352
- File.read file
354
+ FileX.read file
353
355
  else
354
356
  Time.now.inspect
355
357
  end
356
358
 
357
359
  end
358
360
 
359
- # file exists?
360
- a = Dir.glob( File.join(@root.to_s, '*')).select do |x|
361
- File::ftype(x) == 'directory'
362
- end
363
-
364
- get /^\/#{a.join('|')}/ do
365
-
366
- 'found' + a.inspect
367
-
368
- end
369
-
370
361
  end
371
362
 
372
363
  def run_request(request)
@@ -428,6 +419,17 @@ class RackRscript
428
419
  proc ||= passthru_proc
429
420
  content, content_type = proc.call(content, content_type)
430
421
 
422
+ if content_type.is_a? Integer then
423
+
424
+ status_code = content_type.to_s
425
+ httpcodefile = File.join(@root, status_code + '.html')
426
+ if FileX.exists? httpcodefile then
427
+ content = FileX.read(httpcodefile)
428
+ else
429
+ content_type = 'text/plain'
430
+ end
431
+ end
432
+
431
433
  [status_code, {"Content-Type" => content_type}, [content]]
432
434
  end
433
435
 
data.tar.gz.sig CHANGED
Binary file
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.3.0
4
+ version: 1.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -35,7 +35,7 @@ cert_chain:
35
35
  uQ8ts8x2DfuJYY/PmLbqwXkzMzb1EgnUBWZ3mZCdlL0UBst5ypPAFTn1b2qRUC92
36
36
  UtKkOrrEmCXrBnFtpv6a1ULk
37
37
  -----END CERTIFICATE-----
38
- date: 2022-01-15 00:00:00.000000000 Z
38
+ date: 2022-05-02 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: rack
@@ -81,22 +81,42 @@ dependencies:
81
81
  name: rscript
82
82
  requirement: !ruby/object:Gem::Requirement
83
83
  requirements:
84
- - - ">="
85
- - !ruby/object:Gem::Version
86
- version: 0.8.0
87
84
  - - "~>"
88
85
  - !ruby/object:Gem::Version
89
- version: '0.8'
86
+ version: '0.9'
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: 0.9.0
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '0.9'
94
97
  - - ">="
95
98
  - !ruby/object:Gem::Version
96
- version: 0.8.0
99
+ version: 0.9.0
100
+ - !ruby/object:Gem::Dependency
101
+ name: haml
102
+ requirement: !ruby/object:Gem::Requirement
103
+ requirements:
97
104
  - - "~>"
98
105
  - !ruby/object:Gem::Version
99
- version: '0.8'
106
+ version: '5.2'
107
+ - - ">="
108
+ - !ruby/object:Gem::Version
109
+ version: 5.2.2
110
+ type: :runtime
111
+ prerelease: false
112
+ version_requirements: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - "~>"
115
+ - !ruby/object:Gem::Version
116
+ version: '5.2'
117
+ - - ">="
118
+ - !ruby/object:Gem::Version
119
+ version: 5.2.2
100
120
  - !ruby/object:Gem::Dependency
101
121
  name: tilt
102
122
  requirement: !ruby/object:Gem::Requirement
@@ -121,102 +141,102 @@ dependencies:
121
141
  name: slim
122
142
  requirement: !ruby/object:Gem::Requirement
123
143
  requirements:
124
- - - ">="
125
- - !ruby/object:Gem::Version
126
- version: 4.1.0
127
144
  - - "~>"
128
145
  - !ruby/object:Gem::Version
129
146
  version: '4.1'
147
+ - - ">="
148
+ - !ruby/object:Gem::Version
149
+ version: 4.1.0
130
150
  type: :runtime
131
151
  prerelease: false
132
152
  version_requirements: !ruby/object:Gem::Requirement
133
153
  requirements:
134
- - - ">="
135
- - !ruby/object:Gem::Version
136
- version: 4.1.0
137
154
  - - "~>"
138
155
  - !ruby/object:Gem::Version
139
156
  version: '4.1'
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: 4.1.0
140
160
  - !ruby/object:Gem::Dependency
141
161
  name: rexslt
142
162
  requirement: !ruby/object:Gem::Requirement
143
163
  requirements:
144
- - - ">="
145
- - !ruby/object:Gem::Version
146
- version: 0.7.0
147
164
  - - "~>"
148
165
  - !ruby/object:Gem::Version
149
- version: '0.7'
166
+ version: '0.8'
167
+ - - ">="
168
+ - !ruby/object:Gem::Version
169
+ version: 0.8.0
150
170
  type: :runtime
151
171
  prerelease: false
152
172
  version_requirements: !ruby/object:Gem::Requirement
153
173
  requirements:
154
- - - ">="
155
- - !ruby/object:Gem::Version
156
- version: 0.7.0
157
174
  - - "~>"
158
175
  - !ruby/object:Gem::Version
159
- version: '0.7'
176
+ version: '0.8'
177
+ - - ">="
178
+ - !ruby/object:Gem::Version
179
+ version: 0.8.0
160
180
  - !ruby/object:Gem::Dependency
161
181
  name: rsc
162
182
  requirement: !ruby/object:Gem::Requirement
163
183
  requirements:
164
184
  - - "~>"
165
185
  - !ruby/object:Gem::Version
166
- version: '0.4'
186
+ version: '0.5'
167
187
  - - ">="
168
188
  - !ruby/object:Gem::Version
169
- version: 0.4.5
189
+ version: 0.5.0
170
190
  type: :runtime
171
191
  prerelease: false
172
192
  version_requirements: !ruby/object:Gem::Requirement
173
193
  requirements:
174
194
  - - "~>"
175
195
  - !ruby/object:Gem::Version
176
- version: '0.4'
196
+ version: '0.5'
177
197
  - - ">="
178
198
  - !ruby/object:Gem::Version
179
- version: 0.4.5
199
+ version: 0.5.0
180
200
  - !ruby/object:Gem::Dependency
181
201
  name: polyrex-links
182
202
  requirement: !ruby/object:Gem::Requirement
183
203
  requirements:
184
204
  - - "~>"
185
205
  - !ruby/object:Gem::Version
186
- version: '0.4'
206
+ version: '0.5'
187
207
  - - ">="
188
208
  - !ruby/object:Gem::Version
189
- version: 0.4.3
209
+ version: 0.5.0
190
210
  type: :runtime
191
211
  prerelease: false
192
212
  version_requirements: !ruby/object:Gem::Requirement
193
213
  requirements:
194
214
  - - "~>"
195
215
  - !ruby/object:Gem::Version
196
- version: '0.4'
216
+ version: '0.5'
197
217
  - - ">="
198
218
  - !ruby/object:Gem::Version
199
- version: 0.4.3
219
+ version: 0.5.0
200
220
  - !ruby/object:Gem::Dependency
201
221
  name: nthrut
202
222
  requirement: !ruby/object:Gem::Requirement
203
223
  requirements:
204
- - - ">="
205
- - !ruby/object:Gem::Version
206
- version: 0.1.0
207
224
  - - "~>"
208
225
  - !ruby/object:Gem::Version
209
226
  version: '0.1'
227
+ - - ">="
228
+ - !ruby/object:Gem::Version
229
+ version: 0.1.0
210
230
  type: :runtime
211
231
  prerelease: false
212
232
  version_requirements: !ruby/object:Gem::Requirement
213
233
  requirements:
214
- - - ">="
215
- - !ruby/object:Gem::Version
216
- version: 0.1.0
217
234
  - - "~>"
218
235
  - !ruby/object:Gem::Version
219
236
  version: '0.1'
237
+ - - ">="
238
+ - !ruby/object:Gem::Version
239
+ version: 0.1.0
220
240
  description:
221
241
  email: digital.robertson@gmail.com
222
242
  executables: []
@@ -243,8 +263,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
243
263
  - !ruby/object:Gem::Version
244
264
  version: '0'
245
265
  requirements: []
246
- rubyforge_project:
247
- rubygems_version: 2.7.10
266
+ rubygems_version: 3.2.22
248
267
  signing_key:
249
268
  specification_version: 4
250
269
  summary: Rack-Rscript is a light-weight alternative to Sinatra-Rscript.
metadata.gz.sig CHANGED
Binary file