gloo 3.1.1 → 3.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/gloo.gemspec +1 -0
  3. data/lib/VERSION +1 -1
  4. data/lib/VERSION_NOTES +13 -0
  5. data/lib/gloo/app/log.rb +46 -6
  6. data/lib/gloo/app/platform.rb +7 -1
  7. data/lib/gloo/app/running_app.rb +42 -1
  8. data/lib/gloo/convert/falseclass_to_integer.rb +20 -0
  9. data/lib/gloo/convert/nilclass_to_date.rb +21 -0
  10. data/lib/gloo/convert/nilclass_to_datetime.rb +21 -0
  11. data/lib/gloo/convert/nilclass_to_integer.rb +21 -0
  12. data/lib/gloo/convert/nilclass_to_string.rb +21 -0
  13. data/lib/gloo/convert/nilclass_to_time.rb +21 -0
  14. data/lib/gloo/convert/trueclass_to_integer.rb +20 -0
  15. data/lib/gloo/core/error.rb +7 -0
  16. data/lib/gloo/core/it.rb +7 -0
  17. data/lib/gloo/core/obj.rb +41 -1
  18. data/lib/gloo/core/parser.rb +6 -3
  19. data/lib/gloo/exec/exec_env.rb +4 -0
  20. data/lib/gloo/exec/script.rb +9 -1
  21. data/lib/gloo/objs/basic/container.rb +18 -2
  22. data/lib/gloo/objs/basic/integer.rb +1 -0
  23. data/lib/gloo/objs/cli/menu.rb +9 -3
  24. data/lib/gloo/objs/{basic → ctrl}/function.rb +12 -0
  25. data/lib/gloo/objs/data/markdown.rb +60 -2
  26. data/lib/gloo/objs/data/mysql.rb +35 -7
  27. data/lib/gloo/objs/data/pg.rb +8 -0
  28. data/lib/gloo/objs/data/query.rb +66 -11
  29. data/lib/gloo/objs/data/query_result.rb +22 -1
  30. data/lib/gloo/objs/data/sqlite.rb +17 -2
  31. data/lib/gloo/objs/data/table.rb +143 -4
  32. data/lib/gloo/objs/web/json.rb +2 -0
  33. data/lib/gloo/objs/web_svr/element.rb +13 -5
  34. data/lib/gloo/objs/web_svr/page.rb +44 -2
  35. data/lib/gloo/objs/web_svr/partial.rb +7 -2
  36. data/lib/gloo/objs/web_svr/svr.rb +71 -4
  37. data/lib/gloo/verbs/break.rb +44 -0
  38. data/lib/gloo/verbs/create.rb +6 -0
  39. data/lib/gloo/verbs/invoke.rb +80 -0
  40. data/lib/gloo/verbs/log.rb +26 -5
  41. data/lib/gloo/verbs/redirect.rb +54 -6
  42. data/lib/gloo/web_svr/asset.rb +51 -23
  43. data/lib/gloo/web_svr/handler.rb +4 -2
  44. data/lib/gloo/web_svr/request.rb +35 -2
  45. data/lib/gloo/web_svr/routing/resource_router.rb +47 -0
  46. data/lib/gloo/web_svr/routing/router.rb +218 -0
  47. data/lib/gloo/web_svr/routing/show_routes.rb +98 -0
  48. data/lib/gloo/web_svr/server.rb +10 -2
  49. data/lib/gloo/web_svr/table_renderer.rb +147 -0
  50. data/lib/gloo/web_svr/web_method.rb +54 -0
  51. metadata +31 -4
  52. data/lib/gloo/web_svr/router.rb +0 -179
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e2040934825cd8c004b50e10414322e232c68d30299d7696bef2ae2f23cdb3e8
4
- data.tar.gz: 70374a3c6d010fcc1d84d34ac1036c41d12d9699d8ce3629baf3a58683f0aac9
3
+ metadata.gz: 02f90941d4a489efde1a15b50d55c85af80e1ac02e012102644a21613ce23e90
4
+ data.tar.gz: 3216f0732a0e59b258453ce5d929f751477a264586e73f668ced1332cb601d61
5
5
  SHA512:
