cpee-eval-ruby 1.0.7 → 1.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/cpee-eval-ruby.gemspec +1 -1
- data/lib/cpee-eval-ruby/implementation.rb +5 -4
- data/lib/cpee-eval-ruby/implementation.xml +2 -8
- data/lib/cpee-eval-ruby/translation.rb +13 -6
- data/server/eval-ruby.pid +1 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 84fc79790dae3221f52506e89cac2873c3b87df3b453f28fcf66e6274fbbe9ed
|
4
|
+
data.tar.gz: 024a8c81054a23b338d794898fa8f459f6b603eca6aa53fab2c507d414243c35
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e24df120022480933494c3040f9e47589a6bb410433e152a89a91d14c9ff5e5b564f63bf341b53db84e72ab6515df36d437493103dbb1c0be94cb19bb06a0e40
|
7
|
+
data.tar.gz: 7d9d35d776ea27611803bbd3a20ea5635b0c2027df74e885ae52e21e48df0ce1d8386fd8becc6567007efa1e573d7c070db059e0370a30c586b05e9b436a9b6b
|
data/cpee-eval-ruby.gemspec
CHANGED
@@ -24,6 +24,7 @@ require 'uri'
|
|
24
24
|
require 'redis'
|
25
25
|
require 'json'
|
26
26
|
require 'weel'
|
27
|
+
require 'charlock_holmes'
|
27
28
|
require_relative 'translation'
|
28
29
|
|
29
30
|
module CPEE
|
@@ -35,7 +36,7 @@ module CPEE
|
|
35
36
|
def exec(__struct,__code,result=nil,headers=nil)
|
36
37
|
__ret = {}
|
37
38
|
__cat = catch WEEL::Signal::Again do
|
38
|
-
__ret[:res] = __struct.instance_eval(__code)
|
39
|
+
__ret[:res] = JSON::generate(__struct.instance_eval(__code))
|
39
40
|
WEEL::Signal::Proceed
|
40
41
|
end
|
41
42
|
if __cat.nil? || __cat == WEEL::Signal::Again
|
@@ -87,7 +88,7 @@ module CPEE
|
|
87
88
|
execresult = exec struct, code, CPEE::EvalRuby::Translation::simplify_structurized_result(call_result), call_headers
|
88
89
|
|
89
90
|
send = []
|
90
|
-
send << Riddl::Parameter::
|
91
|
+
send << Riddl::Parameter::Complex.new('result','application/json',execresult[:res] || '')
|
91
92
|
if execresult[:signal]
|
92
93
|
send << Riddl::Parameter::Simple.new('signal',execresult[:signal])
|
93
94
|
send << Riddl::Parameter::Simple.new('signal_text',execresult[:signal_text] || '')
|
@@ -99,7 +100,7 @@ module CPEE
|
|
99
100
|
res[e] = struct.data[e]
|
100
101
|
end
|
101
102
|
if res.any?
|
102
|
-
send << Riddl::Parameter::Complex.new('dataelements','application/json',JSON::generate(
|
103
|
+
send << Riddl::Parameter::Complex.new('dataelements','application/json',JSON::generate(dataelements)) if mode == :full
|
103
104
|
send << Riddl::Parameter::Complex.new('changed_dataelements','application/json',JSON::generate(res))
|
104
105
|
end
|
105
106
|
res = {}
|
@@ -116,7 +117,7 @@ module CPEE
|
|
116
117
|
struct = WEEL::ReadStructure.new(dataelements,endpoints,local,additional)
|
117
118
|
execresult = exec struct, code
|
118
119
|
send = []
|
119
|
-
send << Riddl::Parameter::
|
120
|
+
send << Riddl::Parameter::Complex.new('result','application/json',execresult[:res])
|
120
121
|
if execresult[:signal]
|
121
122
|
send << Riddl::Parameter::Simple.new('signal',execresult[:signal])
|
122
123
|
send << Riddl::Parameter::Simple.new('signal_text',execresult[:signal_text] || '')
|
@@ -35,10 +35,7 @@
|
|
35
35
|
</message>
|
36
36
|
|
37
37
|
<message name="res">
|
38
|
-
<
|
39
|
-
<parameter name="result" type="boolean"/>
|
40
|
-
<parameter name="result" type="string"/>
|
41
|
-
</choice>
|
38
|
+
<parameter name="result" mimetype="application/json"/>
|
42
39
|
<optional>
|
43
40
|
<parameter name="signal" type="string"/>
|
44
41
|
<parameter name="signal_text" type="string"/>
|
@@ -54,10 +51,7 @@
|
|
54
51
|
</optional>
|
55
52
|
</message>
|
56
53
|
<message name="res-full">
|
57
|
-
<
|
58
|
-
<parameter name="result" type="boolean"/>
|
59
|
-
<parameter name="result" type="string"/>
|
60
|
-
</choice>
|
54
|
+
<parameter name="result" mimetype="application/json"/>
|
61
55
|
<optional>
|
62
56
|
<parameter name="signal" type="string"/>
|
63
57
|
<parameter name="signal_text" type="string"/>
|
@@ -38,15 +38,15 @@ module CPEE
|
|
38
38
|
if result && result.length == 1
|
39
39
|
if result[0].has_key? 'mimetype'
|
40
40
|
if result[0]['mimetype'] == 'application/json'
|
41
|
-
result = JSON::parse(result[0]['data']) rescue nil
|
41
|
+
result = JSON::parse(CPEE::EvalRuby::Translation::extract_base64(result[0]['data'])) rescue nil
|
42
42
|
elsif result[0]['mimetype'] == 'text/csv'
|
43
|
-
result = result[0]['data']
|
43
|
+
result = CPEE::EvalRuby::Translation::extract_base64(result[0]['data'])
|
44
44
|
elsif result[0]['mimetype'] == 'text/yaml'
|
45
|
-
result = YAML::load(result[0]['data']) rescue nil
|
45
|
+
result = YAML::load(CPEE::EvalRuby::Translation::extract_base64(result[0]['data'])) rescue nil
|
46
46
|
elsif result[0]['mimetype'] == 'application/xml' || result[0]['mimetype'] == 'text/xml'
|
47
|
-
result = XML::Smart::string(result[0]['data']) rescue nil
|
47
|
+
result = XML::Smart::string(CPEE::EvalRuby::Translation::extract_base64(result[0]['data'])) rescue nil
|
48
48
|
elsif result[0]['mimetype'] == 'text/plain'
|
49
|
-
result = result[0]['data']
|
49
|
+
result = CPEE::EvalRuby::Translation::extract_base64(result[0]['data'])
|
50
50
|
if result.start_with?("<?xml version=")
|
51
51
|
result = XML::Smart::string(result)
|
52
52
|
else
|
@@ -54,7 +54,7 @@ module CPEE
|
|
54
54
|
result = result.to_i if result == result.to_i.to_s
|
55
55
|
end
|
56
56
|
elsif result[0]['mimetype'] == 'text/html'
|
57
|
-
result = result[0]['data']
|
57
|
+
result = CPEE::EvalRuby::Translation::extract_base64(result[0]['data'])
|
58
58
|
result = result.to_f if result == result.to_f.to_s
|
59
59
|
result = result.to_i if result == result.to_i.to_s
|
60
60
|
else
|
@@ -136,6 +136,13 @@ module CPEE
|
|
136
136
|
def self::convert_to_base64(text)
|
137
137
|
('data:' + MimeMagic.by_magic(text).type + ';base64,' + Base64::encode64(text)) rescue ('data:application/octet-stream;base64,' + Base64::encode64(text))
|
138
138
|
end
|
139
|
+
def self::extract_base64(text)
|
140
|
+
if text.is_a?(String) && text.start_with?(/(data:[\w_\/-]+;base64,)/)
|
141
|
+
Base64::decode64(text.delete_prefix $1)
|
142
|
+
else
|
143
|
+
text
|
144
|
+
end
|
145
|
+
end
|
139
146
|
|
140
147
|
def self::structurize_result(result)
|
141
148
|
result.map do |r|
|
@@ -0,0 +1 @@
|
|
1
|
+
934659
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cpee-eval-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juergen eTM Mangler
|
8
8
|
autorequire:
|
9
9
|
bindir: tools
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-12-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: riddl
|
@@ -55,6 +55,7 @@ files:
|
|
55
55
|
- lib/cpee-eval-ruby/implementation.xml
|
56
56
|
- lib/cpee-eval-ruby/translation.rb
|
57
57
|
- server/eval-ruby
|
58
|
+
- server/eval-ruby.pid
|
58
59
|
- tools/cpee-eval-ruby
|
59
60
|
homepage: http://cpee.org/
|
60
61
|
licenses:
|
@@ -75,7 +76,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
75
76
|
- !ruby/object:Gem::Version
|
76
77
|
version: '0'
|
77
78
|
requirements: []
|
78
|
-
rubygems_version: 3.5.
|
79
|
+
rubygems_version: 3.5.16
|
79
80
|
signing_key:
|
80
81
|
specification_version: 4
|
81
82
|
summary: Ruby eval for the cloud process execution engine (cpee.org)
|