gloo 6.0 → 6.1.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 (81) hide show
  1. checksums.yaml +4 -4
  2. data/CLAUDE.md +9 -3
  3. data/README.md +38 -7
  4. data/docs/application.md +164 -0
  5. data/docs/getting_started.md +112 -0
  6. data/docs/iterators.md +294 -0
  7. data/docs/language_objects.md +190 -0
  8. data/docs/language_scripting.md +62 -0
  9. data/docs/language_syntax.md +307 -0
  10. data/docs/objects.md +77 -0
  11. data/docs/operators.md +62 -0
  12. data/docs/plugins.md +54 -0
  13. data/docs/verbs.md +64 -0
  14. data/gloo.gemspec +5 -3
  15. data/lib/VERSION +1 -1
  16. data/lib/VERSION_NOTES +14 -0
  17. data/lib/gloo/app/platform.rb +29 -2
  18. data/lib/gloo/app/settings.rb +1 -1
  19. data/lib/gloo/core/gloo_system.rb +52 -1
  20. data/lib/gloo/docs/doc_data.rb +160 -0
  21. data/lib/gloo/docs/help_shell.rb +285 -0
  22. data/lib/gloo/docs/markdown_renderer.rb +39 -0
  23. data/lib/gloo/objs/basic/alias.rb +53 -0
  24. data/lib/gloo/objs/basic/boolean.rb +30 -0
  25. data/lib/gloo/objs/basic/container.rb +38 -0
  26. data/lib/gloo/objs/basic/decimal.rb +30 -0
  27. data/lib/gloo/objs/basic/integer.rb +58 -0
  28. data/lib/gloo/objs/basic/script.rb +31 -0
  29. data/lib/gloo/objs/basic/string.rb +51 -4
  30. data/lib/gloo/objs/basic/string_msgs.rb +20 -0
  31. data/lib/gloo/objs/basic/text.rb +51 -4
  32. data/lib/gloo/objs/basic/untyped.rb +21 -0
  33. data/lib/gloo/objs/ctrl/each.rb +63 -1
  34. data/lib/gloo/objs/ctrl/function.rb +69 -0
  35. data/lib/gloo/objs/ctrl/repeat.rb +41 -0
  36. data/lib/gloo/objs/dt/date.rb +43 -0
  37. data/lib/gloo/objs/dt/datetime.rb +50 -0
  38. data/lib/gloo/objs/dt/time.rb +43 -0
  39. data/lib/gloo/objs/str_utils/cipher.rb +59 -0
  40. data/lib/gloo/objs/str_utils/outline.rb +65 -1
  41. data/lib/gloo/objs/str_utils/password.rb +56 -0
  42. data/lib/gloo/objs/system/erb.rb +39 -0
  43. data/lib/gloo/objs/system/file_handle.rb +56 -0
  44. data/lib/gloo/objs/system/system.rb +29 -0
  45. data/lib/gloo/objs/web/http_get.rb +35 -0
  46. data/lib/gloo/objs/web/http_post.rb +33 -0
  47. data/lib/gloo/objs/web/json.rb +40 -0
  48. data/lib/gloo/objs/web/uri.rb +40 -0
  49. data/lib/gloo/shell/command_node.rb +39 -0
  50. data/lib/gloo/shell/context.rb +93 -0
  51. data/lib/gloo/shell/runner.rb +315 -0
  52. data/lib/gloo/verbs/break.rb +32 -0
  53. data/lib/gloo/verbs/check.rb +49 -0
  54. data/lib/gloo/verbs/cls.rb +18 -0
  55. data/lib/gloo/verbs/context.rb +47 -0
  56. data/lib/gloo/verbs/create.rb +42 -0
  57. data/lib/gloo/verbs/eval.rb +27 -0
  58. data/lib/gloo/verbs/execute.rb +27 -0
  59. data/lib/gloo/verbs/exists.rb +54 -2
  60. data/lib/gloo/verbs/files.rb +22 -0
  61. data/lib/gloo/verbs/help.rb +43 -178
  62. data/lib/gloo/verbs/if.rb +52 -0
  63. data/lib/gloo/verbs/invoke.rb +62 -0
  64. data/lib/gloo/verbs/list.rb +32 -0
  65. data/lib/gloo/verbs/load.rb +55 -2
  66. data/lib/gloo/verbs/log.rb +44 -0
  67. data/lib/gloo/verbs/move.rb +36 -1
  68. data/lib/gloo/verbs/put.rb +35 -0
  69. data/lib/gloo/verbs/quit.rb +19 -0
  70. data/lib/gloo/verbs/redirect.rb +52 -2
  71. data/lib/gloo/verbs/reload.rb +27 -0
  72. data/lib/gloo/verbs/run.rb +39 -0
  73. data/lib/gloo/verbs/save.rb +26 -0
  74. data/lib/gloo/verbs/show.rb +54 -0
  75. data/lib/gloo/verbs/tell.rb +32 -0
  76. data/lib/gloo/verbs/throw.rb +29 -0
  77. data/lib/gloo/verbs/unless.rb +50 -0
  78. data/lib/gloo/verbs/unload.rb +23 -0
  79. data/lib/gloo/verbs/version.rb +37 -3
  80. data/lib/gloo/verbs/wait.rb +26 -0
  81. metadata +28 -20