6
- metadata.gz: 55b6ece805e4705bcc909de79b80bad0a188d72ccf547f74f272d7f50d720d19e5c9412a99247378f9675f11f53b940ef6a83c05fc5dccf5b87b925742a140f6
7
- data.tar.gz: b53f60308d786d1d4a90ac4e6e8aceb0527832f824b2110d72b767d55bf5f7ed3df467da22df8be0c7ea240462cee1cb21ce9a30c9859f469635133f3687f56c
6
+ metadata.gz: b68948e64413281d9a1f51542888b6818adf28adfb0a625e0c8415c596600207365d761a6c5ebe36c5cebbeb6ab7ee6a6244dc1e8f215b58f5b7000909032d18
7
+ data.tar.gz: 9cef0e42026158497bf424828e691958a196ff7a6cd65771dff504a59c2a205691b997485e7cd1b50e8882d349076b0d8f8b8564f794d953021cf2e4a2310667
data/gloo.gemspec CHANGED
@@ -43,4 +43,5 @@ Gem::Specification.new do |spec|
43
43
  spec.add_dependency 'os', '~> 1.1', '>= 1.1.4'
44
44
  spec.add_dependency 'pg', '~> 1.5.4'
45
45
  spec.add_dependency 'thin', '~> 1.8.2'
46
+ spec.add_dependency 'redcarpet', '~> 3.6.0'
46
47
  end
data/lib/VERSION CHANGED
@@ -1 +1 @@
1
- 3.1.1
1
+ 3.3.0
data/lib/VERSION_NOTES CHANGED
@@ -1,3 +1,16 @@
1
+ 3.3.0 - 2024.08.16
2
+ - Adds nil converters to string and integer.
3
+ - Adds render to markdown object to convert to html
4
+ - Adds invoke verb to call a function from a script
5
+ - Web updates: singular name conventions
6
+
7
+
8
+ 3.2.0 - 2024.07.07
9
+ - Update with more web server functionality, http methods, resource routing
10
+ - Expands query with additional html table support
11
+ - Other web additions and expansion
12
+
13
+
1
14
  3.1.1 - 2024.04.26
2
15
  - Clean build
3
16
 
data/lib/gloo/app/log.rb CHANGED
@@ -17,6 +17,8 @@ module Gloo
17
17
  ERROR = 'error'.freeze
18
18
  LEVELS = [ DEBUG, INFO, WARN, ERROR ].freeze
19
19
 
20
+ CLEARED = "\n\n --- Log files cleared. --- \n\n".freeze
21
+
20
22
  LOG_FILE = 'gloo.log'.freeze
21
23
  ERROR_FILE = 'error.log'.freeze
22
24
 
@@ -46,15 +48,32 @@ module Gloo
46
48
  # Create the default [file] logger.
47
49
  #
48
50
  def create_loggers
49
- f = File.join( @engine.settings.log_path, LOG_FILE )
50
- @logger = Logger.new( f )
51
+ @logger = Logger.new( log_file )
51
52
  @logger.level = Logger::DEBUG
52
53
 
53
- err = File.join( @engine.settings.log_path, ERROR_FILE )
54
- @error = Logger.new( err )
54
+ @error = Logger.new( err_file )
55
55
  @error.level = Logger::WARN
56
56
  end
57
57
 
58
+ # ---------------------------------------------------------------------
59
+ # Files
60
+ # ---------------------------------------------------------------------
61
+
62
+ #
63
+ # Get the log file.
64
+ #
65
+ def log_file
66
+ return File.join( @engine.settings.log_path, LOG_FILE )
67
+ end
68
+
69
+ #
70
+ # Get the error log file.
71
+ #
72
+ def err_file
73
+ return File.join( @engine.settings.log_path, ERROR_FILE )
74
+ end
75
+
76
+
58
77
  # ---------------------------------------------------------------------
59
78
  # Static Helpers
60
79
  # ---------------------------------------------------------------------
@@ -67,6 +86,21 @@ module Gloo
67
86
  return LEVELS.include? str.strip.downcase
68
87
  end
69
88
 
89
+ # ---------------------------------------------------------------------
90
+ # Log file clearing
91
+ # ---------------------------------------------------------------------
92
+
93
+ #
94
+ # Clear the log files.
95
+ #
96
+ def clear
97
+ File.write( log_file, CLEARED )
98
+ File.write( err_file, CLEARED )
99
+
100
+ create_loggers
101
+ end
102
+
103
+
70
104
  # ---------------------------------------------------------------------
71
105
  # Standard Output
