weel 1.99.84 → 1.99.91

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/weel.rb +55 -28
  3. data/weel.gemspec +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b5a2078e30e109e2157cbf57097fb9397ef6c70be651ecd126921e2387a25e2e
4
- data.tar.gz: b71439bf1e34769f65e708cbbc81b6c7304df708c1e1ba3ced934974624b6e0c
3
+ metadata.gz: bb12e6e8a41ba9cd26f4ca0bc599988506df0b95cbc6cc73268feaa24aef97c1
4
+ data.tar.gz: ede8c709b88e40a901a43e7f74e35a537a36d92fbc0962476f0945a5a4bfc905
5
5
  SHA512:
6
- metadata.gz: 68272ea7e69825b4c1aa7e4ba7ab570d9df41f82ff40c641d87beacfedca8e5e1bd53eb6885753c3f738bec921709ebf37ed44aff0d32cd9630fdb122143c35e
7
- data.tar.gz: 4cbad38225d73f475669926c7aaa1ea645bdebdc235512ecd08a8c64ad8fd91599b846e276cdce2a30deea78d184503ea8da542fe6d66cba4447c00a215c5c3c
6
+ metadata.gz: c5be98c67503b070738dba25f7328f9d56449f413fbac4be9987d65490f8f9bf08321ca3857cad2d1497b29fbd641dbc744c7578d6f7779480562c1de5098750
7
+ data.tar.gz: fe8dc90c3edcb5473a41127fd89beff210042f0cc579d2ebd89c49f3ea30e809d4f010543b6c844c3c61597e4f169f842b3ec7141bddc175a24c677ba31ab49e
@@ -15,6 +15,7 @@
15
15
  # <http://www.gnu.org/licenses/>.
16
16
 
17
17
  require 'thread'
18
+ require 'securerandom'
18
19
 
19
20
  class WEEL
20
21
  def initialize(*args)# {{{
@@ -59,12 +60,17 @@ class WEEL
59
60
  @additional = additional
60
61
  end
61
62
 
62
- def method_missing(m,args,&block)
63
- if @additional.exists?(m)
63
+ def method_missing(m,*args,&block)
64
+ if @additional.include?(m)
64
65
  begin
65
- Marshal.load(Marshal.dump(@aditional[m]))
66
+ tmp = Marshal.load(Marshal.dump(@additional[m]))
67
+ if tmp.is_a? Hash
68
+ ReadHash.new(tmp)
69
+ else
70
+ tmp
71
+ end
66
72
  rescue
67
- v.to_s rescue nil
73
+ m.to_s rescue nil
68
74
  end
69
75
  end
70
76
  end
@@ -90,12 +96,17 @@ class WEEL
90
96
  @additional = additional
91
97
  end
92
98
 
93
- def method_missing(m,args,&block)
94
- if @additional.exists?(m)
99
+ def method_missing(m,*args,&block)
100
+ if @additional.include?(m)
95
101
  begin
96
- Marshal.load(Marshal.dump(@aditional[m]))
102
+ tmp = Marshal.load(Marshal.dump(@additional[m]))
103
+ if tmp.is_a? Hash
104
+ ReadHash.new(tmp)
105
+ else
106
+ tmp
107
+ end
97
108
  rescue
98
- v.to_s rescue nil
109
+ m.to_s rescue nil
99
110
  end
100
111
  end
101
112
  end
@@ -227,6 +238,7 @@ class WEEL
227
238
  end # }}}
228
239
 
229
240
  class HandlerWrapperBase # {{{
241
+ def self::loop_guard(lid,count); false; end
230
242
  def self::inform_state_change(arguments,newstate); end
231
243
  def self::inform_syntax_error(arguments,err,code); end
232
244
  def self::inform_handlerwrapper_error(arguments,err); end
@@ -278,7 +290,7 @@ class WEEL
278
290
  end
279
291
  def as_json(*)
280
292
  jsn = { 'position' => @position }
281
- jsn['passtrough'] = @passthrough if @passthrough
293
+ jsn['passthrough'] = @passthrough if @passthrough
282
294
  jsn
283
295
  end
284
296
  def to_s
@@ -287,6 +299,12 @@ class WEEL
287
299
  def to_json(*args)
288
300
  as_json.to_json(*args)
289
301
  end
302
+ def eql?(other)
303
+ to_s == other.to_s
304
+ end
305
+ def hash
306
+ to_s.hash
307
+ end
290
308
  end # }}}
291
309
 
292
310
  class Continue # {{{
@@ -574,15 +592,21 @@ class WEEL
574
592
  __weel_sim_stop(:loop,hw,pos,args.merge(:testing=>condition[1],:condition=>cond))
