flor 0.9.5 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. data/CHANGELOG.md +10 -0
  2. data/Makefile +13 -5
  3. data/README.md +0 -35
  4. data/flor.gemspec +1 -0
  5. data/lib/flor.rb +6 -24
  6. data/lib/flor/changes.rb +26 -0
  7. data/lib/flor/colours.rb +65 -31
  8. data/lib/flor/conf.rb +84 -54
  9. data/lib/flor/core.rb +0 -23
  10. data/lib/flor/core/executor.rb +12 -42
  11. data/lib/flor/core/node.rb +19 -24
  12. data/lib/flor/core/procedure.rb +13 -24
  13. data/lib/flor/core/texecutor.rb +10 -28
  14. data/lib/flor/deep.rb +152 -0
  15. data/lib/flor/djan.rb +200 -0
  16. data/lib/flor/dollar.rb +0 -24
  17. data/lib/flor/errors.rb +0 -24
  18. data/lib/flor/flor.rb +43 -296
  19. data/lib/flor/id.rb +90 -0
  20. data/lib/flor/log.rb +12 -35
  21. data/lib/flor/migrations/0002_cunit_and_munit.rb +86 -0
  22. data/lib/flor/parser.rb +40 -46
  23. data/lib/flor/pcore/_arr.rb +0 -24
  24. data/lib/flor/pcore/_atom.rb +0 -24
  25. data/lib/flor/pcore/_att.rb +3 -25
  26. data/lib/flor/pcore/_dump.rb +0 -24
  27. data/lib/flor/pcore/_err.rb +0 -24
  28. data/lib/flor/pcore/_happly.rb +0 -24
  29. data/lib/flor/pcore/_obj.rb +0 -24
  30. data/lib/flor/pcore/_skip.rb +0 -24
  31. data/lib/flor/pcore/arith.rb +0 -24
  32. data/lib/flor/pcore/break.rb +0 -24
  33. data/lib/flor/pcore/case.rb +127 -0
  34. data/lib/flor/pcore/cmp.rb +0 -24
  35. data/lib/flor/pcore/cond.rb +24 -24
  36. data/lib/flor/pcore/cursor.rb +0 -24
  37. data/lib/flor/pcore/define.rb +0 -24
  38. data/lib/flor/pcore/fail.rb +0 -24
  39. data/lib/flor/pcore/if.rb +39 -0
  40. data/lib/flor/pcore/loop.rb +0 -24
  41. data/lib/flor/pcore/map.rb +0 -24
  42. data/lib/flor/pcore/match.rb +0 -24
  43. data/lib/flor/pcore/move.rb +0 -24
  44. data/lib/flor/pcore/noeval.rb +0 -24
  45. data/lib/flor/pcore/noret.rb +0 -24
  46. data/lib/flor/pcore/push.rb +1 -25
  47. data/lib/flor/pcore/rand.rb +59 -0
  48. data/lib/flor/pcore/sequence.rb +0 -24
  49. data/lib/flor/pcore/set.rb +0 -24
  50. data/lib/flor/pcore/stall.rb +0 -24
  51. data/lib/flor/pcore/until.rb +0 -24
  52. data/lib/flor/pcore/val.rb +0 -24
  53. data/lib/flor/punit/cancel.rb +0 -24
  54. data/lib/flor/punit/cmap.rb +0 -24
  55. data/lib/flor/punit/concurrence.rb +54 -24
  56. data/lib/flor/punit/every.rb +0 -24
  57. data/lib/flor/punit/graft.rb +41 -0
  58. data/lib/flor/punit/on.rb +0 -24
  59. data/lib/flor/punit/schedule.rb +0 -24
  60. data/lib/flor/punit/signal.rb +0 -24
  61. data/lib/flor/punit/sleep.rb +0 -24
  62. data/lib/flor/punit/task.rb +0 -26
  63. data/lib/flor/punit/trace.rb +0 -24
  64. data/lib/flor/punit/trap.rb +0 -24
  65. data/lib/flor/to_string.rb +4 -25
  66. data/lib/flor/tools/env.rb +0 -23
  67. data/lib/flor/tools/shell.rb +810 -0
  68. data/lib/flor/unit.rb +0 -23
  69. data/lib/flor/unit/executor.rb +35 -31
  70. data/lib/flor/unit/ganger.rb +9 -34
  71. data/lib/flor/unit/hooker.rb +5 -25
  72. data/lib/flor/unit/journal.rb +0 -23
  73. data/lib/flor/unit/loader.rb +63 -94
  74. data/lib/flor/unit/logger.rb +8 -27
  75. data/lib/flor/unit/models.rb +0 -24
  76. data/lib/flor/unit/models/execution.rb +13 -24
  77. data/lib/flor/unit/models/pointer.rb +0 -24
  78. data/lib/flor/unit/models/timer.rb +0 -24
  79. data/lib/flor/unit/models/trace.rb +0 -24
  80. data/lib/flor/unit/models/trap.rb +0 -24
  81. data/lib/flor/unit/scheduler.rb +157 -128
  82. data/lib/flor/unit/storage.rb +224 -167
  83. data/lib/flor/unit/taskers.rb +38 -25
  84. data/lib/flor/unit/waiter.rb +7 -26
  85. data/lib/flor/unit/wlist.rb +8 -24
  86. metadata +28 -7
  87. data/fail.txt +0 -16
  88. data/intercepted.txt +0 -123
  89. data/lib/flor/pcore/ife.rb +0 -56
  90. data/lib/flor/tools/repl.rb +0 -231
  91. data/out.txt +0 -206