72
106
  # ---------------------------------------------------------------------
@@ -74,8 +108,14 @@ module Gloo
74
108
  #
75
109
  # Show a message unless we're in quite mode.
76
110
  #
77
- def show( msg )
78
- puts msg unless @quiet
111
+ def show( msg, color=nil )
112
+ return if @quiet
113
+
114
+ if color
115
+ puts ColorizedString[ msg ].colorize( color.to_sym )
116
+ else
117
+ puts msg
118
+ end
79
119
  end
80
120
 
81
121
  # ---------------------------------------------------------------------
@@ -35,7 +35,13 @@ module Gloo
35
35
  #
36
36
  def show( msg, md=false, page=false )
37
37
  if md
38
- msg = TTY::Markdown.parse msg
38
+ # 2024.08.16 - TTY::Markdown.parse msg was not working.
39
+ # Tried with redcarpet and it was not working either.
40
+ # So just leaving it for now. Not sure I even really need it.
41
+ # TODO: Revisit and clean up.
42
+
43
+ # msg = TTY::Markdown.parse msg
44
+ # msg = Gloo::Objs::Markdown.md_2_manpage( msg )
39
45
  end
40
46
 
41
47
  if page
@@ -10,7 +10,7 @@ module Gloo
10
10
  module App
11
11
  class RunningApp
12
12
 
13
- attr_reader :obj
13
+ attr_reader :obj, :db_time
14
14
 
15
15
  #
16
16
  # Set up the running app for the given object.
@@ -19,6 +19,8 @@ module Gloo
19
19
  @engine = engine
20
20
  @log = @engine.log
21
21
  @obj = obj
22
+
23
+ @db_clients = {}
22
24
  end
23
25
 
24
26
  #
@@ -36,6 +38,45 @@ module Gloo
36
38
  @log.debug "running app stopped for #{@obj.pn}"
37
39
  end
38
40
 
41
+
42
+ # ---------------------------------------------------------------------
43
+ # DB function timer
44
+ # ---------------------------------------------------------------------
45
+
46
+ #
47
+ # Add the given time to the db time.
48
+ #
49
+ def add_db_time time
50
+ @db_time = 0 unless @db_time
51
+ @db_time += time
52
+ end
53
+
54
+ #
55
+ # Reset the db time to zero
56
+ #
57
+ def reset_db_time
58
+ @db_time = 0
59
+ end
60
+
61
+
62
+ # ---------------------------------------------------------------------
63
+ # Cached Database Connections
64
+ # ---------------------------------------------------------------------
65
+
66
+ #
67
+ # Cache the given DB client for the given object.
68
+ #
69
+ def cache_db_client( obj, client )
70
+ @db_clients[ obj.pn ] = client
71
+ end
72
+
73
+ #
74
+ # Get the DB client for the given object.
75
+ #
76
+ def db_client_for_obj( obj )
77
+ return @db_clients[ obj.pn ]
78
+ end
79
+
39
80
  end
40
81
  end
41
82
  end
