flor 1.5.0 → 1.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -0
- data/LICENSE.txt +1 -1
- data/Makefile +4 -4
- data/README.md +1 -2
- data/lib/flor/colours.rb +2 -2
- data/lib/flor/flor.rb +1 -1
- data/lib/flor/log.rb +7 -2
- data/lib/flor/parser.rb +11 -4
- data/lib/flor/pcore/cursor.rb +13 -0
- data/lib/flor/tools/flotojson.rb +10 -1
- data/lib/flor/unit/caller.rb +13 -5
- data/lib/flor/unit/executor.rb +11 -7
- data/lib/flor/unit/ganger.rb +14 -4
- data/lib/flor/unit/models/message.rb +2 -0
- data/lib/flor/unit/models/pointer.rb +2 -0
- data/lib/flor/unit/models/timer.rb +2 -0
- data/lib/flor/unit/models/trace.rb +2 -0
- data/lib/flor/unit/models/trap.rb +2 -0
- data/lib/flor/unit/storage.rb +5 -5
- data/lib/flor/unit/taskers.rb +5 -2
- data/lib/flor.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 162cdcdf2bca8c6f41feb24643e32306cd65183d30a3a6562b8a1d51b151192e
|
4
|
+
data.tar.gz: 48c5664d39b6efc8783121806cfd7faa24f26714e00a1a5af9694ca9dd68d09e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94825467c26f7cb714bd0744979023164655eed579d19b6662a2e7b75d8fa7dc170f21c4ff5ce6e3d12fcd53b90a86999fcd10389481edf362a0c7ab4d469481
|
7
|
+
data.tar.gz: 8c4f9c54c2284f6fd72ecfc1d6f9f83e7a436f446ae2eec06efd8978aaf34e609f1a8d06f3320b384a01fe64c702abaf8c20c87080830f745ee0dfb7d12f4ec5
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,19 @@
|
|
2
2
|
# CHANGELOG.md
|
3
3
|
|
4
4
|
|
5
|
+
## flor 1.6.1 released 2023-10-20
|
6
|
+
|
7
|
+
* Use djan in Flor.msg_to_detail_s(executor, message)
|
8
|
+
* Accept --djan to flotojson.rb
|
9
|
+
|
10
|
+
|
11
|
+
## flor 1.6.0 released 2023-01-13
|
12
|
+
|
13
|
+
* Add #fei to Message, Pointer, Timer, Trace and Trap models
|
14
|
+
* Allow for // comments in Flor language
|
15
|
+
* Call post_task when tasker hands back task
|
16
|
+
|
17
|
+
|
5
18
|
## flor 1.5.0 released 2021-11-24
|
6
19
|
|
7
20
|
* Add storage callbacks `on(:pointers, :any) { do_that }`
|
data/LICENSE.txt
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
Copyright (c) 2015-
|
2
|
+
Copyright (c) 2015-2023, John Mettraux, jmettraux+flor@gmail.com
|
3
3
|
|
4
4
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
5
|
of this software and associated documentation files (the "Software"), to deal
|
data/Makefile
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
|
2
2
|
## gem tasks ##
|
3
3
|
|
4
|
-
NAME
|
5
|
-
|
6
|
-
VERSION
|
7
|
-
|
4
|
+
NAME != \
|
5
|
+
ruby -e "s = eval(File.read(Dir['*.gemspec'][0])); puts s.name"
|
6
|
+
VERSION != \
|
7
|
+
ruby -e "s = eval(File.read(Dir['*.gemspec'][0])); puts s.version"
|
8
8
|
|
9
9
|
count_lines:
|
10
10
|
find lib -name "*.rb" | xargs cat | ruby -e "p STDIN.readlines.count { |l| l = l.strip; l[0, 1] != '#' && l != '' }"
|
data/README.md
CHANGED
@@ -6,7 +6,6 @@
|
|
6
6
|
|
7
7
|
Flor is a "Ruby workflow engine", if that makes any sense.
|
8
8
|
|
9
|
-
* [![Join the chat at https://gitter.im/floraison/flor](https://badges.gitter.im/floraison/flor.svg)](https://gitter.im/floraison/flor?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
10
9
|
* [floraison mailing list](https://groups.google.com/forum/#!forum/floraison)
|
11
10
|
* [twitter.com/@flor_workflow](https://twitter.com/flor_workflow)
|
12
11
|
|
@@ -47,7 +46,7 @@ require 'flor/unit'
|
|
47
46
|
# uncomment to see the flor activity
|
48
47
|
|
49
48
|
sto_uri = 'sqlite://flor_qs.db'
|
50
|
-
sto_uri = 'jdbc:sqlite://flor_qs.db' if RUBY_PLATFORM.match(/java/)
|
49
|
+
sto_uri = 'jdbc:sqlite://flor_qs.db' if RUBY_PLATFORM.match?(/java/)
|
51
50
|
|
52
51
|
flor = Flor::Unit.new(loader: Flor::HashLoader, sto_uri: sto_uri)
|
53
52
|
# instantiate flor unit
|
data/lib/flor/colours.rb
CHANGED
@@ -27,7 +27,7 @@ module Flor
|
|
27
27
|
class Colours
|
28
28
|
|
29
29
|
Flor::COLS.each do |k, v|
|
30
|
-
if v.match(/\A\d/)
|
30
|
+
if v.match(/\A\d/) # Ruby 2.3 doesn't have String#match?
|
31
31
|
class_eval(%{
|
32
32
|
def #{k}(s=nil)
|
33
33
|
s ? "[#{v}m" + s + "[0;0m" : "[#{v}m"
|
@@ -42,7 +42,7 @@ module Flor
|
|
42
42
|
class NoColours
|
43
43
|
|
44
44
|
Flor::COLS.each do |k, v|
|
45
|
-
if v.match(/\A\d/)
|
45
|
+
if v.match(/\A\d/) # Ruby 2.3 doesn't have String#match?
|
46
46
|
class_eval("def #{k}(s=''); s; end")
|
47
47
|
else
|
48
48
|
class_eval("alias #{k} #{v}")
|
data/lib/flor/flor.rb
CHANGED
data/lib/flor/log.rb
CHANGED
@@ -337,13 +337,18 @@ module Flor
|
|
337
337
|
o.puts "#{_c.rs}#{_c.dg}<Flor.msg_to_detail_s>"
|
338
338
|
|
339
339
|
o.puts "#{_c.dg}message:#{_c.yl}"
|
340
|
-
o.puts YAML.dump(m)
|
340
|
+
#o.puts YAML.dump(m)
|
341
|
+
o.puts(Flor.to_djan(m, indent: 2, width: true))
|
341
342
|
|
342
343
|
o.puts "#{_c.dg}tree:#{_c.yl}"
|
343
344
|
o.puts(tree_to_s(node.lookup_tree(nid), nid, out: o)) if node
|
344
345
|
|
345
346
|
o.puts "#{_c.dg}node:#{_c.yl}"
|
346
|
-
o.puts n ? YAML.dump(n.merge('tree' => '(above)')) : 'nil'
|
347
|
+
#o.puts n ? YAML.dump(n.merge('tree' => '(above)')) : 'nil'
|
348
|
+
o.puts(
|
349
|
+
n ?
|
350
|
+
Flor.to_djan(n.merge('tree' => '(above)'), indent: 2, width: true) :
|
351
|
+
'nil')
|
347
352
|
|
348
353
|
o.puts "#{_c.dg}nodes:#{_c.yl}"
|
349
354
|
o.puts nods_to_s(executor, m, opts)
|
data/lib/flor/parser.rb
CHANGED
@@ -6,6 +6,9 @@ module Flor
|
|
6
6
|
|
7
7
|
#Raabro.pp(Flor::Parser.parse(input, debug: 2), colours: true)
|
8
8
|
#Raabro.pp(Flor::Parser.parse(input, debug: 3), colours: true)
|
9
|
+
#
|
10
|
+
# turn one or the other when debugging the parser...
|
11
|
+
|
9
12
|
opts = fname if fname.is_a?(Hash) && opts.empty?
|
10
13
|
|
11
14
|
if r = Flor::Parser.parse(input, opts)
|
@@ -49,7 +52,7 @@ module Flor
|
|
49
52
|
def semicolon(i); str(nil, i, ';'); end
|
50
53
|
def comma(i); str(nil, i, ','); end
|
51
54
|
def dquote(i); str(nil, i, '"'); end
|
52
|
-
def slash(i);
|
55
|
+
def slash(i); rex(nil, i, /\/(?!\/)/); end
|
53
56
|
def dollar(i); str(nil, i, '$'); end
|
54
57
|
def pipepipe(i); str(nil, i, '||'); end
|
55
58
|
|
@@ -95,7 +98,11 @@ module Flor
|
|
95
98
|
seq(nil, i, :dot, :rf_symbol)
|
96
99
|
end
|
97
100
|
def rf_index(i); alt(nil, i, :rf_dot_idx, :rf_sqa_idx); end
|
98
|
-
|
101
|
+
#
|
102
|
+
def rf_symbol(i)
|
103
|
+
rex(:refsym, i, /([^.:;| \b\f\n\r\t"',()\[\]{}#\\\/]|\/(?!\/))+/)
|
104
|
+
# anything but... a slash is ok, but not a double slash...
|
105
|
+
end
|
99
106
|
#
|
100
107
|
def reference(i); seq(:ref, i, :rf_symbol, :rf_index, '*'); end
|
101
108
|
|
@@ -165,7 +172,7 @@ module Flor
|
|
165
172
|
}x)
|
166
173
|
end
|
167
174
|
|
168
|
-
def comment(i); rex(nil, i,
|
175
|
+
def comment(i); rex(nil, i, /(#|\/\/)[^\r\n]*/); end
|
169
176
|
|
170
177
|
def eol(i); seq(nil, i, :wstar, :comment, '?', :rnstar); end
|
171
178
|
def eol_wstar(i); seq(nil, i, :wstar, :comment, '?', :rnstar, :wstar); end
|
@@ -210,7 +217,7 @@ module Flor
|
|
210
217
|
# %w[ equ == != <> ], %w[ lgt < > <= >= ], %w[ sum + - ], %w[ prd * / % ],
|
211
218
|
|
212
219
|
def ssmod(i); str(:sop, i, /%/); end
|
213
|
-
def ssprd(i); rex(:sop, i, /
|
220
|
+
def ssprd(i); rex(:sop, i, /(\*|\/(?!\/))/); end
|
214
221
|
def sssum(i); rex(:sop, i, /[+-]/); end
|
215
222
|
def sslgt(i); rex(:sop, i, /(<=?|>=?)/); end
|
216
223
|
def ssequ(i); rex(:sop, i, /(==?|!=|<>)/); end
|
data/lib/flor/pcore/cursor.rb
CHANGED
@@ -62,6 +62,10 @@ class Flor::Pro::Cursor < Flor::Procedure
|
|
62
62
|
#
|
63
63
|
# ## cursor and start: / initial: attribute
|
64
64
|
#
|
65
|
+
# Sometimes, it is necessary to enter a cursor not at its first child, but
|
66
|
+
# its second or third. Once such a cursor is entered and a `continue` is
|
67
|
+
# met it will "rewind" to the first child (not the "start" child).
|
68
|
+
#
|
65
69
|
# ```
|
66
70
|
# task 'create mandate'
|
67
71
|
# cursor start: 'approve mandate'
|
@@ -71,6 +75,15 @@ class Flor::Pro::Cursor < Flor::Procedure
|
|
71
75
|
# task 'activate mandate'
|
72
76
|
# ```
|
73
77
|
#
|
78
|
+
# The string passed to start:/initial: is looked up (down) in the cursor
|
79
|
+
# in the order: (example `cursor start: 'bravo'`)
|
80
|
+
#
|
81
|
+
# * tag (for example `push l 'b' tag: 'bravo'`)
|
82
|
+
# * string argument (for example `task 'toto' context: 'bravo'`)
|
83
|
+
# * string target (for example `task 'bravo'`)
|
84
|
+
# * name target (for example `bravo _`)
|
85
|
+
# * att target (for example `task 'toto' bravo: 'ok'`)
|
86
|
+
#
|
74
87
|
# ## see also
|
75
88
|
#
|
76
89
|
# Break, continue, loop.
|
data/lib/flor/tools/flotojson.rb
CHANGED
@@ -22,7 +22,12 @@ if (ARGV & [ '-h', '--help']).any?
|
|
22
22
|
puts " --jp pretty prints the JSON output"
|
23
23
|
puts
|
24
24
|
puts " -y"
|
25
|
-
puts "
|
25
|
+
puts " --yaml dumps as YAML"
|
26
|
+
puts
|
27
|
+
puts " -d"
|
28
|
+
puts " --djan dumps as djan"
|
29
|
+
puts
|
30
|
+
puts " --json dumps as JSON (it's the default)"
|
26
31
|
puts
|
27
32
|
puts " -h"
|
28
33
|
puts " --help prints this help message"
|
@@ -84,6 +89,10 @@ elsif flags['--jp'] || flags['--pj']
|
|
84
89
|
)
|
85
90
|
elsif flags['-y'] || flags['--yaml']
|
86
91
|
puts YAML.dump(tree)
|
92
|
+
elsif flags['-d'] || flags['--djan']
|
93
|
+
puts(Flor.to_djan(tree, indent: 2, width: true))
|
94
|
+
elsif flags['--json']
|
95
|
+
puts JSON.dump(tree)
|
87
96
|
else
|
88
97
|
puts JSON.dump(tree)
|
89
98
|
end
|
data/lib/flor/unit/caller.rb
CHANGED
@@ -110,10 +110,16 @@ module Flor
|
|
110
110
|
pt = message['point']
|
111
111
|
|
112
112
|
ms = [ "call_#{pt}", "on_#{pt}", :on_message, :on, pt ]
|
113
|
-
|
113
|
+
case pt
|
114
|
+
when 'detask' then ms = ms + [ :on_cancel, :cancel ]
|
115
|
+
when 'return' then ms = [ :on_return, :return, :post_task ] # /!\
|
116
|
+
end
|
114
117
|
|
115
118
|
m = ms.find { |mm| o.respond_to?(mm) }
|
116
119
|
|
120
|
+
return [ message ] if pt == 'return' && ! m
|
121
|
+
# don't call if :post_task not present
|
122
|
+
|
117
123
|
fail(
|
118
124
|
"#{k.class.to_s.downcase} #{k} doesn't respond to " +
|
119
125
|
ms[0..-2].collect { |e| "##{e}" }.join(', ') + ", or ##{ms[-1]}"
|
@@ -316,10 +322,12 @@ module Flor
|
|
316
322
|
|
317
323
|
def to_messages(o)
|
318
324
|
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
325
|
+
if Flor.is_array_of_messages?(o)
|
326
|
+
o
|
327
|
+
elsif Flor.is_message?(o)
|
328
|
+
[ o ]
|
329
|
+
else
|
330
|
+
[]
|
323
331
|
end
|
324
332
|
end
|
325
333
|
|
data/lib/flor/unit/executor.rb
CHANGED
@@ -48,7 +48,7 @@ module Flor
|
|
48
48
|
|
49
49
|
protected
|
50
50
|
|
51
|
-
CLOSING_POINTS = %w[ task terminated ceased ]
|
51
|
+
CLOSING_POINTS = %w[ task terminated ceased ].freeze
|
52
52
|
#
|
53
53
|
# point for messages that, after consumption, are conserved
|
54
54
|
# in the execution's "closing_messages" array
|
@@ -160,14 +160,18 @@ module Flor
|
|
160
160
|
def return(message)
|
161
161
|
|
162
162
|
n = @execution['nodes'][message['nid']] || {}
|
163
|
-
|
164
|
-
c = m['cause']
|
163
|
+
c = (n['message'] || {})['cause']
|
165
164
|
|
166
|
-
|
167
|
-
|
168
|
-
|
165
|
+
ms =
|
166
|
+
if n['task']
|
167
|
+
@unit.ganger.task(self, message)
|
168
|
+
else
|
169
|
+
[ message.dup ]
|
170
|
+
end
|
169
171
|
|
170
|
-
|
172
|
+
ms.each { |m|
|
173
|
+
m['point'] = 'receive'
|
174
|
+
m['cause'] = c if c }
|
171
175
|
end
|
172
176
|
|
173
177
|
def schedule(message)
|
data/lib/flor/unit/ganger.rb
CHANGED
@@ -47,16 +47,14 @@ module Flor
|
|
47
47
|
def task(executor, message)
|
48
48
|
|
49
49
|
domain = message['exid'].split('-', 2).first
|
50
|
-
tname = message['tasker']
|
50
|
+
#tname = message['tasker']
|
51
|
+
tname = determine_tasker_name(executor, message)
|
51
52
|
|
52
53
|
tconf =
|
53
54
|
( ! message['routed'] &&
|
54
55
|
(@unit.loader.tasker(domain, 'ganger', message) ||
|
55
56
|
@unit.loader.tasker(domain, 'tasker', message))) ||
|
56
57
|
@unit.loader.tasker(domain, tname, message)
|
57
|
-
#puts "=" * 80
|
58
|
-
#pp tconf
|
59
|
-
#puts "=" * 80
|
60
58
|
|
61
59
|
fail ArgumentError.new(
|
62
60
|
"tasker #{tname.inspect} not found"
|
@@ -66,6 +64,7 @@ module Flor
|
|
66
64
|
|
67
65
|
points = [ nil, message['point'] ]
|
68
66
|
points << 'detask' if points.include?('cancel')
|
67
|
+
points << 'task' if points.include?('return')
|
69
68
|
|
70
69
|
tconf = tconf.find { |h| points.include?(h['point']) }
|
71
70
|
end
|
@@ -154,6 +153,17 @@ module Flor
|
|
154
153
|
|
155
154
|
vars
|
156
155
|
end
|
156
|
+
|
157
|
+
def determine_tasker_name(executor, message)
|
158
|
+
|
159
|
+
tname = message['tasker']
|
160
|
+
|
161
|
+
return tname if tname
|
162
|
+
|
163
|
+
n = executor.node(message)
|
164
|
+
|
165
|
+
n['task']['tasker']
|
166
|
+
end
|
157
167
|
end
|
158
168
|
end
|
159
169
|
|
@@ -29,6 +29,8 @@ module Flor
|
|
29
29
|
# # we don't care, pointers are cleaned anyway when the flow dies
|
30
30
|
#end
|
31
31
|
|
32
|
+
def fei; [ exid, nid ].join('-'); end
|
33
|
+
|
32
34
|
# If the pointer is a "var" pointer, returns the full value
|
33
35
|
# for the variable, as found in the execution's node "0".
|
34
36
|
#
|
data/lib/flor/unit/storage.rb
CHANGED
@@ -908,11 +908,11 @@ module Flor
|
|
908
908
|
fail ArgumentError.new("no 'sto_uri' conf, cannot connect to db") \
|
909
909
|
unless uri
|
910
910
|
|
911
|
-
|
912
|
-
|
913
|
-
|
914
|
-
|
915
|
-
|
911
|
+
begin
|
912
|
+
Kernel.const_get(uri)
|
913
|
+
rescue NameError
|
914
|
+
Sequel.connect(uri)
|
915
|
+
end
|
916
916
|
end
|
917
917
|
|
918
918
|
def connect
|
data/lib/flor/unit/taskers.rb
CHANGED
@@ -169,9 +169,12 @@ module Flor
|
|
169
169
|
|
170
170
|
pt = @message['point']
|
171
171
|
|
172
|
-
ms = [ "post_#{pt}" ]; ms << :post_cancel if pt == 'detask'
|
172
|
+
#ms = [ "post_#{pt}" ]; ms << :post_cancel if pt == 'detask'
|
173
|
+
#call_one_of(ms)
|
173
174
|
#
|
174
|
-
|
175
|
+
# :post_task is called by, well, the caller
|
176
|
+
#
|
177
|
+
call_one_of([ :post_detask, :post_cancel ]) if pt == 'detask'
|
175
178
|
|
176
179
|
msg = derive_message(message)
|
177
180
|
|
data/lib/flor.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Mettraux
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-10-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: munemo
|
@@ -290,7 +290,7 @@ metadata:
|
|
290
290
|
mailing_list_uri: https://groups.google.com/forum/#!forum/floraison
|
291
291
|
homepage_uri: https://github.com/floraison/flor
|
292
292
|
source_code_uri: https://github.com/floraison/flor
|
293
|
-
post_install_message:
|
293
|
+
post_install_message:
|
294
294
|
rdoc_options: []
|
295
295
|
require_paths:
|
296
296
|
- lib
|
@@ -305,8 +305,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
305
305
|
- !ruby/object:Gem::Version
|
306
306
|
version: '0'
|
307
307
|
requirements: []
|
308
|
-
rubygems_version: 3.
|
309
|
-
signing_key:
|
308
|
+
rubygems_version: 3.2.33
|
309
|
+
signing_key:
|
310
310
|
specification_version: 4
|
311
311
|
summary: A Ruby workflow engine
|
312
312
|
test_files: []
|