@@ -1,26 +1,3 @@
1
- #--
2
- # Copyright (c) 2015-2017, John Mettraux, jmettraux+flor@gmail.com
3
- #
4
- # Permission is hereby granted, free of charge, to any person obtaining a copy
5
- # of this software and associated documentation files (the "Software"), to deal
6
- # in the Software without restriction, including without limitation the rights
7
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- # copies of the Software, and to permit persons to whom the Software is
9
- # furnished to do so, subject to the following conditions:
10
- #
11
- # The above copyright notice and this permission notice shall be included in
12
- # all copies or substantial portions of the Software.
13
- #
14
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
- # THE SOFTWARE.
21
- #
22
- # Made in Japan.
23
- #++
24
1
 
25
2
  require 'sequel'
26
3
  require 'sequel/extensions/migration'
@@ -1,27 +1,3 @@
1
- #--
2
- # Copyright (c) 2015-2017, John Mettraux, jmettraux+flor@gmail.com
3
- #
4
- # Permission is hereby granted, free of charge, to any person obtaining a copy
5
- # of this software and associated documentation files (the "Software"), to deal
6
- # in the Software without restriction, including without limitation the rights
7
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- # copies of the Software, and to permit persons to whom the Software is
9
- # furnished to do so, subject to the following conditions:
10
- #
11
- # The above copyright notice and this permission notice shall be included in
12
- # all copies or substantial portions of the Software.
13
- #
14
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
- # THE SOFTWARE.
21
- #
22
- # Made in Japan.
23
- #++
24
-
25
1
 
26
2
  module Flor
27
3
 
@@ -30,15 +6,21 @@ module Flor
30
6
  attr_reader :exid
31
7
  attr_reader :consumed
32
8
 
33
- def initialize(unit, exid)
9
+ def initialize(unit, messages)
10
+
11
+ @exid = messages.first[:exid]
34
12
 
35
13
  super(
36
14
  unit,
37
- unit.storage.fetch_traps(exid),
38
- unit.storage.load_execution(exid))
39
-
40
- @exid = exid
41
- @messages = unit.storage.fetch_messages(exid)
15
+ unit.storage.fetch_traps(@exid),
16
+ unit.storage.load_execution(@exid))
17
+
18
+ @messages =
19
+ messages.collect { |m|
20
+ Flor::Storage
21
+ .from_blob(m[:content])
22
+ .tap { |mm| mm['mid'] = m[:id].to_i }
23
+ }
42
24
  @consumed = []
43
25
 
44
26
  @alive = true
@@ -110,7 +92,11 @@ module Flor
110
92
  @unit.storage.put_execution(@execution)
111
93
  @unit.storage.put_messages(@messages)
112
94
 
113
- @unit.logger.log_run_end(self, t0)
95
+ du = Time.now - t0
96
+ t0 = Flor.tstamp(t0)
97
+
98
+ @unit.logger.log_run_end(self, t0, du)
99
+ @unit.hooker.notify(self, make_end_message(t0, du))
114
100
 
115
101
  @consumed.clear
116
102
 
@@ -199,6 +185,24 @@ module Flor
199
185
 
200
186
  io.string
201
187
  end