@@ -0,0 +1,20 @@
1
+ # Author:: Eric Crane (mailto:eric.crane@mac.com)
2
+ # Copyright:: Copyright (c) 2024 Eric Crane. All rights reserved.
3
+ #
4
+ # Conversion tool: FALSE to Integer.
5
+ #
6
+
7
+ module Gloo
8
+ module Convert
9
+ class FalseClassToInteger
10
+
11
+ #
12
+ # Convert the given FALSE value to an integer.
13
+ #
14
+ def convert( value )
15
+ return 0
16
+ end
17
+
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,21 @@
1
+ # Author:: Eric Crane (mailto:eric.crane@mac.com)
2
+ # Copyright:: Copyright (c) 2024 Eric Crane. All rights reserved.
3
+ #
4
+ # Conversion tool: Nil to Date.
5
+ #
6
+ require 'chronic'
7
+
8
+ module Gloo
9
+ module Convert
10
+ class NilClassToDate
11
+
12
+ #
13
+ # Convert a nil to a date.
14
+ #
15
+ def convert( value )
16
+ return Chronic.parse( '' )
17
+ end
18
+
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,21 @@
1
+ # Author:: Eric Crane (mailto:eric.crane@mac.com)
2
+ # Copyright:: Copyright (c) 2024 Eric Crane. All rights reserved.
3
+ #
4
+ # Conversion tool: Nil to DateTime.
5
+ #
6
+ require 'chronic'
7
+
8
+ module Gloo
9
+ module Convert
10
+ class NilClassToDateTime
11
+
12
+ #
13
+ # Convert a nil to a date.
14
+ #
15
+ def convert( value )
16
+ return Chronic.parse( '' )
17
+ end
18
+
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,21 @@
1
+ # Author:: Eric Crane (mailto:eric.crane@mac.com)
2
+ # Copyright:: Copyright (c) 2024 Eric Crane. All rights reserved.
3
+ #
4
+ # Conversion tool: Nil to Integer.
5
+ #
6
+ require 'chronic'
7
+
8
+ module Gloo
9
+ module Convert
10
+ class NilClassToInteger
11
+
12
+ #
13
+ # Convert a nil to a string.
14
+ #
15
+ def convert( value )
16
+ return 0
17
+ end
18
+
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,21 @@
1
+ # Author:: Eric Crane (mailto:eric.crane@mac.com)
2
+ # Copyright:: Copyright (c) 2024 Eric Crane. All rights reserved.
3
+ #
4
+ # Conversion tool: Nil to String.
5
+ #
6
+ require 'chronic'
7
+
8
+ module Gloo
9
+ module Convert
10
+ class NilClassToString
11
+
12
+ #
13
+ # Convert a nil to a string.
14
+ #
15
+ def convert( value )
16
+ return ''
17
+ end
18
+
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,21 @@
1
+ # Author:: Eric Crane (mailto:eric.crane@mac.com)
2
+ # Copyright:: Copyright (c) 2024 Eric Crane. All rights reserved.
3
+ #
4
+ # Conversion tool: Nil to Time.
5
+ #
6
+ require 'chronic'
7
+
8
+ module Gloo
9
+ module Convert
10
+ class NilClassToTime
11
+
12
+ #
13
+ # Convert a nil to a date.
14
+ #
15
+ def convert( value )
16
+ return Chronic.parse( '' )
17
+ end
18
+
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,20 @@
1
+ # Author:: Eric Crane (mailto:eric.crane@mac.com)
2
+ # Copyright:: Copyright (c) 2024 Eric Crane. All rights reserved.
3
+ #
4
+ # Conversion tool: TRUE to Integer.
5
+ #
6
+
7
+ module Gloo
8
+ module Convert
9
+ class TrueClassToInteger
10
+
11
+ #
12
+ # Convert the given TRUE value to an integer.
13
+ #
14
+ def convert( value )
15
+ return 1
16
+ end
17
+
18
+ end
19
+ end
20
+ end
@@ -56,6 +56,13 @@ module Gloo
56
56
  return @value.to_s
57
57
  end
58
58
 
59
+ #
60
+ # Is this a function object?
61
+ #
62
+ def is_function?
63
+ return false
64
+ end
65
+
59
66
  end
60
67
  end
61
68
  end
data/lib/gloo/core/it.rb CHANGED
@@ -31,6 +31,13 @@ module Gloo
31
31
  return @value.to_s
32
32
  end
33
33
 
34
+ #
35
+ # Is this a function object?
36
+ #
37
+ def is_function?
38
+ return false
39
+ end
40
+
34
41
  end
35
42
  end
36
43
  end
data/lib/gloo/core/obj.rb CHANGED
@@ -137,6 +137,21 @@ module Gloo
137
137
  return self.value.to_s.strip.empty?
138
138
  end
139
139
 
140
+ #
141
+ # Is this an alias to another object?
142
+ #
143
+ def is_alias?
144
+ return self.type_display == Gloo::Objs::Alias.typename
145
+ end
146
+
147
+ #
148
+ # Is this a function object?
149
+ #
150
+ def is_function?
151
+ return self.type_display == Gloo::Objs::Function.typename
152
+ end
153
+
154
+
140
155
  # ---------------------------------------------------------------------
141
156
  # Children
142
157
  # ---------------------------------------------------------------------
@@ -193,7 +208,7 @@ module Gloo
193
208
  return o if name.downcase == o.name.downcase
194
209
  end
195
210
 
196
- if self.type_display == Gloo::Objs::Alias.typename
211
+ if is_alias?
197
212
  ln = Gloo::Core::Pn.new( @engine, self.value )
198
213
  redirect = ln.resolve
199
214
  return redirect.find_child( name )
