flor 0.15.0 → 0.16.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (117) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +14 -1
  3. data/CREDITS.md +1 -0
  4. data/LICENSE.txt +1 -1
  5. data/Makefile +6 -2
  6. data/README.md +2 -1
  7. data/flor.gemspec +12 -2
  8. data/lib/flor.rb +3 -3
  9. data/lib/flor/colours.rb +1 -1
  10. data/lib/flor/conf.rb +3 -4
  11. data/lib/flor/core/executor.rb +31 -61
  12. data/lib/flor/core/node.rb +213 -96
  13. data/lib/flor/core/procedure.rb +194 -75
  14. data/lib/flor/core/texecutor.rb +6 -7
  15. data/lib/flor/djan.rb +41 -22
  16. data/lib/flor/flor.rb +137 -42
  17. data/lib/flor/id.rb +77 -59
  18. data/lib/flor/log.rb +43 -22
  19. data/lib/flor/migrations/0001_tables.rb +7 -7
  20. data/lib/flor/parser.rb +271 -74
  21. data/lib/flor/pcore/_apply.rb +108 -0
  22. data/lib/flor/pcore/_atom.rb +2 -4
  23. data/lib/flor/pcore/_att.rb +54 -37
  24. data/lib/flor/pcore/_dmute.rb +18 -0
  25. data/lib/flor/pcore/_dol.rb +17 -0
  26. data/lib/flor/pcore/_dqs.rb +35 -0
  27. data/lib/flor/pcore/_head.rb +25 -0
  28. data/lib/flor/pcore/_obj.rb +1 -3
  29. data/lib/flor/pcore/_pat_guard.rb +1 -1
  30. data/lib/flor/pcore/_pat_obj.rb +11 -3
  31. data/lib/flor/pcore/_pat_regex.rb +16 -2
  32. data/lib/flor/pcore/_ref.rb +51 -0
  33. data/lib/flor/pcore/_rxs.rb +27 -0
  34. data/lib/flor/pcore/_val.rb +11 -6
  35. data/lib/flor/pcore/{logo.rb → andor.rb} +4 -6
  36. data/lib/flor/pcore/apply.rb +72 -2
  37. data/lib/flor/pcore/arith.rb +16 -4
  38. data/lib/flor/pcore/array_qmark.rb +100 -0
  39. data/lib/flor/pcore/break.rb +1 -2
  40. data/lib/flor/pcore/case.rb +1 -1
  41. data/lib/flor/pcore/cmp.rb +3 -2
  42. data/lib/flor/pcore/collect.rb +2 -2
  43. data/lib/flor/pcore/cond.rb +19 -1
  44. data/lib/flor/pcore/cursor.rb +12 -11
  45. data/lib/flor/pcore/define.rb +30 -4
  46. data/lib/flor/pcore/do_return.rb +3 -0
  47. data/lib/flor/pcore/flatten.rb +39 -0
  48. data/lib/flor/pcore/if.rb +15 -5
  49. data/lib/flor/pcore/includes.rb +5 -2
  50. data/lib/flor/pcore/inject.rb +1 -1
  51. data/lib/flor/pcore/iterator.rb +28 -18
  52. data/lib/flor/pcore/keys.rb +2 -2
  53. data/lib/flor/pcore/map.rb +19 -1
  54. data/lib/flor/pcore/match.rb +2 -2
  55. data/lib/flor/pcore/matchr.rb +18 -5
  56. data/lib/flor/pcore/max.rb +51 -0
  57. data/lib/flor/pcore/merge.rb +134 -0
  58. data/lib/flor/pcore/move.rb +1 -1
  59. data/lib/flor/pcore/noret.rb +1 -1
  60. data/lib/flor/pcore/not.rb +15 -1
  61. data/lib/flor/pcore/on.rb +11 -0
  62. data/lib/flor/pcore/on_cancel.rb +5 -1
  63. data/lib/flor/pcore/on_error.rb +69 -4
  64. data/lib/flor/pcore/push.rb +4 -9
  65. data/lib/flor/pcore/range.rb +5 -5
  66. data/lib/flor/pcore/reduce.rb +5 -18
  67. data/lib/flor/pcore/return.rb +26 -0
  68. data/lib/flor/pcore/reverse.rb +4 -0
  69. data/lib/flor/pcore/sequence.rb +8 -1
  70. data/lib/flor/pcore/set.rb +74 -15
  71. data/lib/flor/pcore/shuffle.rb +71 -0
  72. data/lib/flor/pcore/slice.rb +137 -0
  73. data/lib/flor/pcore/sort.rb +244 -0
  74. data/lib/flor/pcore/sort_by.rb +67 -0
  75. data/lib/flor/pcore/split.rb +39 -0
  76. data/lib/flor/pcore/stall.rb +1 -1
  77. data/lib/flor/pcore/strings.rb +123 -0
  78. data/lib/flor/pcore/timestamp.rb +34 -0
  79. data/lib/flor/pcore/to_array.rb +2 -3
  80. data/lib/flor/pcore/twig.rb +1 -1
  81. data/lib/flor/pcore/type_of.rb +37 -0
  82. data/lib/flor/pcore/until.rb +3 -3
  83. data/lib/flor/punit/cancel.rb +3 -3
  84. data/lib/flor/punit/ccollect.rb +29 -0
  85. data/lib/flor/punit/cmap.rb +76 -20
  86. data/lib/flor/punit/concurrence.rb +440 -33
  87. data/lib/flor/punit/cron.rb +1 -1
  88. data/lib/flor/punit/every.rb +1 -1
  89. data/lib/flor/punit/graft.rb +2 -3
  90. data/lib/flor/punit/on_timeout.rb +5 -1
  91. data/lib/flor/punit/part.rb +63 -0
  92. data/lib/flor/punit/schedule.rb +1 -1
  93. data/lib/flor/punit/task.rb +52 -10
  94. data/lib/flor/punit/trap.rb +4 -5
  95. data/lib/flor/tools/shell.rb +37 -18
  96. data/lib/flor/unit/caller.rb +23 -11
  97. data/lib/flor/unit/executor.rb +33 -12
  98. data/lib/flor/unit/ganger.rb +10 -1
  99. data/lib/flor/unit/hook.rb +2 -1
  100. data/lib/flor/unit/hooker.rb +13 -2
  101. data/lib/flor/unit/loader.rb +7 -7
  102. data/lib/flor/unit/logger.rb +15 -17
  103. data/lib/flor/unit/models.rb +4 -2
  104. data/lib/flor/unit/models/execution.rb +83 -38
  105. data/lib/flor/unit/models/message.rb +16 -0
  106. data/lib/flor/unit/models/pointer.rb +24 -0
  107. data/lib/flor/unit/models/timer.rb +25 -4
  108. data/lib/flor/unit/models/trace.rb +14 -0
  109. data/lib/flor/unit/models/trap.rb +39 -14
  110. data/lib/flor/unit/scheduler.rb +11 -7
  111. data/lib/flor/unit/storage.rb +55 -39
  112. data/lib/flor/unit/taskers.rb +17 -14
  113. data/lib/flor/unit/waiter.rb +4 -3
  114. metadata +40 -10
  115. data/lib/flor/changes.rb +0 -26
  116. data/lib/flor/dollar.rb +0 -224
  117. data/lib/flor/unit/hooks.rb +0 -37
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: 0.15.0
4
+ version: 0.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Mettraux
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-15 00:00:00.000000000 Z
11
+ date: 2019-02-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: munemo
@@ -57,6 +57,9 @@ dependencies:
57
57
  - - "~>"
