gloo 4.6.1 → 5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +1 -1
  3. data/gloo.gemspec +22 -11
  4. data/lib/VERSION +1 -1
  5. data/lib/VERSION_NOTES +12 -0
  6. data/lib/gloo/app/engine.rb +8 -1
  7. data/lib/gloo/app/running_app.rb +13 -0
  8. data/lib/gloo/app/settings.rb +5 -1
  9. data/lib/gloo/core/dictionary.rb +15 -2
  10. data/lib/gloo/objs/ctrl/each.rb +2 -2
  11. data/lib/gloo/plugin/base.rb +19 -0
  12. data/lib/gloo/plugin/callback.rb +33 -0
  13. data/lib/gloo/plugin/ext_manager.rb +90 -0
  14. data/lib/gloo/plugin/lib_manager.rb +97 -0
  15. data/lib/gloo/verbs/exists.rb +75 -0
  16. data/lib/gloo/verbs/help.rb +58 -1
  17. data/lib/gloo/verbs/load.rb +49 -5
  18. data/lib/gloo/verbs/redirect.rb +2 -1
  19. metadata +38 -166
  20. data/lib/gloo/objs/cli/colorize.rb +0 -73
  21. data/lib/gloo/objs/cli/confirm.rb +0 -96
  22. data/lib/gloo/objs/cli/menu.rb +0 -370
  23. data/lib/gloo/objs/cli/menu_item.rb +0 -95
  24. data/lib/gloo/objs/cli/prompt.rb +0 -110
  25. data/lib/gloo/objs/cli/select.rb +0 -127
  26. data/lib/gloo/objs/ctrl/each_repo.rb +0 -84
  27. data/lib/gloo/objs/data/markdown.rb +0 -133
  28. data/lib/gloo/objs/data/markdown_ext.rb +0 -260
  29. data/lib/gloo/objs/data/mysql.rb +0 -254
  30. data/lib/gloo/objs/data/pg.rb +0 -216
  31. data/lib/gloo/objs/data/query.rb +0 -269
  32. data/lib/gloo/objs/data/query_result.rb +0 -158
  33. data/lib/gloo/objs/data/sqlite.rb +0 -174
  34. data/lib/gloo/objs/data/table.rb +0 -267
  35. data/lib/gloo/objs/dev/git.rb +0 -140
  36. data/lib/gloo/objs/dev/stats.rb +0 -123
  37. data/lib/gloo/objs/system/ssh_exec.rb +0 -126
  38. data/lib/gloo/objs/web/slack.rb +0 -130
  39. data/lib/gloo/objs/web/teams.rb +0 -117
  40. data/lib/gloo/objs/web_svr/element.rb +0 -254
  41. data/lib/gloo/objs/web_svr/field.rb +0 -429
  42. data/lib/gloo/objs/web_svr/form.rb +0 -271
  43. data/lib/gloo/objs/web_svr/page.rb +0 -562
  44. data/lib/gloo/objs/web_svr/partial.rb +0 -210
  45. data/lib/gloo/objs/web_svr/svr.rb +0 -713
  46. data/lib/gloo/utils/stats.rb +0 -206
  47. data/lib/gloo/verbs/alert.rb +0 -79
  48. data/lib/gloo/verbs/beep.rb +0 -40
  49. data/lib/gloo/web_svr/asset.rb +0 -407
  50. data/lib/gloo/web_svr/asset_info.rb +0 -116
  51. data/lib/gloo/web_svr/config.rb +0 -56
  52. data/lib/gloo/web_svr/embedded_renderer.rb +0 -154
  53. data/lib/gloo/web_svr/handler.rb +0 -154
  54. data/lib/gloo/web_svr/request.rb +0 -143
  55. data/lib/gloo/web_svr/request_params.rb +0 -181
  56. data/lib/gloo/web_svr/response.rb +0 -177
  57. data/lib/gloo/web_svr/response_code.rb +0 -69
  58. data/lib/gloo/web_svr/routing/resource_router.rb +0 -47
  59. data/lib/gloo/web_svr/routing/router.rb +0 -232
  60. data/lib/gloo/web_svr/routing/show_routes.rb +0 -94
  61. data/lib/gloo/web_svr/server.rb +0 -105
  62. data/lib/gloo/web_svr/session.rb +0 -215
  63. data/lib/gloo/web_svr/table_renderer.rb +0 -151
  64. data/lib/gloo/web_svr/web_method.rb +0 -54
  65. /data/lib/gloo/objs/{security → str_utils}/cipher.rb +0 -0
  66. /data/lib/gloo/objs/{security → str_utils}/csrf_token.rb +0 -0
  67. /data/lib/gloo/objs/{security → str_utils}/password.rb +0 -0
  68. /data/lib/gloo/objs/{ror → system}/erb.rb +0 -0
  69. /data/lib/gloo/objs/{ror → system}/eval.rb +0 -0
