flor 0.12.0 → 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +6 -0
- data/lib/flor.rb +1 -1
- data/lib/flor/core/procedure.rb +1 -0
- data/lib/flor/log.rb +5 -7
- data/lib/flor/parser.rb +6 -1
- data/lib/flor/pcore/cursor.rb +30 -39
- data/lib/flor/pcore/echo.rb +23 -0
- data/lib/flor/pcore/move.rb +2 -2
- data/lib/flor/pcore/until.rb +1 -3
- data/lib/flor/punit/task.rb +5 -1
- data/lib/flor/punit/trace.rb +4 -8
- data/lib/flor/unit/scheduler.rb +1 -0
- metadata +3 -2
data/CHANGELOG.md
CHANGED
data/lib/flor.rb
CHANGED
data/lib/flor/core/procedure.rb
CHANGED
data/lib/flor/log.rb
CHANGED
@@ -125,14 +125,12 @@ module Flor
|
|
125
125
|
o.puts "#{_c.dg}| #{opts.inspect}#{_c.rs}" if opts.any?
|
126
126
|
|
127
127
|
if src.is_a?(String)
|
128
|
-
src.split("\n")
|
129
|
-
|
130
|
-
|
128
|
+
src.split("\n")
|
129
|
+
.select { |l| l.strip.length > 0 && l.match(/\A\s*[^#]/) }
|
130
|
+
.each { |l| o.puts "#{_c.dg}| #{_c.yl}#{l}#{_c.rs}" }
|
131
131
|
else
|
132
|
-
|
133
|
-
|
134
|
-
o.puts "#{_c.dg}| #{_c.yl}#{line}#{_c.rs}"
|
135
|
-
end
|
132
|
+
Flor.to_pretty_s(src).split("\n")
|
133
|
+
.each { |l| o.puts "#{_c.dg}| #{_c.yl}#{l}#{_c.rs}" }
|
136
134
|
end
|
137
135
|
|
138
136
|
o.puts "#{_c.dg}.#{_c.rs}"
|
data/lib/flor/parser.rb
CHANGED
@@ -309,7 +309,12 @@ module Flor
|
|
309
309
|
|
310
310
|
t = [ atts[i][0][0] == 'if' ? 'if' : 'unless', [], @line ]
|
311
311
|
t[1].concat(atts[i + 1..-1].collect(&:first))
|
312
|
-
|
312
|
+
|
313
|
+
cn0i = cn[0, i]; if Flor.is_tree?(@head) && cn0i == []
|
314
|
+
t[1].push(@head)
|
315
|
+
else
|
316
|
+
t[1].push([ @head, cn0i, @line ])
|
317
|
+
end
|
313
318
|
|
314
319
|
t
|
315
320
|
end
|
data/lib/flor/pcore/cursor.rb
CHANGED
@@ -21,6 +21,28 @@ class Flor::Pro::Cursor < Flor::Procedure
|
|
21
21
|
# task 'bravo'
|
22
22
|
# task 'charly'
|
23
23
|
# ```
|
24
|
+
#
|
25
|
+
# ## continue
|
26
|
+
#
|
27
|
+
# Cursor also understands `continue`. It's useful to rewind a cursor:
|
28
|
+
# ```
|
29
|
+
# cursor
|
30
|
+
# sales_team "fill in customer details"
|
31
|
+
# ops_team "attribute account number"
|
32
|
+
# continue _ if f.ops_decision == 'reject'
|
33
|
+
# create_account
|
34
|
+
# ```
|
35
|
+
#
|
36
|
+
# ## move
|
37
|
+
#
|
38
|
+
# Cursor accepts move orders, as in:
|
39
|
+
# ```
|
40
|
+
# cursor
|
41
|
+
# do-this
|
42
|
+
# move to: 'do-that-other-thing'
|
43
|
+
# do-that _ # got skipped
|
44
|
+
# do-that-other-thing _
|
45
|
+
# ```
|
24
46
|
|
25
47
|
name 'cursor'
|
26
48
|
|
@@ -73,49 +95,18 @@ class Flor::Pro::Cursor < Flor::Procedure
|
|
73
95
|
|
74
96
|
def cancel
|
75
97
|
|
76
|
-
fla = @message['flavour']
|
77
|
-
|
78
|
-
# busy = @node['on_receive_last']
|
79
|
-
#
|
80
|
-
# close_node
|
81
|
-
#
|
82
|
-
# @node['on_receive_last'] =
|
83
|
-
# if fla == 'continue'
|
84
|
-
# @node['subs'] << counter_next('subs')
|
85
|
-
# execute_child(first_non_att_child_id, @node['subs'].last, 'orl' => fla)
|
86
|
-
# elsif fla == 'move'
|
87
|
-
# @node['subs'] << counter_next('subs')
|
88
|
-
# execute_child(move_target_child_id, @node['subs'].last, 'orl' => fla)
|
89
|
-
# else # 'break'
|
90
|
-
# nil
|
91
|
-
# end
|
92
|
-
#
|
93
|
-
# return [] if busy
|
94
|
-
# # <------- that implies that upon a sound reply,
|
95
|
-
# # @node['on_receive_last'] is set to nil!
|
96
|
-
# # @node['status'] is cleaned...
|
97
|
-
#
|
98
|
-
# super.tap { |ms| pp ms }
|
99
|
-
|
100
|
-
#if nid == '0_1_0'
|
101
|
-
# puts "\\" * 80
|
102
|
-
# puts caller[0, 7]
|
103
|
-
#end
|
104
|
-
|
105
|
-
if fla == 'continue'
|
106
|
-
|
107
|
-
@node['on_receive_last'] =
|
108
|
-
wrap(
|
109
|
-
'nid' => nid, 'from' => "#{nid}_#{children.size + 1}",
|
110
|
-
'orl' => fla,
|
111
|
-
'payload' => Flor.dup(message['payload']))
|
98
|
+
if %w[ continue move ].include?(fla = @message['flavour'])
|
112
99
|
|
113
|
-
|
100
|
+
cid =
|
101
|
+
fla == 'move' ?
|
102
|
+
move_target_child_id :
|
103
|
+
first_non_att_child_id
|
114
104
|
|
115
|
-
@node['subs'] <<
|
105
|
+
@node['subs'] <<
|
106
|
+
counter_next('subs')
|
116
107
|
|
117
108
|
@node['on_receive_last'] =
|
118
|
-
execute_child(
|
109
|
+
execute_child(cid, @node['subs'].last, 'orl' => fla)
|
119
110
|
|
120
111
|
else
|
121
112
|
|
@@ -0,0 +1,23 @@
|
|
1
|
+
|
2
|
+
class Flor::Pro::Echo < Flor::Procedure
|
3
|
+
|
4
|
+
name 'echo'
|
5
|
+
|
6
|
+
def receive_last_att
|
7
|
+
|
8
|
+
case ret = payload['ret']
|
9
|
+
when String then puts(ret)
|
10
|
+
else pp(ret)
|
11
|
+
end
|
12
|
+
|
13
|
+
super
|
14
|
+
end
|
15
|
+
|
16
|
+
def receive_last
|
17
|
+
|
18
|
+
payload['ret'] = node_payload_ret
|
19
|
+
|
20
|
+
wrap
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
data/lib/flor/pcore/move.rb
CHANGED
data/lib/flor/pcore/until.rb
CHANGED
data/lib/flor/punit/task.rb
CHANGED
@@ -8,7 +8,7 @@ class Flor::Pro::Task < Flor::Procedure
|
|
8
8
|
@node['atts'] = []
|
9
9
|
end
|
10
10
|
|
11
|
-
def
|
11
|
+
def receive
|
12
12
|
|
13
13
|
return wrap_reply('payload' => determine_reply_payload) \
|
14
14
|
if point == 'receive' && from == nil
|
@@ -17,6 +17,8 @@ class Flor::Pro::Task < Flor::Procedure
|
|
17
17
|
# which goes to #receive or #receive_when_status
|
18
18
|
end
|
19
19
|
|
20
|
+
alias receive_when_closed receive_from_child_when_closed
|
21
|
+
|
20
22
|
def receive_last_att
|
21
23
|
|
22
24
|
# task 'clean up' by: 'alan'
|
@@ -50,6 +52,8 @@ class Flor::Pro::Task < Flor::Procedure
|
|
50
52
|
|
51
53
|
def cancel
|
52
54
|
|
55
|
+
close_node
|
56
|
+
|
53
57
|
attl, attd = determine_atts
|
54
58
|
|
55
59
|
wrap(
|
data/lib/flor/punit/trace.rb
CHANGED
@@ -5,14 +5,10 @@ class Flor::Pro::Trace < Flor::Procedure
|
|
5
5
|
|
6
6
|
def receive
|
7
7
|
|
8
|
-
|
8
|
+
t = lookup_tree(@message['from'])
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
if t.first == '_att' && t[1].size == 1
|
13
|
-
@executor.unit.storage.trace(exid, nid, 'trace', payload['ret'])
|
14
|
-
end
|
15
|
-
end
|
10
|
+
@executor.unit.storage.trace(exid, nid, 'trace', payload['ret']) \
|
11
|
+
if point == 'receive' && (t[0] != '_att' || t[1].size == 1)
|
16
12
|
|
17
13
|
super
|
18
14
|
end
|
@@ -21,7 +17,7 @@ class Flor::Pro::Trace < Flor::Procedure
|
|
21
17
|
|
22
18
|
payload['ret'] = node_payload_ret
|
23
19
|
|
24
|
-
|
20
|
+
super
|
25
21
|
end
|
26
22
|
end
|
27
23
|
|
data/lib/flor/unit/scheduler.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.13.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-04-
|
12
|
+
date: 2017-04-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: munemo
|
@@ -151,6 +151,7 @@ files:
|
|
151
151
|
- lib/flor/pcore/cond.rb
|
152
152
|
- lib/flor/pcore/cursor.rb
|
153
153
|
- lib/flor/pcore/define.rb
|
154
|
+
- lib/flor/pcore/echo.rb
|
154
155
|
- lib/flor/pcore/fail.rb
|
155
156
|
- lib/flor/pcore/if.rb
|
156
157
|
- lib/flor/pcore/loop.rb
|