58
58
  - !ruby/object:Gem::Version
59
59
  version: '1.1'
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: 1.1.8
60
63
  type: :runtime
61
64
  prerelease: false
62
65
  version_requirements: !ruby/object:Gem::Requirement
@@ -64,6 +67,9 @@ dependencies:
64
67
  - - "~>"
65
68
  - !ruby/object:Gem::Version
66
69
  version: '1.1'
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: 1.1.8
67
73
  - !ruby/object:Gem::Dependency
68
74
  name: dense
69
75
  requirement: !ruby/object:Gem::Requirement
@@ -73,7 +79,7 @@ dependencies:
73
79
  version: '1.1'
74
80
  - - ">="
75
81
  - !ruby/object:Gem::Version
76
- version: 1.1.1
82
+ version: 1.1.6
77
83
  type: :runtime
78
84
  prerelease: false
79
85
  version_requirements: !ruby/object:Gem::Requirement
@@ -83,7 +89,7 @@ dependencies:
83
89
  version: '1.1'
84
90
  - - ">="
85
91
  - !ruby/object:Gem::Version
86
- version: 1.1.1
92
+ version: 1.1.6
87
93
  - !ruby/object:Gem::Dependency
88
94
  name: sequel
89
95
  requirement: !ruby/object:Gem::Requirement