188
+
189
+ def make_end_message(start, duration)
190
+
191
+ m = {}
192
+ m['point'] = 'end'
193
+ m['exid'] = @exid
194
+ m['start'] = start
195
+ m['duration'] = "#{duration}s"
196
+ m['consumed'] = @consumed.size
197
+ m['counters'] = Flor.dup(@execution['counters'])
198
+ m['nodes'] = @execution['nodes'].size
199
+ m['size'] = @execution['size']
200
+ m['archive_size'] = @unit.archive[@exid].size if @unit.archive
201
+ m['er'] = @execution['counters']['runs'] # "emitting run"
202
+ m['pr'] = m['er'] # "processing run"
203
+
204
+ m
205
+ end
202
206
  end
203
207
  end
204
208
 
@@ -1,26 +1,3 @@
1
- #--
2
- # Copyright (c) 2015-2017, John Mettraux, jmettraux+flor@gmail.com
3
- #
4
- # Permission is hereby granted, free of charge, to any person obtaining a copy
5
- # of this software and associated documentation files (the "Software"), to deal
6
- # in the Software without restriction, including without limitation the rights
7
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- # copies of the Software, and to permit persons to whom the Software is
9
- # furnished to do so, subject to the following conditions:
10
- #
11
- # The above copyright notice and this permission notice shall be included in
12
- # all copies or substantial portions of the Software.
13
- #
14
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
- # THE SOFTWARE.
21
- #
22
- # Made in Japan.
23
- #++
24
1
 
25
2
  module Flor
26
3
 
@@ -28,6 +5,8 @@ module Flor
28
5
 
29
6
  # NB: tasker configuration entries start with "gan_"
30
7
 
8
+ #RESERVED_NAMES = %w[ tag ]
9
+
31
10
  attr_reader :unit
32
11
 
33
12
  def initialize(unit)
@@ -40,9 +19,12 @@ module Flor
40
19
 
41
20
  def has_tasker?(exid, name)
42
21
 
43
- domain = exid.split('-', 2).first
22
+ #return false if RESERVED_NAMES.include?(name)
23
+
24
+ d = Flor.domain(exid)
44
25
 
45
- !! @unit.loader.tasker(domain, name)
26
+ #!! @unit.loader.tasker(d, name)
27
+ !! (@unit.loader.tasker(d, 'tasker') || @unit.loader.tasker(d, name))
46
28
  end
47
29
 
48
30
  def task(executor, message)
@@ -82,16 +64,9 @@ module Flor
82
64
  fail NotImplementedError
83
65
  end
84
66
 
85
- def reply(message)
86
-
87
- @unit.queue({
88
- 'point' => 'return',
89
- 'exid' => message['exid'],
90
- 'nid' => message['nid'],
91
- 'payload' => message['payload'],
92
- 'tasker' => message['tasker'] })
67
+ def return(message)
93
68
 
94
- nil
69
+ @unit.return(message)
95
70
  end
96
71
 
97
72
  protected
@@ -1,26 +1,3 @@
1
- #--
2
- # Copyright (c) 2015-2017, John Mettraux, jmettraux+flor@gmail.com
3
- #
4
- # Permission is hereby granted, free of charge, to any person obtaining a copy
5
- # of this software and associated documentation files (the "Software"), to deal
6
- # in the Software without restriction, including without limitation the rights
7
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- # copies of the Software, and to permit persons to whom the Software is
9
- # furnished to do so, subject to the following conditions:
10
- #
11
- # The above copyright notice and this permission notice shall be included in
12
- # all copies or substantial portions of the Software.
13
- #
14
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
- # THE SOFTWARE.
21
- #
22
- # Made in Japan.
23
- #++
24
1
 
25
2
  module Flor
26
3
 
@@ -50,6 +27,11 @@ module Flor
50
27
  h ? h[2] || h[3] : nil
51
28
  end
52
29
 
30
+ def wlist
31
+
32
+ @wlist ||= self['wlist']
33
+ end
34
+
53
35
  def add(*args, &block)
54
36
 
55
37
  name = nil
@@ -113,7 +95,6 @@ module Flor
113
95
 
114
96
  def match?(executor, hook, opts, message)
115
97
 
116
- #p opts if hook.is_a?(Flor::Trap)
117
98
  opts = hook.opts if hook.respond_to?(:opts) && opts.empty?
118
99
 
119
100
  c = o(opts, :consumed, :c)
@@ -125,7 +106,6 @@ module Flor
125
106
  return false if hook.within_itself?(executor, message)
