flor 0.9.1.1 → 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,6 +2,12 @@
2
2
  # flor CHANGELOG.md
3
3
 
4
4
 
5
+ ## flor 0.9.2 released 2017-02-03
6
+
7
+ - Allow for domain taskers (retasking)
8
+ - Pass flow path (if any) in launch message
9
+
10
+
5
11
  ## flor 0.9.1.1 released 2017-01-31
6
12
 
7
13
  - Fix Gemfile.lock not updated...
@@ -31,8 +31,12 @@ A Ruby workflow engine (ruote next generation)
31
31
  #s.add_runtime_dependency 'rufus-lru', '>= 1.1.0'
32
32
  s.add_runtime_dependency 'fugit', '>= 0.9.5'
33
33
 
34
- s.add_development_dependency 'rspec', '3.4.0'
35
34
  s.add_development_dependency 'sequel', '~> 4'
35
+ #
36
+ # flor in transient mode doesn't need a storage,
37
+ # so Sequel is not a runtime dependency
38
+
39
+ s.add_development_dependency 'rspec', '3.4.0'
36
40
 
37
41
  s.require_path = 'lib'
38
42
  end
@@ -34,7 +34,7 @@ require 'raabro'
34
34
 
35
35
  module Flor
36
36
 
37
- VERSION = '0.9.1.1'
37
+ VERSION = '0.9.2'
38
38
  end
39
39
 
40
40
  require 'flor/colours'
@@ -55,10 +55,13 @@ module Flor
55
55
  tree
56
56
 
57
57
  unless t
58
- #h = opts.merge(prune: false, rewrite: false)
59
- #p Flor::Lang.parse(tree, h[:fname], h)
58
+
59
+ #h = opts.merge(prune: false, rewrite: false, debug: 0)
60
+ #Raabro.pp(Flor::Lang.parse(tree, h[:fname], h))
60
61
  # TODO re-parse and indicate what went wrong...
61
- fail ArgumentError.new('flor parse failure')
62
+
63
+ fail ArgumentError.new(
64
+ "flor parse failure: " + tree.inspect[0, 35] + '...')
62
65
  end
63
66
 
64
67
  pl = opts[:payload] || opts[:fields] || {}
@@ -323,15 +323,16 @@ class Flor::Node
323
323
  return [ '_proc', { 'proc' => key }, -1 ]
324
324
  end
325
325
 
326
- if mod != 'd' && @executor.unit.tasker.has_tasker?(@executor.exid, key)
327
- return [ '_task', { 'task' => key }, -1 ]
328
- end
329
-
330
326
  l = @executor.unit.loader
331
327
  vdomain = @node['vdomain']
332
328
  #
333
329
  if l && vdomain != false
334
- return l.variables(vdomain || domain)[key]
330
+ v = l.variables(vdomain || domain).fetch(key) { :no }
331
+ return v unless v == :no
332
+ end
333
+
334
+ if mod != 'd' && @executor.unit.tasker.has_tasker?(@executor.exid, key)
335
+ return [ '_task', { 'task' => key }, -1 ]
335
336
  end
336
337
 
337
338
  nil
@@ -379,6 +379,15 @@ module Flor
379
379
  s.length < l ? s : s[0, l] + '...'
380
380
  end
381
381
 
382
+ def self.relativize_path(path, from=Dir.getwd)
383
+
384
+ path = File.absolute_path(path)
385
+
386
+ path = path[from.length + 1..-1] if path[0, from.length] == from
387
+
388
+ path
389
+ end
390
+
382
391
  #
383
392
  # functions about time
384
393
 
@@ -55,6 +55,8 @@ module Flor
55
55
  # # TODO work with Flor.load_procedures
56
56
  #end
57
57
 
58
+ # If found, returns [ source_path, path ]
59
+ #
58
60
  def library(domain, name=nil)
59
61
 
60
62
  domain, name = split_dn(domain, name)
@@ -67,7 +69,7 @@ module Flor
67
69
  .select { |f| path_name_matches?(domain, name, f) }
68
70
  .first
69
71
 