@@ -140,7 +146,6 @@ files:
140
146
  - README.md
141
147
  - flor.gemspec
142
148
  - lib/flor.rb
143
- - lib/flor/changes.rb
144
149
  - lib/flor/colours.rb
145
150
  - lib/flor/conf.rb
146
151
  - lib/flor/core.rb
@@ -149,7 +154,6 @@ files:
149
154
  - lib/flor/core/procedure.rb
150
155
  - lib/flor/core/texecutor.rb
151
156
  - lib/flor/djan.rb
152
- - lib/flor/dollar.rb
153
157
  - lib/flor/errors.rb
154
158
  - lib/flor/flor.rb
155
159
  - lib/flor/id.rb
@@ -159,12 +163,17 @@ files:
159
163
  - lib/flor/migrations/0003_timer_onid_bnid.rb
160
164
  - lib/flor/migrations/0004_trap_bnid.rb
161
165
  - lib/flor/parser.rb
166
+ - lib/flor/pcore/_apply.rb
162
167
  - lib/flor/pcore/_arr.rb
163
168
  - lib/flor/pcore/_atom.rb
164
169
  - lib/flor/pcore/_att.rb
165
170
  - lib/flor/pcore/_coll.rb
171
+ - lib/flor/pcore/_dmute.rb
172
+ - lib/flor/pcore/_dol.rb
173
+ - lib/flor/pcore/_dqs.rb
166
174
  - lib/flor/pcore/_dump.rb
167
175
  - lib/flor/pcore/_err.rb
176
+ - lib/flor/pcore/_head.rb
168
177
  - lib/flor/pcore/_obj.rb
169
178
  - lib/flor/pcore/_pat_.rb
170
179
  - lib/flor/pcore/_pat_arr.rb
@@ -172,12 +181,16 @@ files:
172
181
  - lib/flor/pcore/_pat_obj.rb
173
182
  - lib/flor/pcore/_pat_or.rb
174
183
  - lib/flor/pcore/_pat_regex.rb
184
+ - lib/flor/pcore/_ref.rb
185
+ - lib/flor/pcore/_rxs.rb
175
186
  - lib/flor/pcore/_skip.rb
176
187
  - lib/flor/pcore/_val.rb
177
188
  - lib/flor/pcore/all.rb
189
+ - lib/flor/pcore/andor.rb
178
190
  - lib/flor/pcore/any.rb
179
191
  - lib/flor/pcore/apply.rb
180
192
  - lib/flor/pcore/arith.rb
193
+ - lib/flor/pcore/array_qmark.rb
181
194
  - lib/flor/pcore/break.rb
182
195
  - lib/flor/pcore/case.rb
183
196
  - lib/flor/pcore/cmp.rb
@@ -193,6 +206,7 @@ files:
193
206
  - lib/flor/pcore/fail.rb
194
207
  - lib/flor/pcore/filter.rb
195
208
  - lib/flor/pcore/find.rb
209
+ - lib/flor/pcore/flatten.rb
196
210
  - lib/flor/pcore/for_each.rb
197
211
  - lib/flor/pcore/if.rb
198
212
  - lib/flor/pcore/includes.rb
@@ -200,11 +214,12 @@ files:
200
214
  - lib/flor/pcore/iterator.rb
201
215
  - lib/flor/pcore/keys.rb
202
216
  - lib/flor/pcore/length.rb
