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.
- checksums.yaml +4 -4
- data/CLAUDE.md +9 -3
- data/README.md +38 -7
- data/docs/application.md +164 -0
- data/docs/getting_started.md +112 -0
- data/docs/iterators.md +294 -0
- data/docs/language_objects.md +190 -0
- data/docs/language_scripting.md +62 -0
- data/docs/language_syntax.md +307 -0
- data/docs/objects.md +77 -0
- data/docs/operators.md +62 -0
- data/docs/plugins.md +54 -0
- data/docs/verbs.md +64 -0
- data/gloo.gemspec +5 -3
- data/lib/VERSION +1 -1
- data/lib/VERSION_NOTES +14 -0
- data/lib/gloo/app/platform.rb +29 -2
- data/lib/gloo/app/settings.rb +1 -1
- data/lib/gloo/core/gloo_system.rb +52 -1
- data/lib/gloo/docs/doc_data.rb +160 -0
- data/lib/gloo/docs/help_shell.rb +285 -0
- data/lib/gloo/docs/markdown_renderer.rb +39 -0
- data/lib/gloo/objs/basic/alias.rb +53 -0
- data/lib/gloo/objs/basic/boolean.rb +30 -0
- data/lib/gloo/objs/basic/container.rb +38 -0
- data/lib/gloo/objs/basic/decimal.rb +30 -0
- data/lib/gloo/objs/basic/integer.rb +58 -0
- data/lib/gloo/objs/basic/script.rb +31 -0
- data/lib/gloo/objs/basic/string.rb +51 -4
- data/lib/gloo/objs/basic/string_msgs.rb +20 -0
- data/lib/gloo/objs/basic/text.rb +51 -4
- data/lib/gloo/objs/basic/untyped.rb +21 -0
- data/lib/gloo/objs/ctrl/each.rb +63 -1
- data/lib/gloo/objs/ctrl/function.rb +69 -0
- data/lib/gloo/objs/ctrl/repeat.rb +41 -0
- data/lib/gloo/objs/dt/date.rb +43 -0
- data/lib/gloo/objs/dt/datetime.rb +50 -0
- data/lib/gloo/objs/dt/time.rb +43 -0
- data/lib/gloo/objs/str_utils/cipher.rb +59 -0
- data/lib/gloo/objs/str_utils/outline.rb +65 -1
- data/lib/gloo/objs/str_utils/password.rb +56 -0
- data/lib/gloo/objs/system/erb.rb +39 -0
- data/lib/gloo/objs/system/file_handle.rb +56 -0
- data/lib/gloo/objs/system/system.rb +29 -0
- data/lib/gloo/objs/web/http_get.rb +35 -0
- data/lib/gloo/objs/web/http_post.rb +33 -0
- data/lib/gloo/objs/web/json.rb +40 -0
- data/lib/gloo/objs/web/uri.rb +40 -0
- data/lib/gloo/shell/command_node.rb +39 -0
- data/lib/gloo/shell/context.rb +93 -0
- data/lib/gloo/shell/runner.rb +315 -0
- data/lib/gloo/verbs/break.rb +32 -0
- data/lib/gloo/verbs/check.rb +49 -0
- data/lib/gloo/verbs/cls.rb +18 -0
- data/lib/gloo/verbs/context.rb +47 -0
- data/lib/gloo/verbs/create.rb +42 -0
- data/lib/gloo/verbs/eval.rb +27 -0
- data/lib/gloo/verbs/execute.rb +27 -0
- data/lib/gloo/verbs/exists.rb +54 -2
- data/lib/gloo/verbs/files.rb +22 -0
- data/lib/gloo/verbs/help.rb +43 -178
- data/lib/gloo/verbs/if.rb +52 -0
- data/lib/gloo/verbs/invoke.rb +62 -0
- data/lib/gloo/verbs/list.rb +32 -0
- data/lib/gloo/verbs/load.rb +55 -2
- data/lib/gloo/verbs/log.rb +44 -0
- data/lib/gloo/verbs/move.rb +36 -1
- data/lib/gloo/verbs/put.rb +35 -0
- data/lib/gloo/verbs/quit.rb +19 -0
- data/lib/gloo/verbs/redirect.rb +52 -2
- data/lib/gloo/verbs/reload.rb +27 -0
- data/lib/gloo/verbs/run.rb +39 -0
- data/lib/gloo/verbs/save.rb +26 -0
- data/lib/gloo/verbs/show.rb +54 -0
- data/lib/gloo/verbs/tell.rb +32 -0
- data/lib/gloo/verbs/throw.rb +29 -0
- data/lib/gloo/verbs/unless.rb +50 -0
- data/lib/gloo/verbs/unload.rb +23 -0
- data/lib/gloo/verbs/version.rb +37 -3
- data/lib/gloo/verbs/wait.rb +26 -0
- metadata +28 -20
data/lib/gloo/verbs/files.rb
CHANGED
|
@@ -43,6 +43,28 @@ module Gloo
|
|
|
43
43
|
|
|
44
44
|
private
|
|
45
45
|
|
|
46
|
+
# ---------------------------------------------------------------------
|
|
47
|
+
# Verb Documentation
|
|
48
|
+
# ---------------------------------------------------------------------
|
|
49
|
+
|
|
50
|
+
#
|
|
51
|
+
# Get the verb's documentation data.
|
|
52
|
+
#
|
|
53
|
+
def self.doc_data
|
|
54
|
+
{
|
|
55
|
+
:name => KEYWORD,
|
|
56
|
+
:shortcut => KEYWORD_SHORT,
|
|
57
|
+
:description => 'Show a list of all loaded files and their ' \
|
|
58
|
+
'associated objects.',
|
|
59
|
+
:syntax => [ 'files' ],
|
|
60
|
+
:result => 'The list of files and associated objects is shown ' \
|
|
61
|
+
'in output. It is set to the number of files that have been loaded.',
|
|
62
|
+
:examples => <<~EXAMPLES.strip
|
|
63
|
+
> files
|
|
64
|
+
EXAMPLES
|
|
65
|
+
}
|
|
66
|
+
end
|
|
67
|
+
|
|
46
68
|
end
|
|
47
69
|
end
|
|
48
70
|
end
|
data/lib/gloo/verbs/help.rb
CHANGED
|
@@ -10,41 +10,18 @@ module Gloo
|
|
|
10
10
|
|
|
11
11
|
KEYWORD = 'help'.freeze
|
|
12
12
|
KEYWORD_SHORT = '?'.freeze
|
|
13
|
-
DEFAULT_HELP = 'default_help'.freeze
|
|
14
|
-
HELP_NOT_FOUND_ERR = 'Help command could not be found:'.freeze
|
|
15
13
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
verb: 'show_verbs',
|
|
20
|
-
verbs: 'show_verbs',
|
|
21
|
-
v: 'show_verbs',
|
|
22
|
-
o: 'show_objs',
|
|
23
|
-
obj: 'show_objs',
|
|
24
|
-
object: 'show_objs',
|
|
25
|
-
objects: 'show_objs',
|
|
26
|
-
e: 'show_ext',
|
|
27
|
-
ext: 'show_ext',
|
|
28
|
-
l: 'show_lib',
|
|
29
|
-
lib: 'show_lib',
|
|
30
|
-
library: 'show_lib',
|
|
31
|
-
libraries: 'show_lib',
|
|
32
|
-
extension: 'show_ext',
|
|
33
|
-
extensions: 'show_ext'
|
|
34
|
-
}.freeze
|
|
14
|
+
BANNER = "Entering the gloo help shell. Type 'quit' to exit.\n" \
|
|
15
|
+
"Try: verbs, objects, settings, extensions, libraries, docs, " \
|
|
16
|
+
"verb {name}, object {name}, doc {name}, library {name}, extension {name}\n".freeze
|
|
35
17
|
|
|
36
18
|
#
|
|
37
19
|
# Run the verb.
|
|
20
|
+
# Takes no arguments - always enters the interactive help shell.
|
|
38
21
|
#
|
|
39
22
|
def run
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
if opts
|
|
44
|
-
dispatch opts
|
|
45
|
-
else
|
|
46
|
-
show_default_help
|
|
47
|
-
end
|
|
23
|
+
@engine.log.show BANNER
|
|
24
|
+
build_shell.start
|
|
48
25
|
end
|
|
49
26
|
|
|
50
27
|
#
|
|
@@ -62,166 +39,54 @@ module Gloo
|
|
|
62
39
|
end
|
|
63
40
|
|
|
64
41
|
# ---------------------------------------------------------------------
|
|
65
|
-
#
|
|
42
|
+
# Verb Documentation
|
|
66
43
|
# ---------------------------------------------------------------------
|
|
67
44
|
|
|
68
|
-
private
|
|
69
|
-
|
|
70
|
-
#
|
|
71
|
-
# Write output to it and show it unless we are in
|
|
72
|
-
# silent mode.
|
|
73
|
-
#
|
|
74
|
-
def show_output( out )
|
|
75
|
-
@engine.heap.it.set_to out
|
|
76
|
-
puts out unless @engine.args.quiet?
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
#
|
|
80
|
-
# Show application settings.
|
|
81
|
-
#
|
|
82
|
-
def show_settings
|
|
83
|
-
@engine.settings.show
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
#
|
|
87
|
-
# Show default help.
|
|
88
|
-
# No parameters were given.
|
|
89
|
-
#
|
|
90
|
-
def show_default_help
|
|
91
|
-
data = "\n"
|
|
92
|
-
data << " Help Options:\n"
|
|
93
|
-
data << " ? objects (obj, o) \n"
|
|
94
|
-
data << " ? verbs (v) \n"
|
|
95
|
-
data << " ? ext (e) \n"
|
|
96
|
-
data << " ? lib (l) \n"
|
|
97
|
-
data << " ? settings (s) \n"
|
|
98
|
-
data << "\n For detailed documentation use the gloo website. \n"
|
|
99
|
-
data << "\n https://gloo.ecrane.us/doc/. \n\n"
|
|
100
|
-
@engine.log.show data
|
|
101
|
-
end
|
|
102
|
-
|
|
103
|
-
#
|
|
104
|
-
# Dispatch the help to the right place.
|
|
105
|
-
#
|
|
106
|
-
def dispatch( opts )
|
|
107
|
-
@engine.log.debug 'looking for help topic'
|
|
108
|
-
cmd = DISPATCH[ opts.to_sym ]
|
|
109
|
-
if cmd
|
|
110
|
-
@engine.log.debug 'found help command'
|
|
111
|
-
send cmd
|
|
112
|
-
else
|
|
113
|
-
report_help_error opts
|
|
114
|
-
end
|
|
115
|
-
end
|
|
116
|
-
|
|
117
|
-
#
|
|
118
|
-
# Report an error with the inline help.
|
|
119
|
-
#
|
|
120
|
-
def report_help_error( opts )
|
|
121
|
-
@engine.err "#{HELP_NOT_FOUND_ERR} '#{opts}'"
|
|
122
|
-
end
|
|
123
|
-
|
|
124
|
-
#
|
|
125
|
-
# List the verbs
|
|
126
|
-
#
|
|
127
|
-
def show_verbs
|
|
128
|
-
data = "\n"
|
|
129
|
-
data << " Verbs (shortcut, name)\n".blue
|
|
130
|
-
data << "#{get_verbs}\n\n"
|
|
131
|
-
@engine.log.show data
|
|
132
|
-
end
|
|
133
|
-
|
|
134
|
-
#
|
|
135
|
-
# List the object types
|
|
136
45
|
#
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
46
|
+
# Get the verb's documentation data.
|
|
47
|
+
#
|
|
48
|
+
def self.doc_data
|
|
49
|
+
{
|
|
50
|
+
:name => KEYWORD,
|
|
51
|
+
:shortcut => KEYWORD_SHORT,
|
|
52
|
+
:description => 'Enter the interactive help shell. From there, ' \
|
|
53
|
+
'look up verbs, object types, settings, extensions, libraries, ' \
|
|
54
|
+
'and narrative doc pages, or get detailed help for a specific ' \
|
|
55
|
+
'verb, object, doc page, loaded library, or loaded extension.',
|
|
56
|
+
:syntax => [ 'help' ],
|
|
57
|
+
:result => "Enters the help shell, prompt \"help> \". Commands: " \
|
|
58
|
+
'verbs, objects, settings, extensions, libraries, docs (lists), ' \
|
|
59
|
+
'verb {name}, object {name}, doc {name}, library {name}, ' \
|
|
60
|
+
'extension {name} (detail for one, tab-completable — library ' \
|
|
61
|
+
'{name} / extension {name} show the README for a loaded core ' \
|
|
62
|
+
"library / user extension). Type 'quit' to leave the shell.",
|
|
63
|
+
:examples => <<~EXAMPLES.strip
|
|
64
|
+
> help
|
|
65
|
+
help> verbs
|
|
66
|
+
help> verb put
|
|
67
|
+
help> object container
|
|
68
|
+
help> docs
|
|
69
|
+
help> doc getting_started
|
|
70
|
+
help> library db
|
|
71
|
+
help> extension alert
|
|
72
|
+
help> quit
|
|
73
|
+
EXAMPLES
|
|
74
|
+
}
|
|
142
75
|
end
|
|
143
76
|
|
|
144
|
-
#
|
|
145
|
-
#
|
|
146
|
-
#
|
|
147
|
-
def get_verbs
|
|
148
|
-
str = ''
|
|
149
|
-
verbs = @engine.dictionary.get_verbs.sort_by( &:keyword )
|
|
150
|
-
verbs.each_with_index do |v, i|
|
|
151
|
-
cut = v.keyword_shortcut.ljust( 5, ' ' ).yellow
|
|
152
|
-
name = v.keyword.ljust( 20, ' ' ).white
|
|
153
|
-
str << " #{cut} #{name} \n"
|
|
154
|
-
end
|
|
155
|
-
|
|
156
|
-
return str
|
|
157
|
-
end
|
|
158
|
-
|
|
159
|
-
#
|
|
160
|
-
# Get the text for the list of objects.
|
|
161
|
-
#
|
|
162
|
-
def get_objects
|
|
163
|
-
str = ''
|
|
164
|
-
objs = @engine.dictionary.get_obj_types.sort_by( &:typename )
|
|
165
|
-
objs.each_with_index do |o, i|
|
|
166
|
-
if o.short_typename != o.typename
|
|
167
|
-
short = "(#{o.short_typename})".yellow
|
|
168
|
-
name = "#{o.typename.white} #{short}"
|
|
169
|
-
else
|
|
170
|
-
name = o.typename.white
|
|
171
|
-
end
|
|
172
|
-
str << " #{name.ljust( 30, ' ' )}\n"
|
|
173
|
-
end
|
|
174
|
-
|
|
175
|
-
return str
|
|
176
|
-
end
|
|
177
|
-
|
|
178
|
-
#
|
|
179
|
-
# List the extensions
|
|
180
|
-
#
|
|
181
|
-
def show_ext
|
|
182
|
-
data = "\n"
|
|
183
|
-
data << " Extensions\n".blue
|
|
184
|
-
data << "#{get_extensions}\n\n"
|
|
185
|
-
@engine.log.show data
|
|
186
|
-
end
|
|
187
|
-
|
|
188
|
-
#
|
|
189
|
-
# Get the text for the list of extensions.
|
|
190
|
-
#
|
|
191
|
-
def get_extensions
|
|
192
|
-
str = ''
|
|
193
|
-
exts = @engine.ext_manager.loaded_extensions.sort
|
|
194
|
-
exts.each do |name, ext|
|
|
195
|
-
str << " #{name.white} \n"
|
|
196
|
-
end
|
|
197
|
-
|
|
198
|
-
return str
|
|
199
|
-
end
|
|
77
|
+
# ---------------------------------------------------------------------
|
|
78
|
+
# Private functions
|
|
79
|
+
# ---------------------------------------------------------------------
|
|
200
80
|
|
|
201
|
-
|
|
202
|
-
# List the libraries
|
|
203
|
-
#
|
|
204
|
-
def show_lib
|
|
205
|
-
data = "\n"
|
|
206
|
-
data << " Libraries\n".blue
|
|
207
|
-
data << "#{get_libraries}\n\n"
|
|
208
|
-
@engine.log.show data
|
|
209
|
-
end
|
|
81
|
+
private
|
|
210
82
|
|
|
211
83
|
#
|
|
212
|
-
#
|
|
84
|
+
# Build the help shell for this run.
|
|
213
85
|
#
|
|
214
|
-
def
|
|
215
|
-
|
|
216
|
-
libs = @engine.lib_manager.loaded_libraries.sort
|
|
217
|
-
libs.each do |name, lib|
|
|
218
|
-
str << " #{name.white} \n"
|
|
219
|
-
end
|
|
220
|
-
|
|
221
|
-
return str
|
|
86
|
+
def build_shell
|
|
87
|
+
return Gloo::Docs::HelpShell.new( @engine )
|
|
222
88
|
end
|
|
223
89
|
|
|
224
|
-
|
|
225
90
|
end
|
|
226
91
|
end
|
|
227
92
|
end
|
data/lib/gloo/verbs/if.rb
CHANGED
|
@@ -101,6 +101,58 @@ module Gloo
|
|
|
101
101
|
|
|
102
102
|
i.run
|
|
103
103
|
end
|
|
104
|
+
|
|
105
|
+
# ---------------------------------------------------------------------
|
|
106
|
+
# Verb Documentation
|
|
107
|
+
# ---------------------------------------------------------------------
|
|
108
|
+
|
|
109
|
+
#
|
|
110
|
+
# Get the verb's documentation data.
|
|
111
|
+
#
|
|
112
|
+
def self.doc_data
|
|
113
|
+
{
|
|
114
|
+
:name => KEYWORD,
|
|
115
|
+
:shortcut => KEYWORD_SHORT,
|
|
116
|
+
:description => 'If an expression is true then do something.',
|
|
117
|
+
:syntax => [
|
|
118
|
+
'if {true} then {do}',
|
|
119
|
+
'if {true} then {do} else {do else}'
|
|
120
|
+
],
|
|
121
|
+
:parameters => [
|
|
122
|
+
'{true} — Does the expression evaluate to true?',
|
|
123
|
+
'{do} — Execute command if the expression is true.',
|
|
124
|
+
'{do else} — The else command is optional. Execute command if the expression is false.'
|
|
125
|
+
],
|
|
126
|
+
:result => 'Unchanged if the expression is not true. If true, ' \
|
|
127
|
+
'then the result will be based on the command specified ' \
|
|
128
|
+
'after the then keyword.',
|
|
129
|
+
:errors => [
|
|
130
|
+
"#{MISSING_EXPR_ERR} — No expression is provided as parameter to the verb.",
|
|
131
|
+
'Other errors depend on the command that is run.'
|
|
132
|
+
],
|
|
133
|
+
:examples => <<~EXAMPLES.strip
|
|
134
|
+
#
|
|
135
|
+
# If statement example
|
|
136
|
+
#
|
|
137
|
+
|
|
138
|
+
if [container] :
|
|
139
|
+
|
|
140
|
+
x [bool] : false
|
|
141
|
+
true_msg [string] : It is true!
|
|
142
|
+
|
|
143
|
+
on_load [script] :
|
|
144
|
+
if if.x then show "first time: " + if.true_msg
|
|
145
|
+
if ^.x then show 'T' else show 'F'
|
|
146
|
+
|
|
147
|
+
put true into if.x
|
|
148
|
+
if if.x \\
|
|
149
|
+
then show "second time: " + if.true_msg
|
|
150
|
+
if ^.x \\
|
|
151
|
+
then show 'T' \\
|
|
152
|
+
else show 'F'
|
|
153
|
+
EXAMPLES
|
|
154
|
+
}
|
|
155
|
+
end
|
|
104
156
|
end
|
|
105
157
|
end
|
|
106
158
|
end
|
data/lib/gloo/verbs/invoke.rb
CHANGED
|
@@ -75,6 +75,68 @@ module Gloo
|
|
|
75
75
|
return evaluated_params
|
|
76
76
|
end
|
|
77
77
|
|
|
78
|
+
# ---------------------------------------------------------------------
|
|
79
|
+
# Verb Documentation
|
|
80
|
+
# ---------------------------------------------------------------------
|
|
81
|
+
|
|
82
|
+
#
|
|
83
|
+
# Get the verb's documentation data.
|
|
84
|
+
#
|
|
85
|
+
def self.doc_data
|
|
86
|
+
{
|
|
87
|
+
:name => KEYWORD,
|
|
88
|
+
:shortcut => KEYWORD_SHORT,
|
|
89
|
+
:description => 'Invoke a function. Set it to the result of the function.',
|
|
90
|
+
:syntax => [ 'invoke {path.to.function} {params}' ],
|
|
91
|
+
:parameters => [
|
|
92
|
+
'{path.to.function} — The function we want to invoke.',
|
|
93
|
+
'{params} — The list of parameters to the function.'
|
|
94
|
+
],
|
|
95
|
+
:result => 'The result of the function is put into it.',
|
|
96
|
+
:examples => <<~EXAMPLES.strip
|
|
97
|
+
#
|
|
98
|
+
# Function examples
|
|
99
|
+
#
|
|
100
|
+
|
|
101
|
+
functions [can] :
|
|
102
|
+
|
|
103
|
+
name [string] : Jasper
|
|
104
|
+
|
|
105
|
+
on_load [script] :
|
|
106
|
+
show 'running function examples' (white)
|
|
107
|
+
|
|
108
|
+
invoke functions.greet ^.name
|
|
109
|
+
show it
|
|
110
|
+
|
|
111
|
+
invoke functions.add 3 4
|
|
112
|
+
show it
|
|
113
|
+
|
|
114
|
+
show 'done' (white)
|
|
115
|
+
|
|
116
|
+
#
|
|
117
|
+
# Say hi to person (name)
|
|
118
|
+
#
|
|
119
|
+
greet [ƒ] :
|
|
120
|
+
on_invoke [script] :
|
|
121
|
+
put 'Hi, ' + ^.params.name into ^.result
|
|
122
|
+
params [container] :
|
|
123
|
+
name [string] : none
|
|
124
|
+
result [string] :
|
|
125
|
+
|
|
126
|
+
#
|
|
127
|
+
# Add 2 numbers
|
|
128
|
+
#
|
|
129
|
+
add [ƒ] :
|
|
130
|
+
on_invoke [script] :
|
|
131
|
+
put ^.params.x and ^.params.y into ^.result
|
|
132
|
+
params [container] :
|
|
133
|
+
x [int] :
|
|
134
|
+
y [int] :
|
|
135
|
+
result [string] :
|
|
136
|
+
EXAMPLES
|
|
137
|
+
}
|
|
138
|
+
end
|
|
139
|
+
|
|
78
140
|
end
|
|
79
141
|
end
|
|
80
142
|
end
|
data/lib/gloo/verbs/list.rb
CHANGED
|
@@ -114,6 +114,38 @@ module Gloo
|
|
|
114
114
|
return ' '
|
|
115
115
|
end
|
|
116
116
|
|
|
117
|
+
# ---------------------------------------------------------------------
|
|
118
|
+
# Verb Documentation
|
|
119
|
+
# ---------------------------------------------------------------------
|
|
120
|
+
|
|
121
|
+
#
|
|
122
|
+
# Get the verb's documentation data.
|
|
123
|
+
#
|
|
124
|
+
def self.doc_data
|
|
125
|
+
{
|
|
126
|
+
:name => KEYWORD,
|
|
127
|
+
:shortcut => KEYWORD_SHORT,
|
|
128
|
+
:description => 'List out objects (and children) at the ' \
|
|
129
|
+
'current context. When a path is provided, it will be ' \
|
|
130
|
+
'listed instead of the current context. When using context, ' \
|
|
131
|
+
'the current context will be shown, but when context has ' \
|
|
132
|
+
'not been set, the root will be shown.',
|
|
133
|
+
:syntax => [ 'list {path.to.object}' ],
|
|
134
|
+
:parameters => [
|
|
135
|
+
'{path.to.object} — Optional path to object that will be listed. When no path is provided, the current context is used.'
|
|
136
|
+
],
|
|
137
|
+
:result => 'Object and children are listed out in the CLI.',
|
|
138
|
+
:errors => [
|
|
139
|
+
"#{TARGET_MISSING_ERR}{path.to.object} — The object specified that is to be listed could not be found."
|
|
140
|
+
],
|
|
141
|
+
:examples => <<~EXAMPLES.strip
|
|
142
|
+
> list
|
|
143
|
+
> list my.container
|
|
144
|
+
> list root
|
|
145
|
+
EXAMPLES
|
|
146
|
+
}
|
|
147
|
+
end
|
|
148
|
+
|
|
117
149
|
end
|
|
118
150
|
end
|
|
119
151
|
end
|
data/lib/gloo/verbs/load.rb
CHANGED
|
@@ -77,13 +77,66 @@ module Gloo
|
|
|
77
77
|
@engine.ext_manager.load_ext name
|
|
78
78
|
end
|
|
79
79
|
|
|
80
|
-
#
|
|
80
|
+
#
|
|
81
81
|
# Load a library
|
|
82
|
-
#
|
|
82
|
+
#
|
|
83
83
|
def load_library( name )
|
|
84
84
|
@engine.log.debug "Getting ready to load library: #{name}"
|
|
85
85
|
@engine.lib_manager.load_lib name
|
|
86
86
|
end
|
|
87
|
+
|
|
88
|
+
# ---------------------------------------------------------------------
|
|
89
|
+
# Verb Documentation
|
|
90
|
+
# ---------------------------------------------------------------------
|
|
91
|
+
|
|
92
|
+
#
|
|
93
|
+
# Get the verb's documentation data.
|
|
94
|
+
#
|
|
95
|
+
def self.doc_data
|
|
96
|
+
{
|
|
97
|
+
:name => KEYWORD,
|
|
98
|
+
:shortcut => KEYWORD_SHORT,
|
|
99
|
+
:description => 'Load an object file. There are two ways to ' \
|
|
100
|
+
'specify the file. Give either the full path and file name ' \
|
|
101
|
+
'or use a relative path from the gloo project folder. For ' \
|
|
102
|
+
'the latter, the extension is not needed. For the former, ' \
|
|
103
|
+
'the file extension is necessary. Using * instead of a file ' \
|
|
104
|
+
'name will load all gloo files in the folder. When using the ' \
|
|
105
|
+
'--app option, the file is loaded from the application ' \
|
|
106
|
+
'folder, but if not found there, the loader will also look ' \
|
|
107
|
+
'in the gloo root folder. The load verb is also used to ' \
|
|
108
|
+
'import an extension or library at runtime.',
|
|
109
|
+
:syntax => [
|
|
110
|
+
'load {file_name}',
|
|
111
|
+
'load ext {my_ext}',
|
|
112
|
+
'load lib {lib_name}'
|
|
113
|
+
],
|
|
114
|
+
:parameters => [
|
|
115
|
+
'{file_name} — Name of the object file that is to be loaded.',
|
|
116
|
+
'reference type — By default, the type is file. File can be ' \
|
|
117
|
+
'specified, but does not need to be. Use ext to load a ' \
|
|
118
|
+
'User Extension. Use lib to load a Core Library.'
|
|
119
|
+
],
|
|
120
|
+
:result => 'Objects are loaded into the heap. on_load scripts ' \
|
|
121
|
+
'are run within the loaded objects.',
|
|
122
|
+
:errors => [
|
|
123
|
+
"#{MISSING_EXPR_ERR} — No expression is provided as parameter to the verb.",
|
|
124
|
+
"#{UNKNOWN_OPT_ERR} — The reference type given isn't file, ext, or lib.",
|
|
125
|
+
"#{WRONG_NUM_ARGS_ERR} — load expects 2 or 3 arguments (the verb, an optional reference type, and the file/ext/lib name)."
|
|
126
|
+
],
|
|
127
|
+
:examples => <<~EXAMPLES.strip
|
|
128
|
+
> load my/project/file
|
|
129
|
+
> load my/app/*
|
|
130
|
+
> load ~/.my_app/settings.gloo
|
|
131
|
+
|
|
132
|
+
# Load a User Extension
|
|
133
|
+
> load ext my_ext
|
|
134
|
+
|
|
135
|
+
# Load a Core Library
|
|
136
|
+
> load lib db
|
|
137
|
+
EXAMPLES
|
|
138
|
+
}
|
|
139
|
+
end
|
|
87
140
|
end
|
|
88
141
|
end
|
|
89
142
|
end
|
data/lib/gloo/verbs/log.rb
CHANGED
|
@@ -85,6 +85,50 @@ module Gloo
|
|
|
85
85
|
return Gloo::App::Log::LEVELS[0]
|
|
86
86
|
end
|
|
87
87
|
|
|
88
|
+
# ---------------------------------------------------------------------
|
|
89
|
+
# Verb Documentation
|
|
90
|
+
# ---------------------------------------------------------------------
|
|
91
|
+
|
|
92
|
+
#
|
|
93
|
+
# Get the verb's documentation data.
|
|
94
|
+
#
|
|
95
|
+
def self.doc_data
|
|
96
|
+
{
|
|
97
|
+
:name => KEYWORD,
|
|
98
|
+
:shortcut => KEYWORD_SHORT,
|
|
99
|
+
:description => 'Write to the standard gloo log, or to the gloo error log.',
|
|
100
|
+
:syntax => [ 'log {target} ({level})' ],
|
|
101
|
+
:parameters => [
|
|
102
|
+
'{target} — The message that will be written to the log. ' \
|
|
103
|
+
'The target might be the path to an object, a literal or ' \
|
|
104
|
+
'an expression to be evaluated. Level options are: DEBUG, ' \
|
|
105
|
+
'INFO, WARN, ERROR. Level is an optional parameter — if ' \
|
|
106
|
+
'not specified, the message is written as DEBUG level.'
|
|
107
|
+
],
|
|
108
|
+
:result => 'The message is written to the log at the ' \
|
|
109
|
+
'specified level. It will contain the log message.',
|
|
110
|
+
:notes => "Use `log clear` from the CLI to clear out both the " \
|
|
111
|
+
"standard log and the error log.\n\n" \
|
|
112
|
+
"> log clear",
|
|
113
|
+
:examples => <<~EXAMPLES.strip
|
|
114
|
+
#
|
|
115
|
+
# Show multiple messages in loggers
|
|
116
|
+
#
|
|
117
|
+
|
|
118
|
+
log [can] :
|
|
119
|
+
level [string] : info
|
|
120
|
+
msg [string] : info from var
|
|
121
|
+
on_load [script] :
|
|
122
|
+
log "debug implicit"
|
|
123
|
+
log "debug explicit" (debug)
|
|
124
|
+
log "info" (info)
|
|
125
|
+
log "warn" (warn)
|
|
126
|
+
log "error" (error)
|
|
127
|
+
log log.msg (log.level)
|
|
128
|
+
EXAMPLES
|
|
129
|
+
}
|
|
130
|
+
end
|
|
131
|
+
|
|
88
132
|
end
|
|
89
133
|
end
|
|
90
134
|
end
|
data/lib/gloo/verbs/move.rb
CHANGED
|
@@ -13,7 +13,7 @@ module Gloo
|
|
|
13
13
|
TO = 'to'.freeze
|
|
14
14
|
MISSING_SRC_ERR = 'Object to move was not specified!'.freeze
|
|
15
15
|
MISSING_SRC_OBJ_ERR = 'Could not find object to move: '.freeze
|
|
16
|
-
MISSING_DST_ERR = "Move' must include 'to' parent object!".freeze
|
|
16
|
+
MISSING_DST_ERR = "'Move' must include 'to' parent object!".freeze
|
|
17
17
|
MISSING_DST_OBJ_ERR = 'Could not resolve target: '.freeze
|
|
18
18
|
|
|
19
19
|
#
|
|
@@ -84,6 +84,41 @@ module Gloo
|
|
|
84
84
|
return o
|
|
85
85
|
end
|
|
86
86
|
|
|
87
|
+
# ---------------------------------------------------------------------
|
|
88
|
+
# Verb Documentation
|
|
89
|
+
# ---------------------------------------------------------------------
|
|
90
|
+
|
|
91
|
+
#
|
|
92
|
+
# Get the verb's documentation data.
|
|
93
|
+
#
|
|
94
|
+
def self.doc_data
|
|
95
|
+
{
|
|
96
|
+
:name => KEYWORD,
|
|
97
|
+
:shortcut => KEYWORD_SHORT,
|
|
98
|
+
:description => 'Move an object to a new parent.',
|
|
99
|
+
:syntax => [ 'move {path.to.object} to {new.parent}' ],
|
|
100
|
+
:parameters => [
|
|
101
|
+
'{path.to.object} — The object that we want to move.',
|
|
102
|
+
'{new.parent} — The new location for the object.'
|
|
103
|
+
],
|
|
104
|
+
:result => 'The object will now be in the new location.',
|
|
105
|
+
:errors => [
|
|
106
|
+
"#{MISSING_SRC_ERR} The {path.to.object} is not specified.",
|
|
107
|
+
"#{MISSING_SRC_OBJ_ERR}{path.to.object} — The {path.to.object} cannot be resolved.",
|
|
108
|
+
"#{MISSING_DST_ERR} The {new.parent} is not specified.",
|
|
109
|
+
"#{MISSING_DST_OBJ_ERR}{new.parent} — The {new.parent} cannot be resolved."
|
|
110
|
+
],
|
|
111
|
+
:examples => <<~EXAMPLES.strip
|
|
112
|
+
can [can] :
|
|
113
|
+
two [string] : def
|
|
114
|
+
data [can] :
|
|
115
|
+
one [string] : abc
|
|
116
|
+
on_load [script] :
|
|
117
|
+
move can.two to can.data
|
|
118
|
+
EXAMPLES
|
|
119
|
+
}
|
|
120
|
+
end
|
|
121
|
+
|
|
87
122
|
end
|
|
88
123
|
end
|
|
89
124
|
end
|
data/lib/gloo/verbs/put.rb
CHANGED
|
@@ -89,6 +89,41 @@ module Gloo
|
|
|
89
89
|
end
|
|
90
90
|
end
|
|
91
91
|
|
|
92
|
+
# ---------------------------------------------------------------------
|
|
93
|
+
# Verb Documentation
|
|
94
|
+
# ---------------------------------------------------------------------
|
|
95
|
+
|
|
96
|
+
#
|
|
97
|
+
# Get the verb's documentation data.
|
|
98
|
+
#
|
|
99
|
+
def self.doc_data
|
|
100
|
+
{
|
|
101
|
+
:name => KEYWORD,
|
|
102
|
+
:shortcut => KEYWORD_SHORT,
|
|
103
|
+
:description => 'Put a value into an object. ' \
|
|
104
|
+
'The value is the result of an expression.',
|
|
105
|
+
:syntax => [ 'put {expression} into {dst.path}' ],
|
|
106
|
+
:parameters => [
|
|
107
|
+
'{expression} — The expression that is evaluated.',
|
|
108
|
+
'{dst.path} — The path to the destination object.'
|
|
109
|
+
],
|
|
110
|
+
:result => 'The destination object has the result of the ' \
|
|
111
|
+
'evaluated expression. It will also be set into it.',
|
|
112
|
+
:errors => [
|
|
113
|
+
"#{MISSING_EXPR_ERR} — The into keyword is missing, or no source expression is provided.",
|
|
114
|
+
"#{INTO_MISSING_ERR} — The destination is not specified.",
|
|
115
|
+
"#{TARGET_ERR}{dst.path} — The destination of the put cannot be resolved."
|
|
116
|
+
],
|
|
117
|
+
:examples => <<~EXAMPLES.strip
|
|
118
|
+
> put 'one' into str
|
|
119
|
+
> put "two" into str
|
|
120
|
+
> put 123 into x
|
|
121
|
+
> put 3 + 5 into x
|
|
122
|
+
> put TRUE into flag
|
|
123
|
+
EXAMPLES
|
|
124
|
+
}
|
|
125
|
+
end
|
|
126
|
+
|
|
92
127
|
end
|
|
93
128
|
end
|
|
94
129
|
end
|
data/lib/gloo/verbs/quit.rb
CHANGED
|
@@ -35,6 +35,25 @@ module Gloo
|
|
|
35
35
|
return KEYWORD_SHORT
|
|
36
36
|
end
|
|
37
37
|
|
|
38
|
+
# ---------------------------------------------------------------------
|
|
39
|
+
# Verb Documentation
|
|
40
|
+
# ---------------------------------------------------------------------
|
|
41
|
+
|
|
42
|
+
#
|
|
43
|
+
# Get the verb's documentation data.
|
|
44
|
+
#
|
|
45
|
+
def self.doc_data
|
|
46
|
+
{
|
|
47
|
+
:name => KEYWORD,
|
|
48
|
+
:shortcut => KEYWORD_SHORT,
|
|
49
|
+
:description => 'Stop running the gloo application. Cleanup and shutdown.',
|
|
50
|
+
:syntax => [ 'quit' ],
|
|
51
|
+
:examples => <<~EXAMPLES.strip
|
|
52
|
+
> quit
|
|
53
|
+
EXAMPLES
|
|
54
|
+
}
|
|
55
|
+
end
|
|
56
|
+
|
|
38
57
|
end
|
|
39
58
|
end
|
|
40
59
|
end
|