70
- path ? File.read(path) : nil
72
+ path ? [ Flor.relativize_path(path), File.read(path) ] : nil
71
73
  end
72
74
 
73
75
  # class FlowEnv
@@ -105,11 +107,11 @@ module Flor
105
107
  def tasker(domain, name=nil)
106
108
 
107
109
  domain, name = split_dn(domain, name)
110
+ #p [ domain, name ]
108
111
 
109
112
  path = Dir[File.join(root, '**/*.json')]
110
113
  .select { |f| f.index('/lib/taskers/') }
111
114
  .sort # just to be sure
112
- .sort_by(&:length)
113
115
  .select { |f| path_name_matches?(domain, name, f) }
114
116
  .last
115
117
 
@@ -159,6 +161,7 @@ module Flor
159
161
 
160
162
  f = f.sub(/\/(flo|flor|dot)\.json\z/, '.json')
161
163
 
164
+ #p [ domain, name, f ]
162
165
  return false if File.basename(f).split('.').first != name
163
166
 
164
167
  path_matches?(domain, File.dirname(f) + '/')
@@ -207,10 +207,14 @@ module Flor
207
207
 
208
208
  if flow_name
209
209
 
210
- source = @loader.library(source_or_path)
210
+ source_path, source = @loader.library(source_or_path)
211
+
212
+ opts[:fname] = source_path
211
213
 
212
214
  # TODO variables
215
+ # loaded as needed, via the loader
213
216
  # TODO payload
217
+ # yes, still has to be done
214
218
  end
215
219
 
216
220
  fail ArgumentError.new(
@@ -49,10 +49,8 @@ module Flor
49
49
  tname = message['tasker']
50
50
 
51
51
  tconf =
52
- @unit.loader.tasker(domain, 'tasker') ||
52
+ ( ! message['routed'] && @unit.loader.tasker(domain, 'tasker')) ||
53
53
  @unit.loader.tasker(domain, tname)
54
- #
55
- # FIXME tasker tasker tasker lookup loop?
56
54
 
57
55
  fail ArgumentError.new(
58
56
  "tasker #{tname.inspect} not found"
@@ -88,6 +86,8 @@ module Flor
88
86
  'nid' => message['nid'],
89
87
  'payload' => message['payload'],
90
88
  'tasker' => message['tasker'] })
89
+
90
+ nil
91
91
  end
92
92
 
93
93
  protected
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.9.1.1
4
+ version: 0.9.2
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-01-31 00:00:00.000000000 Z
12
+ date: 2017-02-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: munemo
@@ -60,37 +60,37 @@ dependencies:
60
60
  - !ruby/object:Gem::Version
61
61
  version: 0.9.5
62
62
  - !ruby/object:Gem::Dependency
63
- name: rspec
63
+ name: sequel
64
64
  requirement: !ruby/object:Gem::Requirement
65
65
  none: false
66
66
  requirements:
67
- - - '='
67
+ - - ~>
68
68
  - !ruby/object:Gem::Version
69
- version: 3.4.0
69
+ version: '4'
70
70
  type: :development
71
71
  prerelease: false
72
72
  version_requirements: !ruby/object:Gem::Requirement
73
73
  none: false
74
74
  requirements:
75
- - - '='
75
+ - - ~>
76
76
  - !ruby/object:Gem::Version
77
- version: 3.4.0
77
+ version: '4'
78
78
  - !ruby/object:Gem::Dependency
79
- name: sequel
79
+ name: rspec
80
80
  requirement: !ruby/object:Gem::Requirement
81
81
  none: false
82
82
  requirements:
83
- - - ~>
83
+ - - '='
84
84
  - !ruby/object:Gem::Version
85
- version: '4'
85
+ version: 3.4.0
86
86
  type: :development
87
87
  prerelease: false
88
88
  version_requirements: !ruby/object:Gem::Requirement
89
89
  none: false
90
90
  requirements:
91
- - - ~>
91
+ - - '='
92
92
  - !ruby/object:Gem::Version
93
- version: '4'
93
+ version: 3.4.0
94
94
  description: A Ruby workflow engine (ruote next generation)
95
95
  email:
96
96
  - jmettraux+flor@gmail.com