@@ -1,210 +0,0 @@
1
- # Author:: Eric Crane (mailto:eric.crane@mac.com)
2
- # Copyright:: Copyright (c) 2024 Eric Crane. All rights reserved.
3
- #
4
- # A partial page.
5
- #
6
-
7
- module Gloo
8
- module Objs
9
- class Partial < Gloo::Core::Obj
10
-
11
- KEYWORD = 'partial'.freeze
12
- KEYWORD_SHORT = 'part'.freeze
13
-
14
- # Events
15
- ON_RENDER = 'on_render'.freeze
16
- AFTER_RENDER = 'after_render'.freeze
17
-
18
- # Parameters used during render.
19
- PARAMS = 'params'.freeze
20
-
21
- # Content
22
- CONTENT = 'content'.freeze
23
-
24
-
25
- #
26
- # The name of the object type.
27
- #
28
- def self.typename
29
- return KEYWORD
30
- end
31
-
32
- #
33
- # The short name of the object type.
34
- #
35
- def self.short_typename
36
- return KEYWORD_SHORT
37
- end
38
-
39
- #
40
- # Set the value with any necessary type conversions.
41
- #
42
- def set_value( new_value )
43
- self.value = new_value.to_s
44
- end
45
-
46
- #
47
- # Does this object support multi-line values?
48
- # Initially only true for scripts.
49
- #
50
- def multiline_value?
51
- return false
52
- end
53
-
54
- #
55
- # Get the content obj.
56
- #
57
- def content
58
- return find_child CONTENT
59
- end
60
-
61
- #
62
- # Get the params hash from the child object.
63
- # Returns nil if there is none.
64
- #
65
- def params_hash
66
- params_can = find_child PARAMS
67
- return nil unless params_can
68
-
69
- h = {}
70
- params_can.children.each do |o|
71
- h[ o.name ] = o.value
72
- end
73
-
74
- return h
75
- end
76
-
77
-
78
- # ---------------------------------------------------------------------
79
- # Events
80
- # ---------------------------------------------------------------------
81
-
82
- #
83
- # Run the on render script if there is one.
84
- #
85
- def run_on_render
86
- o = find_child ON_RENDER
87
- return unless o
88
-
89
- Gloo::Exec::Dispatch.message( @engine, 'run', o )
90
- end
91
-
92
- #
93
- # Run the on rendered script if there is one.
94
- #
95
- def run_after_render
96
- o = find_child AFTER_RENDER
97
- return unless o
98
-
99
- Gloo::Exec::Dispatch.message( @engine, 'run', o )
100
- end
101
-
102
-
103
- # ---------------------------------------------------------------------
104
- # Children
105
- # ---------------------------------------------------------------------
106
-
107
- #
108
- # Does this object have children to add when an object
109
- # is created in interactive mode?
110
- # This does not apply during obj load, etc.
111
- #
112
- def add_children_on_create?
113
- return true
114
- end
115
-
116
- #
117
- # Add children to this object.
118
- # This is used by containers to add children needed
119
- # for default configurations.
120
- #
121
- def add_default_children
122
- fac = @engine.factory
123
-
124
- fac.create_script ON_RENDER, '', self
125
- fac.create_script AFTER_RENDER, '', self
126
-
127
- fac.create_can PARAMS, self
128
- fac.create_can CONTENT, self
129
- end
130
-
131
-
132
- # ---------------------------------------------------------------------
133
- # Messages
134
- # ---------------------------------------------------------------------
135
-
136
- #
137
- # Get a list of message names that this object receives.
138
- #
139
- def self.messages
140
- return super + [ 'render' ]
141
- end
142
-
143
- #
144
- # Get the expiration date for the certificate.
145
- #
146
- def msg_render
147
- part_content = self.render
148
- @engine.heap.it.set_to part_content
149
- return part_content
150
- end
151
-
152
-
153
- # ---------------------------------------------------------------------
154
- # Render
155
- # ---------------------------------------------------------------------
156
-
157
- #
158
- # Render the page.
159
- # Use the specified render function or HTML by default.
160
- #
161
- def render( render_ƒ = :render_html )
162
- run_on_render
163
-
164
- part_content = ''
165
- data = content
166
- if data.children.empty?
167
- part_content = data.value
168
- else
169
- data.children.each do |e|
170
- part_content << e.send( render_ƒ )
171
- end
172
- end
173
-
174
- # part_content = Page.render_params part_content, params_hash
175
- part_content = @engine.running_app.obj.embedded_renderer.render part_content, params_hash
176
-
177
- run_after_render
178
- return part_content
179
- end
180
-
181
- #
182
- # Render the layout with the body and head params.
183
- #
184
- def render_layout( head, body )
185
- run_on_render
186
-
187
- part_content = ''
188
- content.children.each do |e|
189
- e = Gloo::Objs::Alias.resolve_alias( @engine, e )
190
-
191
- obj = e.find_child CONTENT
192
- e = obj if obj
193
-
194
- part_content << Element.render_obj( e, :render_html, @engine )
195
- end
196
-
197
- params = params_hash || {}
198
- params[ 'head' ] = head
199
- params[ 'body' ] = body
200
-
201
- # part_content = Page.render_params part_content, params
202
- part_content = @engine.running_app.obj.embedded_renderer.render part_content, params
203
-
204
- run_after_render
205
- return part_content
206
- end
207
-
208
- end
209
- end
210
- end