@@ -10,6 +10,17 @@ module Gloo
10
10
  module Objs
11
11
  module StringMsgs
12
12
 
13
+ #
14
+ # Get the list of message names this mixin implements, derived
15
+ # from its own msg_* methods so String/Text don't have to
16
+ # hand-duplicate the list (and can't drift out of sync with it).
17
+ #
18
+ def self.messages
19
+ return instance_methods( false )
20
+ .select { |m| m.to_s.start_with?( 'msg_' ) }
21
+ .map { |m| m.to_s.sub( /\Amsg_/, '' ) }
22
+ end
23
+
13
24
 
14
25
  #
15
26
  # Strip whitespace from the beginning and end of the string.
@@ -324,6 +335,15 @@ module Gloo
324
335
  return s
325
336
  end
326
337
 
338
+ #
339
+ # Show the value in a pager, for long content.
340
+ #
341
+ def msg_page
342
+ return unless value
343
+
344
+ @engine.platform.page( value )
345
+ end
346
+
327
347
  end
328
348
  end
329
349
  end
@@ -58,10 +58,57 @@ module Gloo
58
58
  # Get a list of message names that this object receives.
59
59
  #
60
60
  def self.messages
61
- return super + %w[up down size starts_with? ends_with? substring? sub gsub
62
- count_lines count_words count_chars trim
63
- format_for_html encode64 decode64 escape unescape
64
- gen_alphanumeric gen_uuid gen_hex gen_base64]
61
+ return super + StringMsgs.messages
62
+ end
63
+
64
+ # ---------------------------------------------------------------------
65
+ # Object Documentation
66
+ # ---------------------------------------------------------------------
67
+
68
+ #
69
+ # Get the object's documentation data.
70
+ #
71
+ def self.doc_data
72
+ {
73
+ :name => KEYWORD,
74
+ :shortcut => KEYWORD_SHORT,
75
+ :description => 'A longer, multi-line text string. Use BEGIN ' \
76
+ 'and END to mark the text range.',
77
+ :messages => [
78
+ 'Same messages as the string object type:',
79
+ 'up — Convert the string to uppercase. This message changes the value of the string.',
80
+ 'down — Convert the string to lowercase. This message changes the value of the string.',
81
+ 'size — Get the size of the string. It will have the string size.',
82
+ 'count_chars — Count the number of characters in the string. It will have the character count.',
83
+ 'count_words — Count the number of words in the string. It will have the word count.',
84
+ 'count_lines — Count the number of lines in the string. It will have the line count.',
85
+ 'starts_with? ({str}) — Check if the string starts with the given string. A parameter is required: the string to look for at the beginning of this string. It will have a boolean.',
86
+ 'ends_with? ({str}) — Check if the string ends with the given string. A parameter is required: the string to look for at the end of this string. It will have a boolean.',
87
+ 'substring? ({str}) — Check if the string includes the given sub-string. A parameter is required: the string to look for in this string. It will have a boolean.',
88
+ 'format_for_html — Format this string for HTML output. Tabs, spaces and returns are converted to HTML elements. The value of the string is changed.',
89
+ 'encode64 — Base64 encode the string. This message changes the value of the string. It will have the encoded string.',
90
+ 'decode64 — Decode the string from Base64. This message changes the value of the string. It will have the decoded string.',
91
+ 'escape — Escape the string to make it URL safe. This message changes the value of the string. It will have the escaped string.',
92
+ 'unescape — Unescape the string (from URL safe format). This message changes the value of the string. It will have the unescaped string.',
93
+ 'gen_uuid — Set the value of the string to a newly generated, random UUID. This message changes the value of the string.',
94
+ 'gen_alphanumeric ({len}) — Set the value of the string to a newly generated, random alphanumeric string. The {len} parameter is optional; the length is 10 if not specified. This message changes the value of the string.',
95
+ 'gen_hex ({len}) — Set the value of the string to a newly generated, random hex string. The {len} parameter is optional; the length is 10 if not specified. This message changes the value of the string.',
96
+ 'gen_base64 ({len}) — Set the value of the string to a newly generated, random base64 string. The {len} parameter is optional; the length is 12 if not specified. This message changes the value of the string.',
97
+ 'trim — Strip whitespace from the beginning and end of the string. This message changes the value of the string. It will have the trimmed string.',
98
+ 'sub ({from}, {to}) — Substitute the first occurrence of {from} with {to}. Both parameters are required. This message changes the value of the string. It will have the result.',
99
+ 'gsub ({from}, {to}) — Substitute all occurrences of {from} with {to}. Both parameters are required. This message changes the value of the string. It will have the result.',
100
+ 'page — Show the value in a pager (less), for viewing long content a screen at a time.'
101
+ ],
102
+ :examples => <<~EXAMPLES.strip
103
+ t [container] :
104
+ msg [txt] : BEGIN
105
+ I will now write a poem
106
+ of two lines or less
107
+ END
108
+ on_load [script] :
109
+ show t.msg
110
+ EXAMPLES
111
+ }
65
112
  end