126
107
  end
127
108
 
128
- #p :xxx if hook.is_a?(Flor::Trap)
129
109
  ps = o(opts, :point, :p, [])
130
110
  return false if ps && ! ps.include?(message['point'])
131
111
 
@@ -1,26 +1,3 @@
1
- #--
2
- # Copyright (c) 2015-2017, John Mettraux, jmettraux+flor@gmail.com
3
- #
4
- # Permission is hereby granted, free of charge, to any person obtaining a copy
5
- # of this software and associated documentation files (the "Software"), to deal
6
- # in the Software without restriction, including without limitation the rights
7
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- # copies of the Software, and to permit persons to whom the Software is
9
- # furnished to do so, subject to the following conditions:
10
- #
11
- # The above copyright notice and this permission notice shall be included in
12
- # all copies or substantial portions of the Software.
13
- #
14
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
- # THE SOFTWARE.
21
- #
22
- # Made in Japan.
23
- #++
24
1
 
25
2
  module Flor
26
3
 
@@ -1,26 +1,3 @@
1
- #--
2
- # Copyright (c) 2015-2017, John Mettraux, jmettraux+flor@gmail.com
3
- #
4
- # Permission is hereby granted, free of charge, to any person obtaining a copy
5
- # of this software and associated documentation files (the "Software"), to deal
6
- # in the Software without restriction, including without limitation the rights
7
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- # copies of the Software, and to permit persons to whom the Software is
9
- # furnished to do so, subject to the following conditions:
10
- #
11
- # The above copyright notice and this permission notice shall be included in
12
- # all copies or substantial portions of the Software.
13
- #
14
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
- # THE SOFTWARE.
21
- #
22
- # Made in Japan.
23
- #++
24
1
 
25
2
  module Flor
26
3
 
@@ -43,10 +20,10 @@ module Flor
43
20
 
44
21
  Dir[File.join(root, '**/*.json')]
45
22
  .select { |f| f.index('/etc/variables/') }
46
- .sort # just to be sure
47
- .sort_by(&:length)
48
- .select { |f| path_matches?(domain, f) }
49
- .inject({}) { |vars, f| vars.merge!(interpret(f)) }
23
+ .collect { |pa| [ pa, expose_d(pa, {}) ] }
24
+ .select { |pa, d| is_subdomain?(domain, d) }
25
+ .sort_by { |pa, d| d.count('.') }
26
+ .inject({}) { |vars, (pa, d)| vars.merge!(interpret(pa)) }
50
27
  end
51
28
 
52
29
  #def procedures(path)
@@ -57,69 +34,58 @@ module Flor
57
34
 
58
35
  # If found, returns [ source_path, path ]
59
36
  #
60
- def library(domain, name=nil)
37
+ def library(domain, name=nil, opts={})
61
38
 
39
+ domain, name, opts = [ domain, nil, name ] if name.is_a?(Hash)
62
40
  domain, name = split_dn(domain, name)
63
41
 
64
- path =
65
- (Dir[File.join(root, '**/*.{flo,flor}')])
66
- .sort
67
- .sort_by(&:length)
68
- .select { |f| f.index('/lib/') }
69
- .select { |f| path_name_matches?(domain, name, f) }
70
- .first
42
+ path, d, n = (Dir[File.join(root, '**/*.{flo,flor}')])
43
+ .select { |f| f.index('/lib/') }
44
+ .collect { |pa| [ pa, *expose_dn(pa, opts) ] }
45
+ .select { |pa, d, n| n == name && is_subdomain?(domain, d) }
46
+ .sort_by { |pa, d, n| d.count('.') }
47
+ .last
71
48
 
72
49
  path ? [ Flor.relativize_path(path), File.read(path) ] : nil
73
50
  end
74
51
 
75
- # class FlowEnv
76
- #
77
- # attr_accessor :path, :domain, :flow_name, :source, :variables, :payload
78
- # alias :flow :flow_name
79
- #
80
- # def initialize(loader, path)
81
- #
82
- # @path = path
83
- #
84
- # es = path.split('.')
85
- # @domain, @flow_name = [ es[0..-2].join('.'), es[-1] ]
86
- #
87
- # @source = loader.library(@domain, @flow_name)
88
- # @variables = loader.variables(@domain)
89
- # #@payload = ... # TODO at some point, if necessary...
90
- #
91
- # fail ArgumentError.new(
92
- # "could not find flow at #{@path.inspect}"
93
- # ) unless @source
94
- # end
95
- #
96
- # def to_a
97
- #
98
- # [ path, domain, flow, source, variables, payload ]
99
- # end
100
- # end
101
- #
102
- # def flow_environment(path)
103
- #
104
- # FlowEnv.new(self, path)
105
- # end
106
-
107
52
  def tasker(domain, name=nil)
