rscript 0.2.2 → 0.2.3
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 +41 -11
- metadata +18 -18
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8faefa337d623421e570cb61a2ac888a90bd5664
|
4
|
+
data.tar.gz: 6436e9b81657b714c67102715cbfe2d9e7c27b21
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f28100568f554d9e421fa691884fdd081bf789437c1a33000ddfc4051ed91ced83dd050c776fe424dce13578e9ec3b0e034ca64b14cab0328782198d611ec8c
|
7
|
+
data.tar.gz: 9a02566bcad1e99f4f23aa22ad8ccc43351065682dced270d5502e0567d095aa416bcf9701298a4e1a6c3db0006fb413bbc80fd4d003988bebee22f8a7e489c1
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/rscript.rb
CHANGED
@@ -4,10 +4,11 @@
|
|
4
4
|
|
5
5
|
|
6
6
|
# created: 1-Jul-2009
|
7
|
-
# updated:
|
7
|
+
# updated: 14-Jan-2016
|
8
8
|
|
9
9
|
# modification:
|
10
10
|
|
11
|
+
# 14-Jan-2016: Replaced the simple thread with just the eval
|
11
12
|
# 29-Jan-2015: Replaced REXML with Rexle
|
12
13
|
# 06-Nov-2013: An error is now raised if the job doesn't exist
|
13
14
|
# 02-Nov-2013: Replaced XThreads with a simle thread
|
@@ -39,12 +40,24 @@ require 'rexle'
|
|
39
40
|
|
40
41
|
class RScript < RScriptBase
|
41
42
|
|
42
|
-
def initialize(opt={})
|
43
|
+
def initialize(opt={}, log: nil)
|
44
|
+
|
45
|
+
@logger = Logger.new log, 'daily' if log
|
43
46
|
@rsf_cache = HashCache.new({cache: 5}.merge(opt))
|
47
|
+
|
44
48
|
end
|
45
49
|
|
46
50
|
def read(args=[])
|
51
|
+
|
52
|
+
if @logger then
|
53
|
+
|
54
|
+
@logger.debug 'inside RScript#read'
|
55
|
+
@logger.debug 'RScript -> args: ' + args.inspect
|
56
|
+
|
57
|
+
end
|
58
|
+
|
47
59
|
threads = []
|
60
|
+
|
48
61
|
if args.to_s[/\/\/job:/] then
|
49
62
|
|
50
63
|
ajob = []
|
@@ -67,8 +80,10 @@ class RScript < RScriptBase
|
|
67
80
|
out
|
68
81
|
|
69
82
|
else
|
70
|
-
out = read_rsf(args) {|doc| doc.root.xpath('//script').map {|s| read_script(s)}}
|
71
|
-
end
|
83
|
+
out = read_rsf(args) {|doc| doc.root.xpath('//script').map {|s| read_script(s)}}.join("\n")
|
84
|
+
end
|
85
|
+
|
86
|
+
@logger.debug 'RScript -> out: ' + out.inspect if @logger
|
72
87
|
|
73
88
|
[out, args]
|
74
89
|
end
|
@@ -80,6 +95,11 @@ class RScript < RScriptBase
|
|
80
95
|
# note: run() was copied from the development file rscript-wrapper.rb
|
81
96
|
def run(raw_args, params={}, rws=nil)
|
82
97
|
|
98
|
+
if @logger then
|
99
|
+
@logger.debug 'inside RScript#run'
|
100
|
+
@logger.debug 'RScript -> raw_args: ' + raw_args.inspect
|
101
|
+
end
|
102
|
+
|
83
103
|
if params[:splat] then
|
84
104
|
params.each do |k,v|
|
85
105
|
params.delete k unless k == :splat or k == :package or k == :job or k == :captures
|
@@ -93,16 +113,26 @@ class RScript < RScriptBase
|
|
93
113
|
end
|
94
114
|
params.merge! h
|
95
115
|
end
|
96
|
-
|
116
|
+
|
97
117
|
code2, args = self.read raw_args
|
118
|
+
@logger.debug 'RScript -> code2: ' + code2.inspect if @logger
|
98
119
|
|
99
120
|
begin
|
100
121
|
|
101
|
-
|
102
|
-
thread = Thread.new(code2)
|
122
|
+
=begin
|
123
|
+
thread = Thread.new(code2) do |x|
|
124
|
+
|
125
|
+
begin
|
126
|
+
Thread.current['result'] = eval x
|
127
|
+
rescue
|
128
|
+
@logger.debug('RScript -> eval: ' + ($!).inspect) if @logger
|
129
|
+
end
|
130
|
+
|
131
|
+
end
|
103
132
|
thread.join
|
104
|
-
|
105
|
-
r =
|
133
|
+
=end
|
134
|
+
r = eval code2
|
135
|
+
#r = thread['result']
|
106
136
|
|
107
137
|
params = {}
|
108
138
|
return r
|
@@ -115,6 +145,7 @@ class RScript < RScriptBase
|
|
115
145
|
end
|
116
146
|
|
117
147
|
private
|
148
|
+
|
118
149
|
|
119
150
|
def read_doc_rsf(args=[])
|
120
151
|
rsfile = args[0]; args.shift
|
@@ -123,7 +154,6 @@ class RScript < RScriptBase
|
|
123
154
|
|
124
155
|
@url_base = rsfile[/\w+:\/\/[^\/]+/]
|
125
156
|
buffer = @rsf_cache.read(rsfile) {read_sourcecode(rsfile) }
|
126
|
-
#jr080813 buffer = read_sourcecode(rsfile)
|
127
157
|
|
128
158
|
doc = Rexle.new(buffer)
|
129
159
|
yield(doc)
|
@@ -133,7 +163,7 @@ class RScript < RScriptBase
|
|
133
163
|
|
134
164
|
def read_rsf(args=[])
|
135
165
|
rsfile = args[0]; args.shift
|
136
|
-
|
166
|
+
|
137
167
|
$rsfile = rsfile[/[^\/]+(?=\.rsf)/]
|
138
168
|
buffer = @rsf_cache.read(rsfile) {read_sourcecode(rsfile) }
|
139
169
|
|
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.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -12,26 +12,26 @@ cert_chain:
|
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
13
|
MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
|
14
14
|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Vdfe0gI1
|
27
|
+
uKeSkQHKe0vwnvce9vHVPXAJgDsDTtvh0qPKFK6yjbbyVxKumM5K6h9geeQ43hBX
|
28
|
+
uoGDJ7oHNsBX0LaS9Tb7234YNbKuSty2fLNIoiAuvegboOlQT+BREUmY4HKHmpqQ
|
29
|
+
a9NTgF8PnZYcuD+sl2tTLihBgFLzQ9GMIEck+lHJGF7ml4ZAY8u4683at1t3U32Y
|
30
|
+
LyOfovuK6uJvyL7lh1NOOcMSjGSyEYgA47VfYXNVkgIBCwGpyekoH+51vUiSIEDd
|
31
|
+
iYiOpzs0Jmv4jizUQGqzjOvyRUQTlYG2IDutjigLuyZllxXvxAcdRXKarC+qvESI
|
32
|
+
fb096Gf6Ao7H/w==
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date:
|
34
|
+
date: 2016-01-14 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: hashcache
|
@@ -121,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
121
121
|
version: '0'
|
122
122
|
requirements: []
|
123
123
|
rubyforge_project:
|
124
|
-
rubygems_version: 2.
|
124
|
+
rubygems_version: 2.4.8
|
125
125
|
signing_key:
|
126
126
|
specification_version: 4
|
127
127
|
summary: rscript previously known as rcscript, reads Ruby code which is embedded within
|
metadata.gz.sig
CHANGED
Binary file
|