66
113
 
67
114
  end
@@ -36,6 +36,27 @@ module Gloo
36
36
  return super
37
37
  end
38
38
 
39
+ # ---------------------------------------------------------------------
40
+ # Object Documentation
41
+ # ---------------------------------------------------------------------
42
+
43
+ #
44
+ # Get the object's documentation data.
45
+ #
46
+ def self.doc_data
47
+ {
48
+ :name => KEYWORD,
49
+ :shortcut => KEYWORD_SHORT,
50
+ :description => 'An untyped object. If no type is specified ' \
51
+ 'when an object is created it will be of this type.',
52
+ :examples => <<~EXAMPLES.strip
53
+ > create x
54
+ > put 1 into x
55
+ > put 'string' into x
56
+ EXAMPLES
57
+ }
58
+ end
59
+
39
60
  end
40
61
  end
41
62
  end
@@ -104,11 +104,73 @@ module Gloo
104
104
  EachDir.new( @engine, self ).run
105
105
  # elsif EachRepo.use_for?( self )
106
106
  # EachRepo.new( @engine, self ).run
107
- else
107
+ else
108
108
  @engine.err "Not set up to run each for that target."
109
109
  end
110
110
  end
111
111
 
112
+ # ---------------------------------------------------------------------
113
+ # Object Documentation
114
+ # ---------------------------------------------------------------------
115
+
116
+ #
117
+ # Get the object's documentation data.
118
+ #
119
+ def self.doc_data
120
+ {
121
+ :name => KEYWORD,
122
+ :shortcut => KEYWORD_SHORT,
123
+ :description => 'Perform an action for each item in a ' \
124
+ 'collection. There are several variations on this object ' \
125
+ 'type, determined by which named child is present: each ' \
126
+ 'child object in a container, each word in a string, each ' \
127
+ 'line in a block of text, each file in a folder, or each ' \
128
+ 'directory in a folder.',
129
+ :children => [
130
+ 'in — The collection or source to iterate over (a container, string, or folder path, depending on variation).',
131
+ 'do (script) — The action to perform for each item in the loop.',
132
+ 'One of the following, whose presence determines which kind of loop this is:',
133
+ 'child (alias) — iterate a container\'s children.',
134
+ 'word (string) — iterate the words in a string.',
135
+ 'line (string) — iterate the lines in a block of text.',
136
+ 'file (file) — iterate the files in a folder; an optional ext (string) child limits to files of that extension.',
137
+ 'dir (file) — iterate the directories in a folder.'
138
+ ],
139
+ :messages => [
140
+ 'run — Run the loop for each item in the collection.'
141
+ ],
142
+ :notes => 'When iterating a container\'s children, an ' \
143
+ 'optional group_by feature is available: add a group_by ' \
144
+ '(string) child naming a property of each child, plus ' \
145
+ 'on_group_start / on_group_end (script) children — those ' \
146
+ 'scripts run whenever the group_by value changes, letting ' \
147
+ 'you aggregate results in groups.',
148
+ :examples => <<~EXAMPLES.strip
149
+ #
150
+ # Show each child in a container.
151
+ #
152
+ each_child [can] :
153
+
154
+ # Iterator on children of a container.
155
+ for [each] :
156
+ child [alias] :
157
+ in [alias] : each_child.objs
158
+ do [script] : show ^.child
159
+
160
+ # Data
161
+ objs [can] :
162
+ 1 [string] : one
163
+ 2 [string] : two
164
+ 3 [string] : three
165
+
166
+ # Run the iterator.
167
+ on_load [script] :
168
+ show 'showing children in container' (white)
169
+ tell each_child.for to run
170
+ EXAMPLES
171
+ }
172
+ end
173
+
112
174
  end