@@ -201,6 +216,16 @@ module Gloo
201
216
  return nil
202
217
  end
203
218
 
219
+ #
220
+ # Get the index of the child with the given name.
221
+ #
222
+ def child_index( name )
223
+ @children.each_with_index do |o, i|
224
+ return i if name.downcase == o.name.downcase
225
+ end
226
+ return nil
227
+ end
228
+
204
229
  #
205
230
  # Delete all children from the container.
206
231
  #
@@ -300,6 +325,21 @@ module Gloo
300
325
  @engine.persist_man.reload self
301
326
  end
302
327
 
328
+
329
+ # ---------------------------------------------------------------------
330
+ # Render
331
+ # ---------------------------------------------------------------------
332
+
333
+ #
334
+ # Render the object.
335
+ # By default this is just the object's value.
336
+ # The render_ƒ is 'render_html', 'render_text', 'render_json', etc.
337
+ #
338
+ def render render_ƒ
339
+ return self.value.to_s
340
+ end
341
+
342
+
303
343
  # ---------------------------------------------------------------------
304
344
  # Help
305
345
  # ---------------------------------------------------------------------
@@ -20,8 +20,11 @@ module Gloo
20
20
  #
21
21
  # Parse a command from the immediate execution context.
22
22
  #
23
- def parse_immediate( cmd )
24
- cmd, params = split_params cmd
23
+ def parse_immediate( full_cmd )
24
+ # Break the full command into verb and params
25
+ cmd, params = split_params full_cmd
26
+
27
+ # Params are the parenthetical part of the command at the end
25
28
  params = Gloo::Core::Tokens.new( params ) if params
26
29
  tokens = Gloo::Core::Tokens.new( cmd )
27
30
  dic = Gloo::Core::Dictionary.instance
@@ -42,7 +45,7 @@ module Gloo
42
45
  if i && cmd.strip.end_with?( ')' )
43
46
  pstr = cmd[ i + 1..-1 ]
44
47
  params = pstr.strip[ 0..-2 ] if pstr
45
- cmd = cmd[ 0, i - 1 ]
48
+ cmd = cmd[ 0, i].strip
46
49
  end
47
50
  return cmd, params
48
51
  end
@@ -10,6 +10,7 @@ module Gloo
10
10
  class ExecEnv
11
11
 
12
12
  attr_accessor :verbs, :actions, :scripts, :here
13
+ attr_reader :running_script
13
14
 
14
15
  VERB_STACK = 'verbs'.freeze
15
16
  ACTION_STACK = 'actions'.freeze
@@ -22,6 +23,7 @@ module Gloo
22
23
  def initialize( engine )
23
24
  @engine = engine
24
25
  @engine.log.debug 'exec env intialized...'
26
+ @running_script = nil
25
27
 
26
28
  @verbs = Gloo::Exec::Stack.new( @engine, VERB_STACK )
27
29
  @actions = Gloo::Exec::Stack.new( @engine, ACTION_STACK )
@@ -43,6 +45,7 @@ module Gloo
43
45
  #
44
46
  def push_script( script )
45
47
  @scripts.push script
48
+ @running_script = script
46
49
  @here.push script.obj
47
50
  end
48
51
 
@@ -51,6 +54,7 @@ module Gloo
51
54
  #
52
55
  def pop_script
53
56
  @scripts.pop
57
+ @running_script = @scripts.stack.last
54
58
  @here.pop
55
59
  end
56
60
 
@@ -9,13 +9,13 @@ module Gloo
9
9
  class Script
10
10
 
11
11
  attr_accessor :obj
12
-
13
12
  #
14
13
  # Set up the script.
15
14
  #
16
15
  def initialize( engine, obj )
17
16
  @engine = engine
18
17
  @obj = obj
18
+ @break_out = false
19
19
  end
20
20
 
21
21
  #
@@ -30,6 +30,7 @@ module Gloo
30
30
  @engine.parser.run @obj.value
31
31
  elsif @obj.value.is_a? Array
32
32
  @obj.value.each do |line|
33
+ break if @break_out
33
34
  @engine.parser.run line
34
35
  end
35
36
  end
@@ -45,6 +46,13 @@ module Gloo
45
46
  return @obj.pn
46
47
  end
47
48
 
49
+ #
50
+ # Stop running this script.
51
+ #
52
+ def break_out
53
+ @break_out = true
54
+ end
55
+
48
56
  end