108
53
 
109
54
  domain, name = split_dn(domain, name)
110
- #p [ domain, name ]
111
55
 
112
- path = Dir[File.join(root, '**/*.json')]
113
- .select { |f| f.index('/lib/taskers/') }
114
- .sort # just to be sure
115
- .select { |f| path_name_matches?(domain, name, f) }
56
+ path, d, n = Dir[File.join(root, '**/*.json')]
57
+ .select { |pa| pa.index('/lib/taskers/') }
58
+ .collect { |pa| [ pa, *expose_dn(pa, {}) ] }
59
+ .select { |pa, d, n|
60
+ is_subdomain?(domain, [ d, n ].join('.')) ||
61
+ (n == name && is_subdomain?(domain, d)) }
62
+ .sort_by { |pa, d, n| d.count('.') }
116
63
  .last
117
64
 
118
- path ? interpret(path) : nil
65
+ return nil unless path
66
+
67
+ conf = interpret(path)
68
+
69
+ return conf if n == name
70
+
71
+ con = conf[name]
72
+
73
+ return nil unless con
74
+
75
+ con.merge!('_path' => conf['_path'])
119
76
  end
120
77
 
121
78
  protected
122
79
 
80
+ # is da a subdomain of db?
81
+ #
82
+ def is_subdomain?(da, db)
83
+
84
+ da == db ||
85
+ db == '' ||
86
+ da[0, db.length + 1] == db + '.'
87
+ end
88
+
123
89
  def split_dn(domain, name)
124
90
 
125
91
  if name
@@ -130,41 +96,44 @@ module Flor
130
96
  end
131
97
  end
132
98
 
133
- def root
134
-
135
- if lp = @unit.conf['lod_path']
136
- File.absolute_path(lp)
137
- else
138
- File.dirname(File.absolute_path(@unit.conf['_path'] + '/..'))
139
- end
140
- end
99
+ def expose_d(path, opts)
141
100
 
142
- def path_matches?(domain, f)
101
+ pa = path[root.length..-1]
102
+ pa = pa[5..-1] if pa[0, 5] == '/usr/'
143
103
 
144
- f = f[root.length..-1]
145
- f = f[5..-1] if f[0, 5] == '/usr/'
104
+ libregex =
105
+ opts[:subflows] ?
106
+ /\/lib\/(subflows|flows|taskers)\// :
107
+ /\/lib\/(flows|taskers)\//
146
108
 
147
- f = f
109
+ pa
148
110
  .sub(/\/etc\/variables\//, '/')
149
- .sub(/\/lib\/(flows|taskers)\//, '/')
111
+ .sub(libregex, '/')
150
112
  .sub(/\/\z/, '')
151
113
  .sub(/\/(flo|flor|dot)\.json\z/, '')
152
114
  .sub(/\.(flo|flor|json)\z/, '')
153
115
  .sub(/\A\//, '')
154
116
  .gsub(/\//, '.')
155
-
156
- #p [ :pm, domain[0, f.length], f, '=>', domain[0, f.length] == f ]
157
- domain[0, f.length] == f
158
117
  end
159
118
 
160
- def path_name_matches?(domain, name, f)
119
+ def expose_dn(path, opts)
161
120
 
162
- f = f.sub(/\/(flo|flor|dot)\.json\z/, '.json')
121
+ pa = expose_d(path, opts)
163
122
 
164
- #p [ domain, name, f ]
165
- return false if File.basename(f).split('.').first != name
123
+ if ri = pa.rindex('.')
124
+ [ pa[0..ri - 1], pa[ri + 1..-1] ]
125
+ else
126
+ [ '', pa ]
127
+ end
128
+ end
166
129
 
167
- path_matches?(domain, File.dirname(f) + '/')
130
+ def root
131
+
132
+ if lp = @unit.conf['lod_path']
133
+ File.absolute_path(lp)
134
+ else
135
+ File.dirname(File.absolute_path(@unit.conf['_path'] + '/..'))
136
+ end
168
137
  end
169
138
 
170
139
  def interpret(path)