rscript 0.6.1 → 0.8.0
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.tar.gz.sig +0 -0
- data/lib/rscript.rb +68 -7
- data/lib/rscript_base.rb +16 -3
- metadata +39 -35
- 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: b07cead05d35529f8891fe210ec1c0b1d49c8cdf153ea67dff5f1e4c1f8e3175
|
4
|
+
data.tar.gz: ab3b6d8d7b72609adb786be4fdc46cc4d867c78a4bbebc1a993a7df8fbad6a8c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d6380efacb9670cf49a7be6ec261b3769d1b813d639365952923b1d47dab024251e5d8050fdde69085d5206f98e0c40ba513a17de6f70cdfa9004414407dcf5
|
7
|
+
data.tar.gz: a880349b7f95b215cdb3589b4915cf39cc562cc22b6f86f0c28e1da84d05bd539dabf825a4121c4c0d44845221634067269e9eac7fdedd56efe57e138323abfd
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/rscript.rb
CHANGED
@@ -3,11 +3,14 @@
|
|
3
3
|
# file: rscript.rb
|
4
4
|
|
5
5
|
# created: 1-Jul-2009
|
6
|
-
# updated:
|
6
|
+
# updated: 00-Mar-2019
|
7
7
|
|
8
8
|
# modification:
|
9
9
|
|
10
|
-
#
|
10
|
+
# 00-Mar-2019: feature: An explicit path or implicit path now can be
|
11
|
+
# specified in the src attribute
|
12
|
+
# 05-Mar-2019: feature: Added the class RScriptRW for :get, :post typed jobs
|
13
|
+
# 13-Oct-2018: bug fix: The log is now only written when the log exists
|
11
14
|
# 30-Jul-2018: feature: A list of job ids can now be returned
|
12
15
|
# 28-Jul-2018: feature: Jobs are now looked up from a Hash object
|
13
16
|
# 13-Jul-2018: bug fix: The use of a cache is now optional
|
@@ -25,7 +28,6 @@
|
|
25
28
|
# 08-Aug-2013: re-enabled the hashcache;
|
26
29
|
# 24-Jun-2011: disabled the hashcache
|
27
30
|
|
28
|
-
|
29
31
|
# description
|
30
32
|
# - This script executes Ruby script contained within an XML file.
|
31
33
|
# - The XML file can be stored locally or on a website.
|
@@ -42,7 +44,6 @@
|
|
42
44
|
# MIT license - basically you can do anything you like with the script.
|
43
45
|
# http://www.opensource.org/licenses/mit-license.php
|
44
46
|
|
45
|
-
|
46
47
|
require 'rscript_base'
|
47
48
|
require 'hashcache'
|
48
49
|
require 'rexle'
|
@@ -139,7 +140,7 @@ class RScript < RScriptBase
|
|
139
140
|
rescue Exception => e
|
140
141
|
params = {}
|
141
142
|
err_label = e.message.to_s + " :: \n" + e.backtrace.join("\n")
|
142
|
-
@log.debug 'rscrcript/error: ' + err_label
|
143
|
+
@log.debug 'rscrcript/error: ' + err_label if @log
|
143
144
|
return err_label
|
144
145
|
end
|
145
146
|
|
@@ -170,19 +171,79 @@ class RScript < RScriptBase
|
|
170
171
|
puts 'args: ' + args.inspect if @debug
|
171
172
|
rsfile = args[0]; args.shift
|
172
173
|
|
174
|
+
url = File.dirname rsfile
|
175
|
+
@url_dir = url[/(?:\w+:\/\/|.*)[^\/]*(\/.*)/,1]
|
176
|
+
@url_base = url[/(\w+:\/\/[^\/]+|.*)/]
|
177
|
+
|
173
178
|
$rsfile = rsfile[/[^\/]+(?=\.rsf)/]
|
174
179
|
|
175
180
|
a = @cache ? @rsf_cache.read(rsfile) { build_a(rsfile) } : build_a(rsfile)
|
176
181
|
puts 'read_rsfdoc a: ' + a.inspect if @debug
|
177
182
|
|
178
|
-
|
179
|
-
|
183
|
+
|
184
|
+
|
180
185
|
return a
|
181
186
|
|
182
187
|
end
|
183
188
|
|
184
189
|
end
|
185
190
|
|
191
|
+
|
192
|
+
class RScriptRW < RScript
|
193
|
+
|
194
|
+
attr_accessor :type
|
195
|
+
|
196
|
+
|
197
|
+
def read(args=[])
|
198
|
+
|
199
|
+
puts 'inside read' if @debug
|
200
|
+
@log.info 'RScript/read: args: ' + args.inspect if @log
|
201
|
+
@log.info 'RScript/read: type: ' + type.inspect if @log
|
202
|
+
|
203
|
+
threads = []
|
204
|
+
|
205
|
+
if args.to_s[/\/\/job:/] then
|
206
|
+
|
207
|
+
ajob = ''
|
208
|
+
|
209
|
+
args.each_index do |i|
|
210
|
+
if args[i].to_s[/\/\/job:/] then
|
211
|
+
ajob = $'; args[i] = nil
|
212
|
+
end
|
213
|
+
end
|
214
|
+
|
215
|
+
args.compact!
|
216
|
+
|
217
|
+
if @debug then
|
218
|
+
puts 'type: ' + self.type.to_s.inspect
|
219
|
+
puts 'self.type: ' + self.type.to_s.inspect
|
220
|
+
end
|
221
|
+
|
222
|
+
a = read_rsfdoc(args)
|
223
|
+
job = a.find do |xy|
|
224
|
+
name, x = xy
|
225
|
+
name == ajob.to_sym and
|
226
|
+
(x[:attributes][:type] || self.type.to_s) == self.type.to_s
|
227
|
+
end.last
|
228
|
+
|
229
|
+
out, attr = job[:code], job[:attributes]
|
230
|
+
|
231
|
+
raise "job not found" unless out.length > 0
|
232
|
+
out
|
233
|
+
|
234
|
+
else
|
235
|
+
out = read_rsfdoc(args).map {|x| x.last[:code]}.join("\n")
|
236
|
+
end
|
237
|
+
|
238
|
+
@log.info 'RScript/read: code: ' + out.inspect if @log
|
239
|
+
|
240
|
+
[out, args]
|
241
|
+
|
242
|
+
end
|
243
|
+
|
244
|
+
end
|
245
|
+
|
246
|
+
|
186
247
|
if __FILE__ == $0 then
|
187
248
|
raw_args = ARGV
|
188
249
|
rs = RScript.new()
|
data/lib/rscript_base.rb
CHANGED
@@ -7,6 +7,7 @@ require 'open-uri'
|
|
7
7
|
require 'rxfhelper'
|
8
8
|
|
9
9
|
class RScriptBase
|
10
|
+
using ColouredText
|
10
11
|
|
11
12
|
def initialize(debug: false)
|
12
13
|
@debug = debug
|
@@ -19,7 +20,7 @@ class RScriptBase
|
|
19
20
|
protected
|
20
21
|
|
21
22
|
def read_script(script)
|
22
|
-
puts 'inside read_script' if @debug
|
23
|
+
puts 'inside read_script'.info if @debug
|
23
24
|
out_buffer = ''
|
24
25
|
|
25
26
|
src = script.attributes[:src]
|
@@ -34,8 +35,20 @@ class RScriptBase
|
|
34
35
|
end
|
35
36
|
|
36
37
|
def read_sourcecode(rsf)
|
37
|
-
|
38
|
-
|
38
|
+
|
39
|
+
puts 'inside read_sourcecode'.info if @debug
|
40
|
+
#@log.debug 'rsf: ' + rsf.inspect if @log
|
41
|
+
#@log.debug 'url_base: ' + @url_base.inspect if @log
|
42
|
+
|
43
|
+
path = case rsf
|
44
|
+
when /^\//
|
45
|
+
@url_base =~ /^\// ? rsf : File.join(@url_base, rsf)
|
46
|
+
when /\w+:/ then rsf
|
47
|
+
else
|
48
|
+
File.join(@url_base, @url_dir, rsf)
|
49
|
+
end
|
50
|
+
|
51
|
+
buffer, _ = RXFHelper.read path, auto: false
|
39
52
|
return buffer
|
40
53
|
end
|
41
54
|
|
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.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -10,28 +10,32 @@ bindir: bin
|
|
10
10
|
cert_chain:
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
+
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
13
|
+
MIIEXjCCAsagAwIBAgIBATANBgkqhkiG9w0BAQsFADAsMSowKAYDVQQDDC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3iPdsojq86ufufV61Xkc14mpz+fUWU2VdroG9
|
29
|
+
huoZOAoN0Bb5hH+yUxp74Mdis4Dd/hQR7UmEyI2YenTCQBYVzRKCQn9pM1GNCLFT
|
30
|
+
axEP9+TDEUZ5p3d7zijxUHStLSN3sT07VlPAJi1epgApr1VWUPZeope+LzJ4FgIV
|
31
|
+
yNQvC+tEvCDRt9AlYrqLkBRP/13Y3QzRt9BAHTECvI4w0TFt+QSjsn0/S56lMmMa
|
32
|
+
CZEcadTp4hkcSmMIe7A7vtxVHe849KYfzEYi/qtO4LS982Z+S/ux7FXXUmPDQOwD
|
33
|
+
m5SFg/ZFmb7WExgWgNKbYrUWEmSsm+xe0mlbUGEnWSLt/uNpOBLGM5IJGpX+5JQ3
|
34
|
+
uWeajwwVVZPE2QKim8r6XvB4MTDCnxuvjRopZt7gL5sO7M3Xo6xN9D1lEc38waAp
|
35
|
+
+FYkMWMJr0Q+j8gatLKPMMXUVyXLLdoSrSf7XsgtksSmBAw0g5bWydgHUgly8WES
|
36
|
+
tOpPd7kzbjjcuqoPnHSqclFI
|
33
37
|
-----END CERTIFICATE-----
|
34
|
-
date:
|
38
|
+
date: 2020-06-11 00:00:00.000000000 Z
|
35
39
|
dependencies:
|
36
40
|
- !ruby/object:Gem::Dependency
|
37
41
|
name: hashcache
|
@@ -57,42 +61,42 @@ dependencies:
|
|
57
61
|
name: rxfhelper
|
58
62
|
requirement: !ruby/object:Gem::Requirement
|
59
63
|
requirements:
|
60
|
-
- - "~>"
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
version: '0.8'
|
63
64
|
- - ">="
|
64
65
|
- !ruby/object:Gem::Version
|
65
|
-
version: 0.
|
66
|
+
version: 1.0.0
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '1.0'
|
66
70
|
type: :runtime
|
67
71
|
prerelease: false
|
68
72
|
version_requirements: !ruby/object:Gem::Requirement
|
69
73
|
requirements:
|
70
|
-
- - "~>"
|
71
|
-
- !ruby/object:Gem::Version
|
72
|
-
version: '0.8'
|
73
74
|
- - ">="
|
74
75
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.
|
76
|
+
version: 1.0.0
|
77
|
+
- - "~>"
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '1.0'
|
76
80
|
- !ruby/object:Gem::Dependency
|
77
81
|
name: rexle
|
78
82
|
requirement: !ruby/object:Gem::Requirement
|
79
83
|
requirements:
|
80
84
|
- - "~>"
|
81
85
|
- !ruby/object:Gem::Version
|
82
|
-
version: '1.
|
86
|
+
version: '1.5'
|
83
87
|
- - ">="
|
84
88
|
- !ruby/object:Gem::Version
|
85
|
-
version: 1.
|
89
|
+
version: 1.5.6
|
86
90
|
type: :runtime
|
87
91
|
prerelease: false
|
88
92
|
version_requirements: !ruby/object:Gem::Requirement
|
89
93
|
requirements:
|
90
94
|
- - "~>"
|
91
95
|
- !ruby/object:Gem::Version
|
92
|
-
version: '1.
|
96
|
+
version: '1.5'
|
93
97
|
- - ">="
|
94
98
|
- !ruby/object:Gem::Version
|
95
|
-
version: 1.
|
99
|
+
version: 1.5.6
|
96
100
|
description:
|
97
101
|
email: james@jamesrobertson.eu
|
98
102
|
executables: []
|
@@ -121,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
121
125
|
version: '0'
|
122
126
|
requirements: []
|
123
127
|
rubyforge_project:
|
124
|
-
rubygems_version: 2.7.
|
128
|
+
rubygems_version: 2.7.10
|
125
129
|
signing_key:
|
126
130
|
specification_version: 4
|
127
131
|
summary: Reads or executes a job contained within a package (XML document), whereby
|
metadata.gz.sig
CHANGED
Binary file
|