113
175
  end
114
176
  end
@@ -194,6 +194,75 @@ module Gloo
194
194
  end
195
195
  end
196
196
 
197
+ # ---------------------------------------------------------------------
198
+ # Object Documentation
199
+ # ---------------------------------------------------------------------
200
+
201
+ #
202
+ # Get the object's documentation data.
203
+ #
204
+ def self.doc_data
205
+ {
206
+ :name => KEYWORD,
207
+ :shortcut => KEYWORD_SHORT,
208
+ :description => 'Define a function that will be performed ' \
209
+ 'somewhere else. When the function is invoked, the ' \
210
+ 'parameter values are set, the on_invoke script is run, the ' \
211
+ 'result is determined, the after_invoke script is run, and ' \
212
+ 'the result is returned.',
213
+ :children => [
214
+ 'on_invoke (script) — Script to run when the function is invoked.',
215
+ 'after_invoke (optional script) — Script to run after the function has been invoked and before the value is returned. Can be used to clean up and reset the object state.',
216
+ 'params (container) — The collection of parameters to the function. Parameter values are used as defaults if no value is passed in during invocation.',
217
+ 'result (string) — The result of the function to return to the caller.'
218
+ ],
219
+ :messages => [
220
+ 'invoke — Invoke the function, set it and return the result. The function result is put into it as well as being returned to the caller.'
221
+ ],
222
+ :examples => <<~EXAMPLES.strip
223
+ #
224
+ # Function examples
225
+ #
226
+
227
+ functions [can] :
228
+
229
+ name [string] : Jasper
230
+
231
+ on_load [script] :
232
+ show 'running function examples' (white)
233
+
234
+ invoke functions.greet ^.name
235
+ show it
236
+
237
+ invoke functions.add 3 4
238
+ show it
239
+
240
+ show 'done' (white)
241
+
242
+ #
243
+ # Say hi to person (name)
244
+ #
245
+ greet [ƒ] :
246
+ on_invoke [script] :
247
+ put 'Hi, ' + ^.params.name into ^.result
248
+ params [container] :
249
+ name [string] : none
250
+ result [string] :
251
+
252
+ #
253
+ # Add 2 numbers
254
+ #
255
+ add [ƒ] :
256
+ on_invoke [script] :
257
+ put ^.params.x and ^.params.y into ^.result
258
+ params [container] :
259
+ x [int] :
260
+ y [int] :
261
+ result [string] :
262
+ EXAMPLES
263
+ }
264
+ end
265
+
197
266
  end
198
267
  end
199
268
  end
@@ -102,6 +102,47 @@ module Gloo
102
102
  end
103
103
  end
104
104
 
