rscript 0.7.0 → 0.9.0
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
- checksums.yaml.gz.sig +0 -0
- data/lib/rscript.rb +66 -58
- data/lib/rscript_base.rb +30 -14
- data.tar.gz.sig +0 -0
- metadata +33 -33
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4790f50f6b960f81bb273f841ec59e8e6bdc0553d651a6ff0d4ceeb7d8a7bece
|
4
|
+
data.tar.gz: 7ae85febaa15bd76547e2402398df203ff2675021686be3672b101ffdbf68b28
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94de2eb3ee1fe8ce0817c3edd5ef2829ff23efb379ce23292ba738fd5dfb019be34b636bc044b01dd6b2858cc6474ec1390050579fe8a7b660d5fe327a3a64ca
|
7
|
+
data.tar.gz: 1a0493e7665bf829b0f251e92bc226af8a33cd0021050c29942884c8254a89dade8e97950e7cc091c8633578db0613fa2289fb4d994d483b1530d5457c53d618
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/rscript.rb
CHANGED
@@ -3,10 +3,13 @@
|
|
3
3
|
# file: rscript.rb
|
4
4
|
|
5
5
|
# created: 1-Jul-2009
|
6
|
-
# updated:
|
6
|
+
# updated: 22-Feb-2022
|
7
7
|
|
8
8
|
# modification:
|
9
9
|
|
10
|
+
# 21-Feb-2022: minor improvement: Replaced RXFHelper with RXFReader
|
11
|
+
# 00-Mar-2019: feature: An explicit path or implicit path now can be
|
12
|
+
# specified in the src attribute
|
10
13
|
# 05-Mar-2019: feature: Added the class RScriptRW for :get, :post typed jobs
|
11
14
|
# 13-Oct-2018: bug fix: The log is now only written when the log exists
|
12
15
|
# 30-Jul-2018: feature: A list of job ids can now be returned
|
@@ -47,61 +50,6 @@ require 'hashcache'
|
|
47
50
|
require 'rexle'
|
48
51
|
|
49
52
|
|
50
|
-
class RScriptRW < RScript
|
51
|
-
|
52
|
-
attr_accessor :type
|
53
|
-
|
54
|
-
|
55
|
-
def read(args=[])
|
56
|
-
|
57
|
-
puts 'inside read' if @debug
|
58
|
-
@log.info 'RScript/read: args: ' + args.inspect if @log
|
59
|
-
@log.info 'RScript/read: type: ' + type.inspect if @log
|
60
|
-
|
61
|
-
threads = []
|
62
|
-
|
63
|
-
if args.to_s[/\/\/job:/] then
|
64
|
-
|
65
|
-
ajob = ''
|
66
|
-
|
67
|
-
args.each_index do |i|
|
68
|
-
if args[i].to_s[/\/\/job:/] then
|
69
|
-
ajob = $'; args[i] = nil
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
args.compact!
|
74
|
-
|
75
|
-
if @debug then
|
76
|
-
puts 'type: ' + self.type.to_s.inspect
|
77
|
-
puts 'self.type: ' + self.type.to_s.inspect
|
78
|
-
end
|
79
|
-
|
80
|
-
a = read_rsfdoc(args)
|
81
|
-
job = a.find do |xy|
|
82
|
-
name, x = xy
|
83
|
-
name == ajob.to_sym and
|
84
|
-
(x[:attributes][:type] || self.type.to_s) == self.type.to_s
|
85
|
-
end.last
|
86
|
-
|
87
|
-
out, attr = job[:code], job[:attributes]
|
88
|
-
|
89
|
-
raise "job not found" unless out.length > 0
|
90
|
-
out
|
91
|
-
|
92
|
-
else
|
93
|
-
out = read_rsfdoc(args).map {|x| x.last[:code]}.join("\n")
|
94
|
-
end
|
95
|
-
|
96
|
-
@log.info 'RScript/read: code: ' + out.inspect if @log
|
97
|
-
|
98
|
-
[out, args]
|
99
|
-
|
100
|
-
end
|
101
|
-
|
102
|
-
end
|
103
|
-
|
104
|
-
|
105
53
|
class RScript < RScriptBase
|
106
54
|
|
107
55
|
def initialize(log: nil, pkg_src: '', cache: 5, debug: false, type: 'job')
|
@@ -224,19 +172,79 @@ class RScript < RScriptBase
|
|
224
172
|
puts 'args: ' + args.inspect if @debug
|
225
173
|
rsfile = args[0]; args.shift
|
226
174
|
|
175
|
+
url = File.dirname rsfile
|
176
|
+
@url_dir = url[/(?:\w+:\/\/|.*)[^\/]*(\/.*)/,1]
|
177
|
+
@url_base = url[/(\w+:\/\/[^\/]+|.*)/]
|
178
|
+
|
227
179
|
$rsfile = rsfile[/[^\/]+(?=\.rsf)/]
|
228
180
|
|
229
181
|
a = @cache ? @rsf_cache.read(rsfile) { build_a(rsfile) } : build_a(rsfile)
|
230
182
|
puts 'read_rsfdoc a: ' + a.inspect if @debug
|
231
183
|
|
232
|
-
|
233
|
-
|
184
|
+
|
185
|
+
|
234
186
|
return a
|
235
187
|
|
236
188
|
end
|
237
189
|
|
238
190
|
end
|
239
191
|
|
192
|
+
|
193
|
+
class RScriptRW < RScript
|
194
|
+
|
195
|
+
attr_accessor :type
|
196
|
+
|
197
|
+
|
198
|
+
def read(args=[])
|
199
|
+
|
200
|
+
puts 'inside read' if @debug
|
201
|
+
@log.info 'RScript/read: args: ' + args.inspect if @log
|
202
|
+
@log.info 'RScript/read: type: ' + type.inspect if @log
|
203
|
+
|
204
|
+
threads = []
|
205
|
+
|
206
|
+
if args.to_s[/\/\/job:/] then
|
207
|
+
|
208
|
+
ajob = ''
|
209
|
+
|
210
|
+
args.each_index do |i|
|
211
|
+
if args[i].to_s[/\/\/job:/] then
|
212
|
+
ajob = $'; args[i] = nil
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
216
|
+
args.compact!
|
217
|
+
|
218
|
+
if @debug then
|
219
|
+
puts 'type: ' + self.type.to_s.inspect
|
220
|
+
puts 'self.type: ' + self.type.to_s.inspect
|
221
|
+
end
|
222
|
+
|
223
|
+
a = read_rsfdoc(args)
|
224
|
+
job = a.find do |xy|
|
225
|
+
name, x = xy
|
226
|
+
name == ajob.to_sym and
|
227
|
+
(x[:attributes][:type] || self.type.to_s) == self.type.to_s
|
228
|
+
end.last
|
229
|
+
|
230
|
+
out, attr = job[:code], job[:attributes]
|
231
|
+
|
232
|
+
raise "job not found" unless out.length > 0
|
233
|
+
out
|
234
|
+
|
235
|
+
else
|
236
|
+
out = read_rsfdoc(args).map {|x| x.last[:code]}.join("\n")
|
237
|
+
end
|
238
|
+
|
239
|
+
@log.info 'RScript/read: code: ' + out.inspect if @log
|
240
|
+
|
241
|
+
[out, args]
|
242
|
+
|
243
|
+
end
|
244
|
+
|
245
|
+
end
|
246
|
+
|
247
|
+
|
240
248
|
if __FILE__ == $0 then
|
241
249
|
raw_args = ARGV
|
242
250
|
rs = RScript.new()
|
data/lib/rscript_base.rb
CHANGED
@@ -3,25 +3,25 @@
|
|
3
3
|
# file: rscript_base.rb
|
4
4
|
|
5
5
|
require 'cgi'
|
6
|
-
require '
|
7
|
-
require 'rxfhelper'
|
6
|
+
require 'rxfreader'
|
8
7
|
|
9
8
|
class RScriptBase
|
10
|
-
|
9
|
+
using ColouredText
|
10
|
+
|
11
11
|
def initialize(debug: false)
|
12
12
|
@debug = debug
|
13
13
|
end
|
14
|
-
|
14
|
+
|
15
15
|
def read(doc)
|
16
16
|
doc.root.xpath('//script').map {|s| run_script(s)}.join(';')
|
17
17
|
end
|
18
|
-
|
18
|
+
|
19
19
|
protected
|
20
|
-
|
20
|
+
|
21
21
|
def read_script(script)
|
22
|
-
puts 'inside read_script' if @debug
|
22
|
+
puts 'inside read_script'.info if @debug
|
23
23
|
out_buffer = ''
|
24
|
-
|
24
|
+
|
25
25
|
src = script.attributes[:src]
|
26
26
|
|
27
27
|
out_buffer = if src then
|
@@ -29,14 +29,30 @@ class RScriptBase
|
|
29
29
|
else
|
30
30
|
script.texts.join("\n")
|
31
31
|
end
|
32
|
-
|
32
|
+
|
33
33
|
out_buffer
|
34
34
|
end
|
35
|
-
|
35
|
+
|
36
36
|
def read_sourcecode(rsf)
|
37
|
-
|
38
|
-
|
37
|
+
|
38
|
+
if @debug then
|
39
|
+
puts 'inside read_sourcecode'.info
|
40
|
+
puts 'detail: ' + [@url_base, @url_dir, rsf].inspect
|
41
|
+
end
|
42
|
+
|
43
|
+
@log.debug 'rsf: ' + rsf.inspect if @log
|
44
|
+
@log.debug 'url_base: ' + @url_base.inspect if @log
|
45
|
+
|
46
|
+
path = case rsf
|
47
|
+
when /^\//
|
48
|
+
@url_base =~ /^\// ? rsf : File.join(@url_base, rsf)
|
49
|
+
when /\w+:/ then rsf
|
50
|
+
else
|
51
|
+
File.join(@url_base, @url_dir, rsf)
|
52
|
+
end
|
53
|
+
puts 'rsf: ' + rsf.inspect
|
54
|
+
buffer, _ = RXFReader.read path
|
39
55
|
return buffer
|
40
|
-
end
|
41
|
-
|
56
|
+
end
|
57
|
+
|
42
58
|
end
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rscript
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -11,31 +11,31 @@ cert_chain:
|
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
13
|
MIIEXjCCAsagAwIBAgIBATANBgkqhkiG9w0BAQsFADAsMSowKAYDVQQDDCFnZW1t
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
14
|
+
YXN0ZXIvREM9amFtZXNyb2JlcnRzb24vREM9ZXUwHhcNMjIwMjIxMTUxNjIyWhcN
|
15
|
+
MjMwMjIxMTUxNjIyWjAsMSowKAYDVQQDDCFnZW1tYXN0ZXIvREM9amFtZXNyb2Jl
|
16
|
+
cnRzb24vREM9ZXUwggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQCmNvi/
|
17
|
+
gqRQ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3udVTEgmGNjejZpUSOOR2NIF7dj
|
31
|
+
i6a6w57f7kwG0pMIMqKD0IohECFc+3mvzQmTX5sOm1o5ITxtBOoWeqWk/SB3uJf3
|
32
|
+
T2Vv48vVRO4SHki9XRZUnuzzpTPEGIXgs/u7IiXy7WwUMKe0A3A9r3MM2/ooOJgZ
|
33
|
+
OYYvbCRN0NfVMAvdW/q5tHioydGQUKrVl7VoJuYaw2KYiLSkRpP09E1cgI4N4Lso
|
34
|
+
Z+jP6eKXREq7KG102Al+w798XKl8ODIo1///pbYPQztK+in5U1BmGTIHaBWghvNU
|
35
|
+
NVWX/OCQ9q6PFpdhMmSrfvWwCgVWyBrDS2VtD1ywkwcKvaWXd5xZDUIirRuvoDRt
|
36
|
+
JVO4YXQhPNQq3usjz6cW4O+B
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date:
|
38
|
+
date: 2022-02-21 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: hashcache
|
@@ -58,25 +58,25 @@ dependencies:
|
|
58
58
|
- !ruby/object:Gem::Version
|
59
59
|
version: 0.2.10
|
60
60
|
- !ruby/object:Gem::Dependency
|
61
|
-
name:
|
61
|
+
name: rxfreader
|
62
62
|
requirement: !ruby/object:Gem::Requirement
|
63
63
|
requirements:
|
64
64
|
- - "~>"
|
65
65
|
- !ruby/object:Gem::Version
|
66
|
-
version: '0.
|
66
|
+
version: '0.1'
|
67
67
|
- - ">="
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: 0.
|
69
|
+
version: 0.1.2
|
70
70
|
type: :runtime
|
71
71
|
prerelease: false
|
72
72
|
version_requirements: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
74
|
- - "~>"
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version: '0.
|
76
|
+
version: '0.1'
|
77
77
|
- - ">="
|
78
78
|
- !ruby/object:Gem::Version
|
79
|
-
version: 0.
|
79
|
+
version: 0.1.2
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: rexle
|
82
82
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,7 +86,7 @@ dependencies:
|
|
86
86
|
version: '1.5'
|
87
87
|
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 1.5.
|
89
|
+
version: 1.5.14
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -96,9 +96,9 @@ dependencies:
|
|
96
96
|
version: '1.5'
|
97
97
|
- - ">="
|
98
98
|
- !ruby/object:Gem::Version
|
99
|
-
version: 1.5.
|
99
|
+
version: 1.5.14
|
100
100
|
description:
|
101
|
-
email:
|
101
|
+
email: digital.robertson@gmail.com
|
102
102
|
executables: []
|
103
103
|
extensions: []
|
104
104
|
extra_rdoc_files: []
|
@@ -124,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
124
124
|
- !ruby/object:Gem::Version
|
125
125
|
version: '0'
|
126
126
|
requirements: []
|
127
|
-
rubygems_version: 3.
|
127
|
+
rubygems_version: 3.2.22
|
128
128
|
signing_key:
|
129
129
|
specification_version: 4
|
130
130
|
summary: Reads or executes a job contained within a package (XML document), whereby
|
metadata.gz.sig
CHANGED
Binary file
|