49
57
  end
50
58
  end
@@ -33,7 +33,7 @@ module Gloo
33
33
  # Get a list of message names that this object receives.
34
34
  #
35
35
  def self.messages
36
- return super + %w[count delete_children show_key_value_table]
36
+ return super + %w[count delete_children child_exists show_key_value_table]
37
37
  end
38
38
 
39
39
  #
@@ -57,9 +57,25 @@ module Gloo
57
57
  #
58
58
  def msg_show_key_value_table
59
59
  data = self.children.map { |o| [ o.name, o.value ] }
60
- @engine.platform.show_table nil, data, title
60
+
61
+ # TODO: this doesn't work:
62
+ # @engine.platform.show_table nil, data, title
61
63
  end
62
64
 
65
+ #
66
+ # Check to see if there is a child with the given name.
67
+ #
68
+ def msg_child_exists
69
+ if @params&.token_count&.positive?
70
+ expr = Gloo::Expr::Expression.new( @engine, @params.tokens )
71
+ data = expr.evaluate
72
+ end
73
+ return unless data
74
+
75
+ val = self.contains_child?( data )
76
+ @engine.heap.it.set_to val
77
+ return val
78
+ end
63
79
  end
64
80
  end
65
81
  end
@@ -37,6 +37,7 @@ module Gloo
37
37
  self.value = new_value.to_i
38
38
  end
39
39
 
40
+
40
41
  # ---------------------------------------------------------------------
41
42
  # Messages
42
43
  # ---------------------------------------------------------------------
@@ -68,7 +68,10 @@ module Gloo
68
68
  #
69
69
  def add_loop_child
70
70
  o = find_child LOOP
71
- return if o
71
+ if o
72
+ o.set_value true
73
+ return
74
+ end
72
75
 
73
76
  fac = @engine.factory
74
77
  fac.create_bool LOOP, true, self
@@ -324,7 +327,7 @@ module Gloo
324
327
  # Run the selected command.
325
328
  #
326
329
  def run_command( cmd )
327
- @engine.log.debug "Menu Command: #{cmd}"
330
+ @engine.log.info "Menu Command: #{cmd}"
328
331
  obj = find_cmd cmd
329
332
 
330
333
  if obj
@@ -335,15 +338,18 @@ module Gloo
335
338
  s.run
336
339
  else
337
340
  if cmd == '?'
341
+ @engine.log.debug 'Showing options'
338
342
  show_options
339
343
  elsif cmd == 'q!'
340
- @engine.log.info 'Quitting Gloo'
344
+ @engine.log.debug 'Quitting Gloo'
341
345
  @engine.stop_running
342
346
  elsif cmd == 'qq'
347
+ @engine.log.debug 'Quitting to top level menu'
343
348
  pop_to_top_level_menu
344
349
  elsif cmd.starts_with? ':'
345
350
  gloo_cmd = cmd[1..-1].strip
346
351
  if gloo_cmd.blank?
352
+ @engine.log.debug 'Quitting all menus and dropping into Gloo'
347
353
  quit_all_menus
348
354
  else
349
355
  @engine.log.debug "Running Gloo command: #{gloo_cmd}"
@@ -14,6 +14,7 @@ module Gloo
14
14
 
15
15
  # Events
16
16
  ON_INVOKE = 'on_invoke'.freeze
17
+ AFTER_INVOKE = 'after_invoke'.freeze
17
18
 
18
19
  # Parameters to the function invocation.
19
20
  PARAMS = 'params'.freeze
@@ -132,6 +133,16 @@ module Gloo
132
133
  Gloo::Exec::Dispatch.message( @engine, 'run', o )
133
134
  end
134
135
 
136
+ #
137
+ # Run the after invoke script if there is one.
138
+ #
139
+ def run_after_invoke
140
+ o = find_child AFTER_INVOKE
141
+ return unless o
142
+
143
+ Gloo::Exec::Dispatch.message( @engine, 'run', o )
144
+ end
145
+
135
146
 
136
147
  # ---------------------------------------------------------------------
137
148
  # Messages
@@ -147,6 +158,7 @@ module Gloo
147
158
  run_on_invoke
148
159
  return_value = result
149
160
  @engine.heap.it.set_to return_value
161
+ run_after_invoke
150
162
 
151
163
  return return_value
152
164
  end