weel 1.99.83 → 1.99.90

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/weel.rb +55 -28
  3. data/weel.gemspec +2 -2
  4. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 05367a0dcc8066aeb8180358efed5612c976b7b97e5ea8f5047a83bc482de8ff
4
- data.tar.gz: 87a40bbb853caf454d43a8632e9d2535b4cdcfab040bf2490095dbdcbea2123f
3
+ metadata.gz: d75c73b084f3926403dc8938f27a1295d7a36d7ccd2299f5eff2af075808da24
4
+ data.tar.gz: d3d5d52b613217a031392c740442bbe6a6d16d64b38b668dca8d15035a86a078
5
5
  SHA512:
6
- metadata.gz: b90f1b6a44a0ef9e47a60a8cd1da7f904691377859fd7aab2bcf19b100e1de7eea1534235944060b5101f6836c7c307e868db8828b26cbc9b5363dbb6d10012e
7
- data.tar.gz: '077059c2ad549cf6bb0debe569c9bed27b94c5e02c248a0b8662b457c014d726b38924b593b5005abf29dee60cb7b7de164dabcdabb6893ab39c6496319b2634'
6
+ metadata.gz: 710def978b14664c463ea6e87bb88179b2cc2aa01429fa908142b202b75e2ea8831eacd663573252ec5ff9e0dd54e534b965c5033dc68dc675aa3fe7543a32ca
7
+ data.tar.gz: 34d4be7d47e4c2ffd243fb1d216c98387de56058dc20bb827085d56dc3e3f08899f1b7bd9ee9d67d39e418ce2b0907f4ccf901ef0484f6d2940d2565bc5ba285
@@ -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!
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,13 +1,13 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "weel"
3
- s.version = "1.99.83"
3
+ s.version = "1.99.90"
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.license = "LGPL-3.0"
6
6
  s.summary = "Workflow Execution Engine Library (WEEL)"
7
7
 
8
8
  s.description = "see http://cpee.org"
9
9
 
10
- s.required_ruby_version = '>=2.6.0'
10
+ s.required_ruby_version = '>=2.5.0'
11
11
 
12
12
  s.files = Dir['{example/**/*,lib/weel.rb}'] + %w(COPYING Changelog FEATURES INSTALL Rakefile weel.gemspec README.md AUTHORS)
13
13
  s.require_path = 'lib'
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.83
4
+ version: 1.99.90
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-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: test-unit
@@ -94,7 +94,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
94
94
  requirements:
95
95
  - - ">="
96
96
  - !ruby/object:Gem::Version
97
- version: 2.6.0
97
+ version: 2.5.0
98
98
  required_rubygems_version: !ruby/object:Gem::Requirement
99
99
  requirements:
100
100
  - - ">="