105
+ # ---------------------------------------------------------------------
106
+ # Object Documentation
107
+ # ---------------------------------------------------------------------
108
+
109
+ #
110
+ # Get the object's documentation data.
111
+ #
112
+ def self.doc_data
113
+ {
114
+ :name => KEYWORD,
115
+ :shortcut => KEYWORD_SHORT,
116
+ :description => 'Run a script a given number of times.',
117
+ :children => [
118
+ 'times (integer) — Default: 0. The number of times to run the script.',
119
+ 'index (integer) — Default: 0. The current iteration when the repeat loop is running.',
120
+ 'do (script) — The action to perform for each iteration of the loop.'
121
+ ],
122
+ :messages => [
123
+ 'run — Run the script for the given number of times.'
124
+ ],
125
+ :examples => <<~EXAMPLES.strip
126
+ repeat [can] :
127
+ s [string] :
128
+ on_load [script] :
129
+ put $.screen_cols / 2 into repeat.x.times
130
+ tell repeat.x to run
131
+ show repeat.s
132
+ tell repeat.y to run
133
+ show repeat.s
134
+ x [repeat] :
135
+ times [integer] : 30
136
+ index [integer] : 0
137
+ do [script] : put repeat.s + '-' into repeat.s
138
+ y [repeat] :
139
+ times [integer] : 10
140
+ index [integer] : 0
141
+ do [script] : show repeat.y.index
142
+ EXAMPLES
143
+ }
144
+ end
145
+
105
146
  end
106
147
  end
107
148
  end
@@ -149,6 +149,49 @@ module Gloo
149
149
  dt = Chronic.parse( self.value )
150
150
  @engine.heap.it.set_to dt.strftime( format )
151
151
  end
152
+
153
+ # ---------------------------------------------------------------------
154
+ # Object Documentation
155
+ # ---------------------------------------------------------------------
156
+
157
+ #
158
+ # Get the object's documentation data.
159
+ #
160
+ def self.doc_data
161
+ {
162
+ :name => KEYWORD,
163
+ :shortcut => KEYWORD_SHORT,
164
+ :description => 'A reference to a date, but without time. The ' \
165
+ "default format is: #{DEFAULT_FORMAT}. Note that you can " \
166
+ 'put a date into a datetime object. You can also put a ' \
167
+ 'Chronic phrase into the date.',
168
+ :messages => [
169
+ 'now — Set to the current system date.',
170
+ 'add ({amount}) — Add the amount to the date. The amount will be in the form of "1 day" or "3 months".',
171
+ 'sub ({amount}) — Subtract the amount from the date. The amount will be in the form of "1 day" or "2 weeks".',
172
+ 'dd — Get the day portion of the date. Put the day number into it.',
173
+ 'mm — Get the month portion of the date. Put the month number into it.',
174
+ 'yy — Get the 2 digit year portion of the date. Put the 2 digit year into it.',
175
+ 'yyyy — Get the 4 digit year portion of the date. Put the 4 digit year into it.',
176
+ 'format ({fmt}) — Format the date using a strftime-style format string. Default if none given: %Y-%m-%d. It will have the formatted string.'
177
+ ],
178
+ :examples => <<~EXAMPLES.strip
179
+ #
180
+ # Show the current date.
181
+ #
182
+
183
+ date [can] :
184
+ d [date] :
185
+ on_load [script] :
186
+ tell date.d to now
187
+ show date.d
188
+ next [script] :
189
+ put 'tomorrow' into date.d
190
+ show date.d
191
+ EXAMPLES
192
+ }
193
+ end
194
+
152
195
  end
153
196
  end
154
197
  end
@@ -249,6 +249,56 @@ module Gloo
249
249
  @engine.heap.it.set_to dt.strftime( format )
250
250
  end
251
251
 