203
- - lib/flor/pcore/logo.rb
204
217
  - lib/flor/pcore/loop.rb
205
218
  - lib/flor/pcore/map.rb
206
219
  - lib/flor/pcore/match.rb
207
220
  - lib/flor/pcore/matchr.rb
221
+ - lib/flor/pcore/max.rb
222
+ - lib/flor/pcore/merge.rb
208
223
  - lib/flor/pcore/move.rb
209
224
  - lib/flor/pcore/noeval.rb
210
225
  - lib/flor/pcore/noret.rb
@@ -216,13 +231,22 @@ files:
216
231
  - lib/flor/pcore/rand.rb
217
232
  - lib/flor/pcore/range.rb
218
233
  - lib/flor/pcore/reduce.rb
234
+ - lib/flor/pcore/return.rb
219
235
  - lib/flor/pcore/reverse.rb
220
236
  - lib/flor/pcore/select.rb
221
237
  - lib/flor/pcore/sequence.rb
222
238
  - lib/flor/pcore/set.rb
239
+ - lib/flor/pcore/shuffle.rb
240
+ - lib/flor/pcore/slice.rb
241
+ - lib/flor/pcore/sort.rb
242
+ - lib/flor/pcore/sort_by.rb
243
+ - lib/flor/pcore/split.rb
223
244
  - lib/flor/pcore/stall.rb
245
+ - lib/flor/pcore/strings.rb
246
+ - lib/flor/pcore/timestamp.rb
224
247
  - lib/flor/pcore/to_array.rb
225
248
  - lib/flor/pcore/twig.rb
249
+ - lib/flor/pcore/type_of.rb
226
250
  - lib/flor/pcore/until.rb
227
251
  - lib/flor/punit/cancel.rb
228
252
  - lib/flor/punit/ccollect.rb
@@ -233,6 +257,7 @@ files:
233
257
  - lib/flor/punit/every.rb
234
258
  - lib/flor/punit/graft.rb
235
259
  - lib/flor/punit/on_timeout.rb
260
+ - lib/flor/punit/part.rb
236
261
  - lib/flor/punit/schedule.rb
237
262
  - lib/flor/punit/signal.rb
238
263
  - lib/flor/punit/sleep.rb
@@ -249,7 +274,6 @@ files:
249
274
  - lib/flor/unit/ganger.rb
250
275
  - lib/flor/unit/hook.rb
251
276
  - lib/flor/unit/hooker.rb
252
- - lib/flor/unit/hooks.rb
253
277
  - lib/flor/unit/journal.rb
254
278
  - lib/flor/unit/loader.rb
255
279
  - lib/flor/unit/logger.rb
@@ -269,7 +293,13 @@ files:
269
293
  homepage: http://github.com/floraison
270
294
  licenses:
271
295
  - MIT
272
- metadata: {}
296
+ metadata:
297
+ changelog_uri: http://github.com/floraison/flor/blob/master/CHANGELOG.md
298
+ documentation_uri: http://github.com/floraison/flor/tree/master/doc
299
+ bug_tracker_uri: http://github.com/floraison/flor/issues
300
+ mailing_list_uri: https://groups.google.com/forum/#!forum/floraison
301
+ homepage_uri: http://github.com/floraison/flor
302
+ source_code_uri: http://github.com/floraison/flor
273
303
  post_install_message:
274
304
  rdoc_options: []
275
305
  require_paths:
@@ -286,7 +316,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
286
316
  version: '0'
287
317
  requirements: []
288
318
  rubyforge_project:
289
- rubygems_version: 2.7.6
319
+ rubygems_version: 2.4.5.5
290
320
  signing_key:
291
321
  specification_version: 4
292
322
  summary: A Ruby workflow engine
