weel 1.99.75 → 1.99.76
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 +4 -4
- data/lib/weel.rb +65 -53
- data/weel.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7cb0b00eea5a043d05689d6c2f57460f0852260d8041d5b4428ef5b012a54531
|
|
4
|
+
data.tar.gz: 64387529527bf0a0f110fdc5dfe0c25ac0189eefcc184a5cc8fa609ec3a93c59
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 416b7ecfa75b3df501d738a392fe8fdc43531b7f0479f7a0d60ec30e0beddfe532985ef5edd77a40c3890f6ee86ae43663b7532c3b11da306f92cb3f26ed2e4e
|
|
7
|
+
data.tar.gz: adcd6e152b2a2405862c02312faae7799f84a9d9be953fc82f6b54763e5dd0b77ee2696266e59621d0618bf9395ef3ea9386d908faa581ecf1b59b6eb2caf1dc
|
data/lib/weel.rb
CHANGED
|
@@ -16,29 +16,6 @@
|
|
|
16
16
|
|
|
17
17
|
require 'thread'
|
|
18
18
|
|
|
19
|
-
# OMG!111! deep cloning for ReadHashes
|
|
20
|
-
class Object # {{{
|
|
21
|
-
def deep_clone
|
|
22
|
-
return @deep_cloning_obj if @deep_cloning
|
|
23
|
-
@deep_cloning_obj = clone
|
|
24
|
-
@deep_cloning_obj.instance_variables.each do |var|
|
|
25
|
-
val = @deep_cloning_obj.instance_variable_get(var)
|
|
26
|
-
begin
|
|
27
|
-
@deep_cloning = true
|
|
28
|
-
val = val.deep_clone
|
|
29
|
-
rescue TypeError
|
|
30
|
-
next
|
|
31
|
-
ensure
|
|
32
|
-
@deep_cloning = false
|
|
33
|
-
end
|
|
34
|
-
@deep_cloning_obj.instance_variable_set(var, val)
|
|
35
|
-
end
|
|
36
|
-
deep_cloning_obj = @deep_cloning_obj
|
|
37
|
-
@deep_cloning_obj = nil
|
|
38
|
-
deep_cloning_obj
|
|
39
|
-
end
|
|
40
|
-
end #}}}
|
|
41
|
-
|
|
42
19
|
class WEEL
|
|
43
20
|
def initialize(*args)# {{{
|
|
44
21
|
@dslr = DSLRealization.new
|
|
@@ -60,27 +37,38 @@ class WEEL
|
|
|
60
37
|
class NoLongerNecessary < Exception; end
|
|
61
38
|
class Again < Exception; end
|
|
62
39
|
class Error < Exception; end
|
|
40
|
+
class Salvage < Exception; end
|
|
63
41
|
end # }}}
|
|
64
42
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
43
|
+
class ReadStructure # {{{
|
|
44
|
+
def initialize(data,endpoints)
|
|
45
|
+
@__weel_data = data.dup
|
|
46
|
+
@__weel_data.transform_values! do |v|
|
|
47
|
+
if v.is_a? XML::Smart::Dom
|
|
48
|
+
v.root.to_doc
|
|
49
|
+
else
|
|
50
|
+
begin
|
|
51
|
+
Marshal.load(Marshal.dump(v))
|
|
52
|
+
rescue
|
|
53
|
+
v.to_s rescue nil
|
|
54
|
+
end
|
|
55
|
+
end
|
|
71
56
|
end
|
|
57
|
+
@__weel_endpoints = endpoints.dup
|
|
58
|
+
@__weel_endpoints.transform_values!{ |v| v.dup }
|
|
59
|
+
end
|
|
72
60
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
61
|
+
def data
|
|
62
|
+
ReadHash.new(@__weel_data)
|
|
63
|
+
end
|
|
64
|
+
def endpoints
|
|
65
|
+
ReadHash.new(@__weel_endpoints)
|
|
66
|
+
end
|
|
67
|
+
end # }}}
|
|
80
68
|
class ManipulateStructure # {{{
|
|
81
69
|
def initialize(data,endpoints,status)
|
|
82
70
|
@__weel_data = data
|
|
83
|
-
@__weel_data_orig = @__weel_data.transform_values{|val| Marshal.dump(val) }
|
|
71
|
+
@__weel_data_orig = @__weel_data.transform_values{|val| Marshal.dump(val) } rescue nil
|
|
84
72
|
@__weel_endpoints = endpoints
|
|
85
73
|
@__weel_endpoints_orig = @__weel_endpoints.transform_values{|val| Marshal.dump(val) }
|
|
86
74
|
@__weel_status = status
|
|
@@ -93,7 +81,8 @@ class WEEL
|
|
|
93
81
|
|
|
94
82
|
def changed_data
|
|
95
83
|
@touched_data.each do |e|
|
|
96
|
-
|
|
84
|
+
td = Marshal.dump(@__weel_data[e]) rescue nil
|
|
85
|
+
if td != @__weel_data_orig[e]
|
|
97
86
|
@changed_data << e
|
|
98
87
|
end
|
|
99
88
|
end
|
|
@@ -104,11 +93,11 @@ class WEEL
|
|
|
104
93
|
end
|
|
105
94
|
|
|
106
95
|
def original_data
|
|
107
|
-
@__weel_data_orig.transform_values{|val| Marshal.load(val) }
|
|
96
|
+
@__weel_data_orig.transform_values{|val| Marshal.load(val) rescue nil }
|
|
108
97
|
end
|
|
109
98
|
|
|
110
99
|
def original_endpoints
|
|
111
|
-
@__weel_endpoints_orig.transform_values{|val| Marshal.load(val) }
|
|
100
|
+
@__weel_endpoints_orig.transform_values{|val| Marshal.load(val) rescue nil }
|
|
112
101
|
end
|
|
113
102
|
|
|
114
103
|
def changed_status
|
|
@@ -197,15 +186,21 @@ class WEEL
|
|
|
197
186
|
end
|
|
198
187
|
|
|
199
188
|
def method_missing(name,*args)
|
|
200
|
-
if
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
189
|
+
if @__weel_sim
|
|
190
|
+
"➤#{name}"
|
|
191
|
+
else
|
|
192
|
+
if args.empty? && @__weel_values.key?(name)
|
|
204
193
|
@__weel_values[name]
|
|
194
|
+
elsif name.to_s[-1..-1] == "=" && args.length == 1
|
|
195
|
+
temp = name.to_s[0..-2]
|
|
196
|
+
@__weel_values[temp.to_sym] = args[0]
|
|
197
|
+
elsif name.to_s == "[]=" && args.length == 2
|
|
198
|
+
@__weel_values[args[0]] = args[1]
|
|
199
|
+
elsif name.to_s == "[]" && args.length == 1
|
|
200
|
+
@__weel_values[args[0]]
|
|
201
|
+
else
|
|
202
|
+
nil
|
|
205
203
|
end
|
|
206
|
-
#TODO dont let user change stuff e.g. if return value is an array (deep clone and/or deep freeze it?)
|
|
207
|
-
else
|
|
208
|
-
nil
|
|
209
204
|
end
|
|
210
205
|
end
|
|
211
206
|
end # }}}
|
|
@@ -219,6 +214,8 @@ class WEEL
|
|
|
219
214
|
|
|
220
215
|
def initialize(arguments,endpoint=nil,position=nil,continue=nil); end
|
|
221
216
|
|
|
217
|
+
def prepare(readonly, endpoints, parameters); parameters; end
|
|
218
|
+
|
|
222
219
|
def activity_handle(passthrough, parameters); end
|
|
223
220
|
def activity_manipulate_handle(parameters); end
|
|
224
221
|
|
|
@@ -351,8 +348,8 @@ class WEEL
|
|
|
351
348
|
# position: a unique identifier within the wf-description (may be used by the search to identify a starting point)
|
|
352
349
|
# endpoint: (only with :call) ep of the service
|
|
353
350
|
# parameters: (only with :call) service parameters
|
|
354
|
-
def call(position, endpoint, parameters: {}, finalize: nil, update: nil, &finalizeblk) #{{{
|
|
355
|
-
__weel_activity(position,:call,endpoint,parameters,finalize||finalizeblk,update)
|
|
351
|
+
def call(position, endpoint, parameters: {}, finalize: nil, update: nil, prepare: nil, salvage: nil, &finalizeblk) #{{{
|
|
352
|
+
__weel_activity(position,:call,endpoint,parameters,finalize||finalizeblk,update,prepare,salvage)
|
|
356
353
|
end #}}}
|
|
357
354
|
# when two params, second param always script
|
|
358
355
|
# when block and two params, parameters stays
|
|
@@ -662,7 +659,7 @@ class WEEL
|
|
|
662
659
|
wp
|
|
663
660
|
end #}}}
|
|
664
661
|
|
|
665
|
-
def __weel_activity(position, type,
|
|
662
|
+
def __weel_activity(position, type, endpoint, parameters, finalize=nil, update=nil, prepare=nil, salvage=nil)# {{{
|
|
666
663
|
position = __weel_position_test position
|
|
667
664
|
begin
|
|
668
665
|
searchmode = __weel_is_in_search_mode(position)
|
|
@@ -670,10 +667,10 @@ class WEEL
|
|
|
670
667
|
return if self.__weel_state == :stopping || self.__weel_state == :finishing || self.__weel_state == :stopped || Thread.current[:nolongernecessary]
|
|
671
668
|
|
|
672
669
|
Thread.current[:continue] = Continue.new
|
|
673
|
-
handlerwrapper = @__weel_handlerwrapper.new @__weel_handlerwrapper_args,
|
|
670
|
+
handlerwrapper = @__weel_handlerwrapper.new @__weel_handlerwrapper_args, position, Thread.current[:continue]
|
|
674
671
|
|
|
675
672
|
if __weel_sim
|
|
676
|
-
handlerwrapper.simulate(:activity,:none,@__weel_sim += 1,Thread.current[:branch_sim_pos],:position => position,:parameters => parameters,:
|
|
673
|
+
handlerwrapper.simulate(:activity,:none,@__weel_sim += 1,Thread.current[:branch_sim_pos],:position => position,:parameters => parameters,:endpoint => endpoint,:type => type,:finalize => finalize.is_a?(String) ? finalize : nil)
|
|
677
674
|
return
|
|
678
675
|
end
|
|
679
676
|
|
|
@@ -730,6 +727,15 @@ class WEEL
|
|
|
730
727
|
else
|
|
731
728
|
raise("invalid parameters")
|
|
732
729
|
end
|
|
730
|
+
rs = ReadStructure.new(@__weel_data,@__weel_endpoints)
|
|
731
|
+
if prepare
|
|
732
|
+
if prepare.is_a?(Proc)
|
|
733
|
+
rs.instance_exec &prepare
|
|
734
|
+
elsif prepare.is_a?(String)
|
|
735
|
+
rs.instance_eval prepare
|
|
736
|
+
end
|
|
737
|
+
end
|
|
738
|
+
params = handlerwrapper.prepare(rs,endpoint,params)
|
|
733
739
|
raise Signal::Stop unless handlerwrapper.vote_sync_before(params)
|
|
734
740
|
raise Signal::Skip if self.__weel_state == :stopping || self.__weel_state == :finishing
|
|
735
741
|
|
|
@@ -762,7 +768,13 @@ class WEEL
|
|
|
762
768
|
raise Signal::Proceed
|
|
763
769
|
end
|
|
764
770
|
|
|
765
|
-
code = waitingresult == Signal::Again
|
|
771
|
+
code = if waitingresult == WEEL::Signal::Again
|
|
772
|
+
update
|
|
773
|
+
elsif waitingresult == WEEL::Signal::Salvage
|
|
774
|
+
salvage
|
|
775
|
+
else
|
|
776
|
+
finalize
|
|
777
|
+
end
|
|
766
778
|
if code.is_a?(Proc) || code.is_a?(String)
|
|
767
779
|
handlerwrapper.inform_activity_manipulate
|
|
768
780
|
if code.is_a?(Proc)
|
data/weel.gemspec
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: weel
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.99.
|
|
4
|
+
version: 1.99.76
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Juergen eTM Mangler
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2019-
|
|
12
|
+
date: 2019-10-05 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: test-unit
|