252
+ # ---------------------------------------------------------------------
253
+ # Object Documentation
254
+ # ---------------------------------------------------------------------
255
+
256
+ #
257
+ # Get the object's documentation data.
258
+ #
259
+ def self.doc_data
260
+ {
261
+ :name => KEYWORD,
262
+ :shortcut => KEYWORD_SHORT,
263
+ :description => 'A reference to a date and time. The default ' \
264
+ "format is: #{DEFAULT_FORMAT}. Note that you can put a " \
265
+ 'datetime into a date or time object. You can also put a ' \
266
+ 'Chronic phrase into the datetime.',
267
+ :messages => [
268
+ 'now — Set to the current system date and time.',
269
+ 'add ({amount}) — Add the amount to the date. The amount will be in the form of "1 day" or "3 hours".',
270
+ 'sub ({amount}) — Subtract the amount from the date. The amount will be in the form of "1 day" or "2 weeks".',
271
+ 'is_today — Is the datetime today? It will be true or false.',
272
+ 'is_past — Is the datetime in the past? It will be true or false.',
273
+ 'is_future — Is the datetime in the future? It will be true or false.',
274
+ 'is_yesterday — Is the datetime yesterday? It will be true or false.',
275
+ 'is_tomorrow — Is the datetime tomorrow? It will be true or false.',
276
+ 'is_this_week — Is the datetime during this week? It will be true or false.',
277
+ 'begin_day — Set the datetime to the start of the day.',
278
+ 'end_day — Set the datetime to the end of the day.',
279
+ 'begin_week — Set the datetime to the start of the week.',
280
+ 'end_week — Set the datetime to the end of the week.',
281
+ 'begin_month — Set the datetime to the start of the month.',
282
+ 'end_month — Set the datetime to the end of the month.',
283
+ 'begin_year — Set the datetime to the start of the year.',
284
+ 'end_year — Set the datetime to the end of the year.',
285
+ 'format ({fmt}) — Format the date and time using a strftime-style format string. Default if none given: %Y-%m-%d %H:%M:%S. It will have the formatted string.'
286
+ ],
287
+ :examples => <<~EXAMPLES.strip
288
+ #
289
+ # Show the current date and time.
290
+ #
291
+
292
+ dt [can] :
293
+ d [datetime] :
294
+ on_load [script] :
295
+ tell dt.d to now
296
+ show dt.d
297
+ next [script] : put '1 week from now' into dt.d
298
+ EXAMPLES
299
+ }
300
+ end
301
+
252
302
  end
253
303
  end
254
304
  end
@@ -149,6 +149,49 @@ module Gloo
149
149
  dt = Chronic.parse( self.value )
150
150
  @engine.heap.it.set_to dt.strftime( format )
151
151
  end
152
+
153
+ # ---------------------------------------------------------------------
154
+ # Object Documentation
155
+ # ---------------------------------------------------------------------
156
+
157
+ #
158
+ # Get the object's documentation data.
159
+ #
160
+ def self.doc_data
161
+ {
162
+ :name => KEYWORD,
163
+ :shortcut => KEYWORD_SHORT,
164
+ :description => 'A reference to a time, but without a date. ' \
165
+ "The default format is: #{DEFAULT_FORMAT}. Note that you " \
166
+ 'can put a time into a datetime object. You can also put a ' \
167
+ 'Chronic phrase into the time.',
168
+ :messages => [
169
+ 'now — Set to the current system time.',
170
+ 'add ({amount}) — Add the amount to the date. The amount will be in the form of "1 day" or "3 months".',
171
+ 'sub ({amount}) — Subtract the amount from the date. The amount will be in the form of "1 day" or "2 weeks".',
172
+ 'hh — Get the hour portion of the time. Put the hour into it.',
173
+ 'mm — Get the minute portion of the time. Put the minute into it.',
174
+ 'ss — Get the second portion of the time. Put the second into it.',
175
+ 'am — Get the am/pm portion of the time. Put "am" or "pm" into it.',
176
+ 'format ({fmt}) — Format the time using a strftime-style format string. Default if none given: %H:%M:%S. It will have the formatted string.'
177
+ ],
178
+ :examples => <<~EXAMPLES.strip
179
+ #
180
+ # Show the current time.
181
+ #
182
+
183
+ time [can] :
184
+ t [time] :
185
+ on_load [script] :
186
+ tell time.t to now
187
+ show time.t
188
+ next [script] :
189
+ put '1 hour from now' into time.t
190
+ show time.t
191
+ EXAMPLES
192
+ }
193
+ end
194
+
152
195
  end
153
196
  end
154
197
  end
@@ -185,6 +185,65 @@ module Gloo
185
185
  return cipher.update( data ) + cipher.final
186
186
  end
187
187
 
