rscript 0.1.18 → 0.1.19

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3cd9913db1e9daf774da2dc91a1fee0427da24c2
4
- data.tar.gz: 8085e7359ef897a5fed6744243aa812d41183109
3
+ metadata.gz: 9c705ac08971d5107f144f4d25125e0ffd0d8eb8
4
+ data.tar.gz: b9e18e18e81827b96a77af285eb52fddca178ccf
5
5
  SHA512:
6
- metadata.gz: a1f6728c5d886c807f4de9bcd4d7805e01bd2d52a6e2f732f481e26a21c9547b704020d6f306ea5b88475f130235909d93df8f0e10392c8959806cfeffd618bf
7
- data.tar.gz: c1c78c772b71c09b577d35219daec7b197b94c005755533875f87b70e868ae8a63832b79b4e606f4d28ad483ddfa8d6b5d00c862c951303b3b1a80f2f0239764
6
+ metadata.gz: 0cff8c7c26434bc826115d66e90d3a1a9a35200b05bba34cb4c45bae61f091982c03c52e5f00ad59494cfdf933f1a39f6f1feb12e7a6a35a3c739d193cd11502
7
+ data.tar.gz: 7002a8234ed9ac5767796f17d69b4c70ff4c3498f12d67c254a5bd57b2603691df1265f415b004d359f2044632f6fe26423af253be8f727b218966f0e3829f01
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/lib/rscript.rb CHANGED
@@ -1,6 +1,14 @@
1
1
  #!/usr/bin/env ruby
2
+
2
3
  #file: rscript.rb
3
4
 
5
+ # created: 1-Jul-2009
6
+ # updated: 08-Aug-2013
7
+
8
+ # modification:
9
+
10
+ # 08-Aug-2013: re-enabled the hashcache;
11
+ # 24-Jun-2011: disabled the hashcache
4
12
 
5
13
  # description
6
14
  # - This script executes Ruby script contained within an XML file.
@@ -18,14 +26,14 @@
18
26
  # MIT license - basically you can do anything you like with the script.
19
27
  # http://www.opensource.org/licenses/mit-license.php
20
28
 
21
-
22
29
  require 'rscript_base'
23
30
  require 'hashcache'
24
31
 
32
+
25
33
  class RScript < RScriptBase
26
34
 
27
- def initialize()
28
- @rsf_cache = HashCache.new(cache: 5)
35
+ def initialize(opt={})
36
+ @rsf_cache = HashCache.new({cache: 5}.merge(opt))
29
37
  end
30
38
 
31
39
  def read(args=[])
@@ -58,6 +66,38 @@ class RScript < RScriptBase
58
66
  def reset()
59
67
  @rsf_cache.reset
60
68
  end
69
+
70
+ # note: run() was copied from the development file rscript-wrapper.rb
71
+ def run(raw_args, params={}, rws=nil)
72
+
73
+ if params[:splat] then
74
+ params.each do |k,v|
75
+ params.delete k unless k == :splat or k == :package or k == :job or k == :captures
76
+ end
77
+ end
78
+
79
+ if params[:splat] and params[:splat].length > 0 then
80
+ h = params[:splat].first[1..-1].split('&').inject({}) do |r,x|
81
+ k, v = x.split('=')
82
+ v ? r.merge(k[/\w+$/].to_sym => v) : r
83
+ end
84
+ params.merge! h
85
+ end
86
+
87
+ code2, args = self.read raw_args
88
+
89
+ begin
90
+
91
+ r = eval code2
92
+ params = {}
93
+ return r
94
+
95
+ rescue Exception => e
96
+ params = {}
97
+ err_label = e.message.to_s + " :: \n" + e.backtrace.join("\n")
98
+ return err_label
99
+ end
100
+ end
61
101
 
62
102
  private
63
103
 
@@ -68,6 +108,7 @@ class RScript < RScriptBase
68
108
 
69
109
  @url_base = rsfile[/\w+:\/\/[^\/]+/]
70
110
  buffer = @rsf_cache.read(rsfile) {read_sourcecode(rsfile) }
111
+ #jr080813 buffer = read_sourcecode(rsfile)
71
112
 
72
113
  doc = Document.new(buffer)
73
114
  yield(doc)
@@ -80,6 +121,7 @@ class RScript < RScriptBase
80
121
 
81
122
  $rsfile = rsfile[/[^\/]+(?=\.rsf)/]
82
123
  buffer = @rsf_cache.read(rsfile) {read_sourcecode(rsfile) }
124
+ #jr080813 buffer = read_sourcecode(rsfile)
83
125
  @url_base = rsfile[/\w+:\/\/[^\/]+/]
84
126
  doc = Document.new(buffer)
85
127
  yield(doc)
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.1.18
4
+ version: 0.1.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -29,7 +29,7 @@ cert_chain:
29
29
  2tHFESql9unw2f1cmqvD6DMfA2vVH7UJJoxEbkE1ECWj9QoYqYpgDvaSp0Z0WYD1
30
30
  Xj5QxdIHOcsEDKdkQpPw4y7x8lNM2Bww
31
31
  -----END CERTIFICATE-----
32
- date: 2013-07-27 00:00:00.000000000 Z
32
+ date: 2013-08-08 00:00:00.000000000 Z
33
33
  dependencies:
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: hashcache
metadata.gz.sig CHANGED
Binary file