rscript 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (6) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/lib/rscript.rb +41 -11
  5. metadata +18 -18
  6. metadata.gz.sig +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 85499beaf8d024ecdb086bb4dd070f81f91b485a
4
- data.tar.gz: 5e9fcdcd242c20dca80c9277be5136ec0ea743f5
3
+ metadata.gz: 8faefa337d623421e570cb61a2ac888a90bd5664
4
+ data.tar.gz: 6436e9b81657b714c67102715cbfe2d9e7c27b21
5
5
  SHA512:
6
- metadata.gz: 20e45654ab3efda5e766914fafbb9e069d21bb0ca13df2d4de705cf1dbf0e58d2d68e9deb601834f2c4cd8408cce16bc691a3bc3ee659c297caf02641d1d690e
7
- data.tar.gz: 9d735160d60cbfe35ff812ad6b75ec10feed8aac59bfb0bcc71e9e6bc51269e6570bd24076be33c7f4fbd90e6353b9050386386cd09c3590f0bd432f4777681c
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: 29-Jan-2015
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) {|x| Thread.current['result'] = eval x}
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
- #r = eval code2
105
- r = thread['result']
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.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
  YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
15
- 8ixkARkWAmV1MB4XDTE0MDcxMzAyMjk1MloXDTE1MDcxMzAyMjk1MlowSDESMBAG
15
+ 8ixkARkWAmV1MB4XDTE2MDExNDIxMzM1N1oXDTE3MDExMzIxMzM1N1owSDESMBAG
16
16
  A1UEAwwJZ2VtbWFzd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VgFmAwJgYDVR0RBB8w
25
25
  HYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1h
26
- c3RlckBqYW1lc3JvYmVydHNvbi5ldTANBgkqhkiG9w0BAQUFAAOCAQEA220n1IXw
27
- i3erJ2iIDJ61vT2DCq6jaOZojqLfGtHB3LaxnkigU5CYi2ChXyj7JOc14tlbBjyW
28
- 4pP6iBrTSscaFDvsfAlfUpQeOHEY9P0+K0z7l2rqZYOX0JiZ5kLzkI7505bWzVGK
29
- qPuANvQy2ySAImuXX5NZCbykQRyTqL4QjnW58yGmt6Wd4S235Bx7qqYTk91IgOdk
30
- 1JLY8tOB6wkf024VN5odwy8jLcHAUFaUg8YMJeK/jmPw/Ewb4QdAelAl+2lAoGh2
31
- pTl90ccAo96Myith2+5jI2p1BAoSjDRNTv+Uz21Zp7x1b0lFfXtaZ4FK5hu/B+DM
32
- B4M/dUmu40qQLg==
26
+ c3RlckBqYW1lc3JvYmVydHNvbi5ldTANBgkqhkiG9w0BAQUFAAOCAQEAVdfe0gI1
27
+ uKeSkQHKe0vwnvce9vHVPXAJgDsDTtvh0qPKFK6yjbbyVxKumM5K6h9geeQ43hBX
28
+ uoGDJ7oHNsBX0LaS9Tb7234YNbKuSty2fLNIoiAuvegboOlQT+BREUmY4HKHmpqQ
29
+ a9NTgF8PnZYcuD+sl2tTLihBgFLzQ9GMIEck+lHJGF7ml4ZAY8u4683at1t3U32Y
30
+ LyOfovuK6uJvyL7lh1NOOcMSjGSyEYgA47VfYXNVkgIBCwGpyekoH+51vUiSIEDd
31
+ iYiOpzs0Jmv4jizUQGqzjOvyRUQTlYG2IDutjigLuyZllxXvxAcdRXKarC+qvESI
32
+ fb096Gf6Ao7H/w==
33
33
  -----END CERTIFICATE-----
34
- date: 2015-01-30 00:00:00.000000000 Z
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.2.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