cpee-eval-ruby 1.0.0 → 1.0.2
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 +15 -7
- data/lib/cpee-eval-ruby/implementation.xml +26 -0
- data/lib/cpee-eval-ruby/translation.rb +2 -2
- metadata +2 -4
- data/server/output.err +0 -0
- data/server/output.txt +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4051ed86dfff3ee72cf3ee3ae43611c68a8c48b1710ca51960dd98a7e3555b41
|
4
|
+
data.tar.gz: d23f65b39f2388002f201aad7ea7a75961b3f14acd800fc538a36e5efb385ebe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 85746873a8e47626061c88ea7963455ec40cde05aa8b9c29c19998d59aa503ffe397a9da05393b638f25b4ebd848f05e2bb90118c5a22ec40c82150aa535bdce
|
7
|
+
data.tar.gz: 4e2a48a7da4011387f1f491905a09be25d72ad0b091137bf4a07ad332997d4151d50309643497dc318e4b8c0c906907cb4898e14fc760ebfeb1a9aa1f1ea82af
|
data/cpee-eval-ruby.gemspec
CHANGED
@@ -32,14 +32,13 @@ module CPEE
|
|
32
32
|
SERVER = File.expand_path(File.join(__dir__,'implementation.xml'))
|
33
33
|
|
34
34
|
class DoIt < Riddl::Implementation #{{{
|
35
|
-
def exec(
|
36
|
-
|
35
|
+
def exec(__struct,__code,result=nil,headers=nil)
|
36
|
+
__struct.instance_eval(__code)
|
37
37
|
end
|
38
38
|
|
39
39
|
def response
|
40
|
+
mode = @a[0]
|
40
41
|
code = @p.shift.value
|
41
|
-
# code = code.read if code.respond_to? :read
|
42
|
-
# code = Riddl::Protocols::Utils::unescape(code)
|
43
42
|
dataelements = JSON::parse(@p.shift.value.read)
|
44
43
|
local = nil
|
45
44
|
local = JSON::parse(@p.shift.value.read) if @p[0].name == 'local'
|
@@ -69,12 +68,18 @@ module CPEE
|
|
69
68
|
struct.changed_data.each do |e|
|
70
69
|
res[e] = struct.data[e]
|
71
70
|
end
|
72
|
-
|
71
|
+
if res.any?
|
72
|
+
ret.push Riddl::Parameter::Complex.new('dataelements','application/json',JSON::generate(data)) if mode == :full
|
73
|
+
ret.push Riddl::Parameter::Complex.new('changed_dataelements','application/json',JSON::generate(res))
|
74
|
+
end
|
73
75
|
res = {}
|
74
76
|
struct.changed_endpoints.each do |e|
|
75
77
|
res[e] = struct.endpoints[e]
|
76
78
|
end
|
77
|
-
|
79
|
+
if res.any?
|
80
|
+
ret.push Riddl::Parameter::Complex.new('endpoints','application/json',JSON::generate(endpoints)) if mode == :full
|
81
|
+
ret.push Riddl::Parameter::Complex.new('changed_endpoints','application/json',JSON::generate(res))
|
82
|
+
end
|
78
83
|
ret.push Riddl::Parameter::Complex.new('changed_status','application/json',JSON::generate(status)) if struct.changed_status
|
79
84
|
ret
|
80
85
|
else
|
@@ -94,7 +99,10 @@ module CPEE
|
|
94
99
|
Proc.new do
|
95
100
|
on resource do
|
96
101
|
on resource 'exec' do
|
97
|
-
run DoIt if put 'exec'
|
102
|
+
run DoIt, :small if put 'exec'
|
103
|
+
end
|
104
|
+
on resource 'exec-full' do
|
105
|
+
run DoIt, :full if put 'exec'
|
98
106
|
end
|
99
107
|
on resource 'structurize' do
|
100
108
|
run Structurize if put
|
@@ -41,6 +41,7 @@
|
|
41
41
|
</choice>
|
42
42
|
<optional>
|
43
43
|
<parameter name="signal" type="string"/>
|
44
|
+
<parameter name="signal_text" type="string"/>
|
44
45
|
</optional>
|
45
46
|
<optional>
|
46
47
|
<parameter name="changed_dataelements" mimetype="application/json"/>
|
@@ -52,6 +53,28 @@
|
|
52
53
|
<parameter name="changed_status" mimetype="application/json"/>
|
53
54
|
</optional>
|
54
55
|
</message>
|
56
|
+
<message name="res-full">
|
57
|
+
<choice>
|
58
|
+
<parameter name="result" type="boolean"/>
|
59
|
+
<parameter name="result" type="string"/>
|
60
|
+
</choice>
|
61
|
+
<optional>
|
62
|
+
<parameter name="signal" type="string"/>
|
63
|
+
<parameter name="signal_text" type="string"/>
|
64
|
+
</optional>
|
65
|
+
<optional>
|
66
|
+
<parameter name="dataelements" mimetype="application/json"/>
|
67
|
+
<parameter name="changed_dataelements" mimetype="application/json"/>
|
68
|
+
</optional>
|
69
|
+
<optional>
|
70
|
+
<parameter name="endpoints" mimetype="application/json"/>
|
71
|
+
<parameter name="changed_endpoints" mimetype="application/json"/>
|
72
|
+
</optional>
|
73
|
+
<optional>
|
74
|
+
<parameter name="changed_status" mimetype="application/json"/>
|
75
|
+
</optional>
|
76
|
+
</message>
|
77
|
+
|
55
78
|
|
56
79
|
<message name="struc">
|
57
80
|
<parameter name="structurized" mimetype="application/json"/>
|
@@ -61,6 +84,9 @@
|
|
61
84
|
<resource relative="exec">
|
62
85
|
<put in="exec" out="res"/>
|
63
86
|
</resource>
|
87
|
+
<resource relative="exec-full">
|
88
|
+
<put in="exec" out="res-full"/>
|
89
|
+
</resource>
|
64
90
|
<resource relative="structurize">
|
65
91
|
<put out="struc"/>
|
66
92
|
</resource>
|
@@ -43,7 +43,7 @@ module CPEE
|
|
43
43
|
result = result[0]['data']
|
44
44
|
elsif result[0]['mimetype'] == 'text/yaml'
|
45
45
|
result = YAML::load(result[0]['data']) rescue nil
|
46
|
-
elsif result[0]['mimetype'] == 'application/xml' || result[0]
|
46
|
+
elsif result[0]['mimetype'] == 'application/xml' || result[0]['mimetype'] == 'text/xml'
|
47
47
|
result = XML::Smart::string(result[0]['data']) rescue nil
|
48
48
|
elsif result[0]['mimetype'] == 'text/plain'
|
49
49
|
result = result[0]['data']
|
@@ -53,7 +53,7 @@ module CPEE
|
|
53
53
|
result = result.to_f if result == result.to_f.to_s
|
54
54
|
result = result.to_i if result == result.to_i.to_s
|
55
55
|
end
|
56
|
-
elsif result[0]
|
56
|
+
elsif result[0]['mimetype'] == 'text/html'
|
57
57
|
result = 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
|
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.2
|
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-09-
|
11
|
+
date: 2024-09-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: riddl
|
@@ -41,8 +41,6 @@ files:
|
|
41
41
|
- lib/cpee-eval-ruby/implementation.xml
|
42
42
|
- lib/cpee-eval-ruby/translation.rb
|
43
43
|
- server/eval-ruby
|
44
|
-
- server/output.err
|
45
|
-
- server/output.txt
|
46
44
|
- tools/cpee-eval-ruby
|
47
45
|
homepage: http://cpee.org/
|
48
46
|
licenses:
|
data/server/output.err
DELETED
File without changes
|
data/server/output.txt
DELETED
File without changes
|