188
+ # ---------------------------------------------------------------------
189
+ # Object Documentation
190
+ # ---------------------------------------------------------------------
191
+
192
+ #
193
+ # Get the object's documentation data.
194
+ #
195
+ def self.doc_data
196
+ {
197
+ :name => KEYWORD,
198
+ :shortcut => KEYWORD_SHORT,
199
+ :description => 'Tool to encrypt and decrypt data.',
200
+ :children => [
201
+ 'key (string) — The encryption key. Base64 encoded.',
202
+ 'init_vector (string) — The initialization vector. Base64 encoded.',
203
+ 'data (string) — The encrypted or decrypted data.'
204
+ ],
205
+ :messages => [
206
+ 'generate_keys — Generate an encryption key and initialization vector. The keys are base64 encoded.',
207
+ 'encrypt — Encrypt the data.',
208
+ 'decrypt — Decrypt the data.'
209
+ ],
210
+ :examples => <<~EXAMPLES.strip
211
+ #
212
+ # Encrypt and Decrypt a string.
213
+ #
214
+
215
+ encrypt [can] :
216
+
217
+ str [string] : Encrypt your data for better security!
218
+
219
+ cipher [cipher] :
220
+ key [string] :
221
+ init_vector [string] :
222
+ data [string] :
223
+
224
+ on_load [script] :
225
+ show
226
+ show 'Original string' (white)
227
+ show ^.str
228
+ show
229
+ show 'Generating Key' (white)
230
+ tell ^.cipher to generate_keys
231
+ show ^.cipher.key
232
+ show ^.cipher.init_vector
233
+ show
234
+ show 'Encrpting the string' (white)
235
+ put ^.str into ^.cipher.data
236
+ tell ^.cipher to encrypt
237
+ show ^.cipher.data
238
+ show
239
+ show 'Decrypting the string' (white)
240
+ tell ^.cipher to decrypt
241
+ show ^.cipher.data
242
+ show
243
+ EXAMPLES
244
+ }
245
+ end
246
+
188
247
  end
189
248
  end
190
249
  end
@@ -249,7 +249,71 @@ module Gloo
249
249
  end
250
250
  end
251
251
  end
252
-
252
+
253
+ # ---------------------------------------------------------------------
254
+ # Object Documentation
255
+ # ---------------------------------------------------------------------
256
+
257
+ #
258
+ # Get the object's documentation data.
259
+ #
260
+ def self.doc_data
261
+ {
262
+ :name => KEYWORD,
263
+ :shortcut => KEYWORD_SHORT,
264
+ :description => 'Convert strings with a path to a hierarchical outline.',
265
+ :children => [
266
+ 'object_source (alias) — Points to the data source. Should be a container with objects, each of which has a name and optionally an id.',
267
+ 'entity_path (string) — The path to the entity, used to generate links to entities that have IDs.',
268
+ "separator_char (string) — Optional. If not specified, the '/' character is used. The character used to separate the path elements.",
269
+ 'data (string) — The generated outline: a hierarchical outline of OL and LI elements. For children with IDs, links to entities are included.'
270
+ ],
271
+ :messages => [
272
+ 'generate — Generate the outline from the list of strings.'
273
+ ],
274
+ :examples => <<~EXAMPLES.strip
275
+ #
276
+ # Convert flat elements to hierarchal outline.
277
+ #
278
+
279
+ outline [container] :
280
+
281
+ on_load [script] :
282
+ tell outline.util to generate
283
+ show outline.util.data
284
+
285
+ src_data [container] :
286
+ 1 [container] :
287
+ id [int] : 1
288
+ name [string] : a/b/c
289
+ 2 [container] :
290
+ id [int] : 2
291
+ name [string] : a/b/d
292
+ 3 [container] :
293
+ id [int] : 3
294
+ name [string] : a/b/e
295
+ 4 [container] :
296
+ id [int] : 4
297
+ name [string] : x
298
+ 5 [container] :
299
+ id [int] : 5
300
+ name [string] : x/y
301
+ 6 [container] :
302
+ id [int] : 6
303
+ name [string] : x/y/z
304
+ 7 [container] :
305
+ id [int] : 7
306
+ name [string] : last
307
+
308
+ util [outline] :
309
+ object_source [alias] : outline.src_data
310
+ entity_path [string] : /entity/
311
+ separator_char [string] : /
312
+ data [string] :
313
+ EXAMPLES
314
+ }
315
+ end
316
+
253
317
  end
254
318
  end
255
319
  end