575
593
  return
576
594
  end
595
+ loop_guard = 0
596
+ loop_id = SecureRandom.uuid
577
597
  catch :escape do
578
598
  case condition[1]
579
599
  when :pre_test
580
600
  while __weel_eval_condition(condition[0]) && self.__weel_state != :stopping && self.__weel_state != :stopped && self.__weel_state != :finishing
601
+ loop_guard += 1
581
602
  __weel_protect_yield(&block)
603
+ sleep 1 if @__weel_handlerwrapper::loop_guard(@__weel_handlerwrapper_args,loop_id,loop_guard)
582
604
  end
583
605
  when :post_test
584
606
  begin
607
+ loop_guard += 1
585
608
  __weel_protect_yield(&block)
609
+ sleep 1 if @__weel_handlerwrapper::loop_guard(@__weel_handlerwrapper_args,loop_id,loop_guard)
586
610
  end while __weel_eval_condition(condition[0]) && self.__weel_state != :stopping && self.__weel_state != :stopped && self.__weel_state != :finishing
587
611
  end
588
612
  end
@@ -659,24 +683,27 @@ class WEEL
659
683
 
660
684
  def __weel_progress(searchmode, position, skip=false) #{{{
661
685
  ipc = {}
662
- if searchmode == :after
663
- wp = WEEL::Position.new(position, :after, nil)
664
- ipc[:after] = [wp]
665
- else
666
- if Thread.current[:branch_parent] && Thread.current[:branch_parent][:branch_position]
667
- @__weel_positions.delete Thread.current[:branch_parent][:branch_position]
668
- ipc[:unmark] ||= []
669
- ipc[:unmark] << Thread.current[:branch_parent][:branch_position] rescue nil
670
- Thread.current[:branch_parent][:branch_position] = nil
671
- end
672
- if Thread.current[:branch_position]
673
- @__weel_positions.delete Thread.current[:branch_position]
674
- ipc[:unmark] ||= []
675
- ipc[:unmark] << Thread.current[:branch_position] rescue nil
676
- end
677
- wp = WEEL::Position.new(position, skip ? :after : :at, nil)
678
- ipc[skip ? :after : :at] = [wp]
686
+ if Thread.current[:branch_parent] && Thread.current[:branch_parent][:branch_position]
687
+ @__weel_positions.delete Thread.current[:branch_parent][:branch_position]
688
+ ipc[:unmark] ||= []
689
+ ipc[:unmark] << Thread.current[:branch_parent][:branch_position] rescue nil
690
+ Thread.current[:branch_parent][:branch_position] = nil
691
+ end
692
+ if Thread.current[:branch_position]
693
+ @__weel_positions.delete Thread.current[:branch_position]
694
+ ipc[:unmark] ||= []
695
+ ipc[:unmark] << Thread.current[:branch_position] rescue nil
679
696
  end
697
+ wp = WEEL::Position.new(position, skip ? :after : :at, nil)
698
+ ipc[skip ? :after : :at] = [wp]
699
+
700
+ @__weel_search_positions.each do |k,ele| # some may still be in active search but lets unmark them for good measure
701
+ ipc[:unmark] ||= []
702
+ ipc[:unmark] << ele
703
+ true
704
+ end
705
+ ipc[:unmark].uniq! if ipc[:unmark]
706
+
680
707
  @__weel_positions << wp
681
708
  Thread.current[:branch_position] = wp
682
709
 
@@ -770,7 +797,7 @@ class WEEL
770
797
  if self.__weel_state == :stopping || self.__weel_state == :finishing
771
798
  handlerwrapper.activity_stop
772
799
  wp.passthrough = handlerwrapper.activity_passthrough_value
773
- raise Signal::Proceed
800
+ raise Signal::Proceed if wp.passthrough # if stop, but no passthrough, let manipulate happen and then stop
774
801
  end
775
802
 
776
803
  code = if waitingresult == WEEL::Signal::Again
@@ -900,7 +927,7 @@ class WEEL
900
927
  branch = branch[:branch_parent]
901
928
  branch[:branch_search] = false
902
929
  end
903
- @__weel_search_positions[position].detail == :after ? :after : false
930
+ @__weel_search_positions[position].detail == :after
904
931
  else
905
932
  branch[:branch_search] = true
906
933
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "weel"
3
- s.version = "1.99.84"
3
+ s.version = "1.99.91"
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.license = "LGPL-3.0"
6
6
  s.summary = "Workflow Execution Engine Library (WEEL)"
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.84
4
+ version: 1.99.91
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: 2020-06-19 00:00:00.000000000 Z
12
+ date: 2020-09-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: test-unit