@@ -1,26 +0,0 @@
1
-
2
- module Flor::Changes
3
- extend self
4
-
5
- def apply(h, cs)
6
-
7
- #return cs if cs.is_a?(Hash)
8
-
9
- h = Flor.dup(h)
10
- cs.each { |c| do_apply(h, c) }
11
-
12
- h
13
- end
14
-
15
- protected
16
-
17
- def do_apply(h, c)
18
-
19
- case c['op']
20
- when 'add' then Dense.insert(h, c['path'], c['value'])
21
- when 'replace' then Dense.set(h, c['path'], c['value'])
22
- when 'remove' then Dense.unset(h, c['path'])
23
- end
24
- end
25
- end
26
-
@@ -1,224 +0,0 @@
1
-
2
- module Flor
3
-
4
- class Dollar
5
-
6
- module Parser include Raabro
7
-
8
- #static fabr_tree *_str(fabr_input *i)
9
- #{
10
- # return fabr_rex("s", i,
11
- # "("
12
- # "\\\\\\)" "|"
13
- # "[^\\$\\)]" "|"
14
- # "\\$[^\\(]"
15
- # ")+");
16
- #}
17
- def istr(i)
18
- rex(:str, i, %r{
19
- ( \\\) | [^\$)] | \$[^(] )+
20
- }x)
21
- end
22
-
23
- #static fabr_tree *_outerstr(fabr_input *i)
24
- #{
25
- # return fabr_rex("s", i,
26
- # "("
27
- # "[^\\$]" "|" // doesn't mind ")"
28
- # "\\$[^\\(]"
29
- # ")+");
30
- #}
31
- def ostr(i)
32
- rex(:str, i, %r{
33
- ( [^\$] | \$(?!\() )+
34
- }x)
35
- end
36
- #
37
- # ( [^\$] | \$(?!\() )+
38
- # one or more of (not a dollar or a dollar followed by sthing else
39
- # than a parenthesis opening)
40
-
41
- def pe(i); str(nil, i, ')'); end
42
- def dois(i); alt(nil, i, :dollar, :istr); end
43
- def span(i); rep(:span, i, :dois, 0); end
44
- def dps(i); str(nil, i, '$('); end
45
- def dollar(i); seq(:dollar, i, :dps, :span, :pe); end
46
- def doos(i); alt(nil, i, :dollar, :ostr); end
47
- def outer(i); rep(:span, i, :doos, 0); end
48
-
49
- def rewrite_str(t)
50
- t.string
51
- end
52
- def rewrite_dollar(t)
53
- cn = rewrite(t.children[1])
54
- c = cn.first
55
- if cn.size == 1 && c.is_a?(String)
56
- [ :dol, c ]
57
- else
58
- [ :dol, cn ]
59
- end
60
- end
61
- def rewrite_span(t)
62
- t.children.collect { |c| rewrite(c) }
63
- end
64
- end # module Parser
65
-
66
- module PipeParser include Raabro
67
-
68
- def elt(i); rex(:elt, i, /[^|]+/); end
69
- def pipe(i); rex(:pipe, i, /\|\|?/); end
70
- def elts(i); jseq(:elts, i, :elt, :pipe); end
71
-
72
- def rewrite_elt(t); t.string; end
73
- def rewrite_pipe(t); t.string == '|' ? :pipe : :dpipe; end
74
- def rewrite_elts(t); t.children.collect { |e| rewrite(e) }; end
75
- end # module PipeParser
76
-
77
- #def lookup(s)
78
- # # ...
79
- #end
80
- #
81
- # the signature
82
-
83
- # Called when joining multiple results in a string. Easily overwritable.
84
- #
85
- def stringify(v)
86
-
87
- case v
88
- when Array, Hash then JSON.dump(v)
89
- else v.to_s
90
- end
91
- end
92
-
93
- def quote(s, force)
94
-
95
- return s if force == false && s[0, 1] == '"' && s[-1, 1] == '"'
96
-
97
- JSON.dump([ s ])[1..-2]
98
- end
99
-
100
- def match(rex, s)
101
-
102
- s.match(rex) ? s : false
103
- end
104
-
105
- def substitute(pat, rpl, gix, s)
106
-
107
- ops =
108
- (gix.index('i') ? Regexp::IGNORECASE : 0) |
109
- (gix.index('x') ? Regexp::EXTENDED : 0)
110
-
111
- rex = Regexp.new(pat, ops)
112
-
113
- gix.index('g') ? s.gsub(rex, rpl) : s.sub(rex, rpl)
114
- end
115
-
116
- def lfilter(s, cmp, len)
117
-
118
- l = s.length
119
-
120
- case cmp
121
- when '>' then l > len
122
- when '>=' then l >= len
123
- when '<' then l < len
124
- when '<=' then l <= len
125
- when '=', '==' then l == len
126
- when '!=', '<>' then l != len
127
- else false
128
- end
129
- end
130
-
131
- def to_json(o)
132
-
133
- case o
134
- when Array, Hash then JSON.dump(o)
135
- else JSON.dump([ o ])[1..-2]
136
- end
137
- end
138
-
139
- def call(fun, o)
140
-
141
- # NB: yes, $1..$9 are thread-safe (and local, not global)
142
-
143
- case fun
144
-
145
- when 'u' then o.to_s.upcase
146
- when 'd' then o.to_s.downcase
147
- when 'r' then o.reverse
148
- when 'c' then o.to_s.capitalize.gsub(/\s[a-z]/) { |c| c.upcase }
149
- when 'q' then quote(o, false)
150
- when 'Q' then quote(o, true)
151
- when 'l' then o.length.to_s
152
-
153
- when 'json' then to_json(o)
154
-
155
- when /^j(.+)/
156
- o.respond_to?(:join) ? o.join($1) : o
157
-
158
- when /\Am\/(.+)\/\z/
159
- match($1, o.to_s)
160
- when /\As\/(.*[^\\]\/)(.+)\/([gix]*)\z/
161
- substitute($1.chop, $2, $3, o.to_s)
162
-
163
- when /\A-?\d+\z/ then o.to_s[fun.to_i]
164
- when /\A(-?\d+), *(-?\d+)\z/ then o.to_s[$1.to_i, $2.to_i]
165
- when /\A(-?\d+)\.\.(-?\d+)\z/ then o.to_s[$1.to_i..$2.to_i]
166
-
167
- when /\A\s*l\s*([><=!]=?|<>)\s*(\d+)\z/
168
- lfilter(o.to_s, $1, $2.to_i) ? o.to_s : nil
169
-
170
- else o
171
- end
172
- end
173
-
174
- def unescape(s)
175
-
176
- s.gsub(/\\[\$)]/) { |m| m[1, 1] }
177
- end
178
-
179
- def do_eval(t)
180
-
181
- #return t if t.is_a?(String)
182
- return unescape(t) if t.is_a?(String)
183
-
184
- return t.collect { |c| stringify(do_eval(c)) }.join if t[0] != :dol
185
-
186
- k = do_eval(t[1])
187
- ks = PipeParser.parse(k)
188
-
189
- result = nil
190
- mode = :lookup # vs :call
191
-
192
- ks.each do |k|
193
-
194
- if k == :pipe then mode = :call; next; end
195
- if k == :dpipe && result then break; end
196
- if k == :dpipe then mode = :lookup; next; end
197
-
198
- result =
199
- if mode == :lookup
200
- k[0, 1] == "'" ? k[1..-1] : lookup(k)
201
- else # :call
202
- call(k, result)
203
- end
204
- end
205
-
206
- result
207
- end
208
-
209
- def expand(s)
210
-
211
- return s unless s.index('$')
212
-
213
- #Raabro.pp(Parser.parse(s, debug: 2))
214
- t = Parser.parse(s)
215
-
216
- return s unless t
217
-
218
- t = t.first if t.size == 1
219
-
220
- do_eval(t)
221
- end
222
- end
223
- end
224
-
@@ -1,37 +0,0 @@
1
-
2
- module Flor
3
-
4
- class BasicHook
5
-
6
- def initialize(executor, opts, message)
7
-
8
- @executor = executor
9
- @opts = opts
10
- @message = message
11
- end
12
-
13
- protected
14
-
15
- def point
16
-
17
- @message['point']
18
- end
19
- end
20
-
21
- class PointHook < BasicHook
22
-
23
- def on
24
-
25
- m = "on_#{point}"
26
-
27
- respond_to?(m) ? send(m) : on_default
28
- end
29
-
30
- protected
31
-
32
- def on_default
33
-
34
- []
35
- end
36
- end
37
- end