gloo 0.5.4 → 0.7.2
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/.gitignore +1 -0
- data/Gemfile.lock +1 -1
- data/lib/gloo/app/args.rb +48 -6
- data/lib/gloo/app/engine.rb +60 -38
- data/lib/gloo/app/help.rb +137 -16
- data/lib/gloo/app/info.rb +3 -1
- data/lib/gloo/app/log.rb +23 -0
- data/lib/gloo/app/mode.rb +2 -0
- data/lib/gloo/app/settings.rb +98 -47
- data/lib/gloo/convert/converter.rb +35 -0
- data/lib/gloo/convert/string_to_datetime.rb +1 -1
- data/lib/gloo/convert/string_to_decimal.rb +1 -1
- data/lib/gloo/convert/string_to_integer.rb +1 -1
- data/lib/gloo/core/dictionary.rb +99 -22
- data/lib/gloo/core/error.rb +19 -8
- data/lib/gloo/core/event_manager.rb +4 -0
- data/lib/gloo/core/factory.rb +11 -0
- data/lib/gloo/core/gloo_system.rb +1 -1
- data/lib/gloo/core/heap.rb +11 -3
- data/lib/gloo/core/here.rb +36 -0
- data/lib/gloo/core/it.rb +6 -0
- data/lib/gloo/core/literal.rb +5 -0
- data/lib/gloo/core/obj.rb +22 -0
- data/lib/gloo/core/op.rb +7 -0
- data/lib/gloo/core/parser.rb +6 -0
- data/lib/gloo/core/pn.rb +38 -0
- data/lib/gloo/core/tokens.rb +66 -22
- data/lib/gloo/core/verb.rb +12 -0
- data/lib/gloo/exec/action.rb +48 -0
- data/lib/gloo/exec/dispatch.rb +15 -5
- data/lib/gloo/exec/exec_env.rb +74 -0
- data/lib/gloo/exec/runner.rb +4 -2
- data/lib/gloo/{core → exec}/script.rb +21 -9
- data/lib/gloo/exec/stack.rb +78 -0
- data/lib/gloo/expr/expression.rb +26 -4
- data/lib/gloo/expr/l_boolean.rb +6 -0
- data/lib/gloo/expr/l_decimal.rb +5 -0
- data/lib/gloo/expr/l_integer.rb +7 -0
- data/lib/gloo/expr/l_string.rb +7 -0
- data/lib/gloo/expr/op_div.rb +2 -0
- data/lib/gloo/expr/op_minus.rb +2 -0
- data/lib/gloo/expr/op_mult.rb +2 -0
- data/lib/gloo/expr/op_plus.rb +2 -0
- data/lib/gloo/help/app/application.txt +22 -0
- data/lib/gloo/help/app/configuration.txt +7 -0
- data/lib/gloo/help/app/default_help.txt +14 -0
- data/lib/gloo/help/app/logging.txt +16 -0
- data/lib/gloo/help/core/color.txt +31 -0
- data/lib/gloo/help/core/error.txt +33 -0
- data/lib/gloo/help/core/events.txt +21 -0
- data/lib/gloo/help/core/gloo_system.txt +54 -0
- data/lib/gloo/help/core/here.txt +30 -0
- data/lib/gloo/help/core/it.txt +23 -0
- data/lib/gloo/help/core/ops.txt +16 -0
- data/lib/gloo/help/core/pathname.txt +29 -0
- data/lib/gloo/help/objs/basic/alias.txt +36 -0
- data/lib/gloo/help/objs/basic/boolean.txt +28 -0
- data/lib/gloo/help/objs/basic/container.txt +33 -0
- data/lib/gloo/help/objs/basic/decimal.txt +28 -0
- data/lib/gloo/help/objs/basic/integer.txt +27 -0
- data/lib/gloo/help/objs/basic/script.txt +29 -0
- data/lib/gloo/help/objs/basic/string.txt +28 -0
- data/lib/gloo/help/objs/basic/text.txt +27 -0
- data/lib/gloo/help/objs/basic/untyped.txt +22 -0
- data/lib/gloo/help/objs/cli/banner.txt +49 -0
- data/lib/gloo/help/objs/cli/bar.txt +34 -0
- data/lib/gloo/help/objs/cli/colorize.txt +33 -0
- data/lib/gloo/help/objs/cli/confirm.txt +26 -0
- data/lib/gloo/help/objs/cli/menu.txt +44 -0
- data/lib/gloo/help/objs/cli/menu_item.txt +26 -0
- data/lib/gloo/help/objs/cli/pastel.txt +43 -0
- data/lib/gloo/help/objs/cli/prompt.txt +27 -0
- data/lib/gloo/help/objs/cli/select.txt +34 -0
- data/lib/gloo/help/objs/ctrl/each.txt +48 -0
- data/lib/gloo/help/objs/ctrl/repeat.txt +38 -0
- data/lib/gloo/help/objs/data/markdown.txt +25 -0
- data/lib/gloo/help/objs/data/table.txt +46 -0
- data/lib/gloo/help/objs/dev/git_repo.txt +35 -0
- data/lib/gloo/help/objs/dt/date.txt +23 -0
- data/lib/gloo/help/objs/dt/datetime.txt +24 -0
- data/lib/gloo/help/objs/dt/time.txt +23 -0
- data/lib/gloo/help/objs/ror/erb.txt +37 -0
- data/lib/gloo/help/objs/ror/eval.txt +24 -0
- data/lib/gloo/help/objs/snd/play.txt +23 -0
- data/lib/gloo/help/objs/snd/say.txt +28 -0
- data/lib/gloo/help/objs/system/file.txt +41 -0
- data/lib/gloo/help/objs/system/system.txt +32 -0
- data/lib/gloo/help/objs/web/http_get.txt +35 -0
- data/lib/gloo/help/objs/web/http_post.txt +32 -0
- data/lib/gloo/help/objs/web/json.txt +34 -0
- data/lib/gloo/help/objs/web/slack.txt +33 -0
- data/lib/gloo/help/objs/web/teams.txt +30 -0
- data/lib/gloo/help/objs/web/uri.txt +37 -0
- data/lib/gloo/help/verbs/alert.txt +33 -0
- data/lib/gloo/help/verbs/beep.txt +25 -0
- data/lib/gloo/help/verbs/cls.txt +24 -0
- data/lib/gloo/help/verbs/context.txt +43 -0
- data/lib/gloo/help/verbs/create.txt +33 -0
- data/lib/gloo/help/verbs/execute.txt +27 -0
- data/lib/gloo/help/verbs/help.txt +34 -0
- data/lib/gloo/help/verbs/if.txt +37 -0
- data/lib/gloo/help/verbs/list.txt +34 -0
- data/lib/gloo/help/verbs/load.txt +38 -0
- data/lib/gloo/help/verbs/move.txt +42 -0
- data/lib/gloo/help/verbs/put.txt +38 -0
- data/lib/gloo/help/verbs/quit.txt +25 -0
- data/lib/gloo/help/verbs/run.txt +41 -0
- data/lib/gloo/help/verbs/save.txt +26 -0
- data/lib/gloo/help/verbs/show.txt +30 -0
- data/lib/gloo/help/verbs/tell.txt +34 -0
- data/lib/gloo/help/verbs/unless.txt +38 -0
- data/lib/gloo/help/verbs/version.txt +32 -0
- data/lib/gloo/help/verbs/wait.txt +29 -0
- data/lib/gloo/objs/basic/alias.rb +0 -33
- data/lib/gloo/objs/basic/boolean.rb +6 -27
- data/lib/gloo/objs/basic/container.rb +0 -33
- data/lib/gloo/objs/basic/decimal.rb +8 -28
- data/lib/gloo/objs/basic/integer.rb +5 -26
- data/lib/gloo/objs/basic/script.rb +1 -27
- data/lib/gloo/objs/basic/string.rb +6 -26
- data/lib/gloo/objs/basic/text.rb +0 -25
- data/lib/gloo/objs/basic/untyped.rb +0 -26
- data/lib/gloo/objs/cli/banner.rb +0 -29
- data/lib/gloo/objs/cli/bar.rb +0 -29
- data/lib/gloo/objs/cli/colorize.rb +4 -34
- data/lib/gloo/objs/cli/confirm.rb +6 -36
- data/lib/gloo/objs/cli/menu.rb +6 -36
- data/lib/gloo/objs/cli/menu_item.rb +0 -33
- data/lib/gloo/objs/cli/pastel.rb +4 -27
- data/lib/gloo/objs/cli/prompt.rb +4 -28
- data/lib/gloo/objs/cli/select.rb +4 -31
- data/lib/gloo/objs/ctrl/each.rb +33 -33
- data/lib/gloo/objs/ctrl/repeat.rb +8 -29
- data/lib/gloo/objs/data/markdown.rb +0 -25
- data/lib/gloo/objs/data/table.rb +4 -32
- data/lib/gloo/objs/dev/git.rb +12 -30
- data/lib/gloo/objs/dt/date.rb +3 -25
- data/lib/gloo/objs/dt/datetime.rb +4 -26
- data/lib/gloo/objs/dt/time.rb +3 -25
- data/lib/gloo/objs/ror/erb.rb +11 -45
- data/lib/gloo/objs/ror/eval.rb +11 -38
- data/lib/gloo/objs/snd/play.rb +2 -25
- data/lib/gloo/objs/snd/say.rb +9 -31
- data/lib/gloo/objs/system/file_handle.rb +0 -38
- data/lib/gloo/objs/system/system.rb +16 -46
- data/lib/gloo/objs/web/http_get.rb +57 -83
- data/lib/gloo/objs/web/http_post.rb +8 -31
- data/lib/gloo/objs/web/json.rb +11 -31
- data/lib/gloo/objs/web/slack.rb +7 -34
- data/lib/gloo/objs/web/teams.rb +13 -48
- data/lib/gloo/objs/web/uri.rb +0 -29
- data/lib/gloo/persist/file_loader.rb +8 -0
- data/lib/gloo/persist/file_saver.rb +6 -0
- data/lib/gloo/persist/file_storage.rb +2 -0
- data/lib/gloo/persist/line_splitter.rb +2 -0
- data/lib/gloo/persist/persist_man.rb +6 -0
- data/lib/gloo/verbs/alert.rb +30 -44
- data/lib/gloo/verbs/beep.rb +0 -30
- data/lib/gloo/verbs/cls.rb +0 -30
- data/lib/gloo/verbs/context.rb +9 -39
- data/lib/gloo/verbs/create.rb +17 -32
- data/lib/gloo/verbs/execute.rb +52 -0
- data/lib/gloo/verbs/help.rb +151 -115
- data/lib/gloo/verbs/if.rb +46 -44
- data/lib/gloo/verbs/list.rb +36 -54
- data/lib/gloo/verbs/load.rb +8 -37
- data/lib/gloo/verbs/move.rb +12 -51
- data/lib/gloo/verbs/put.rb +28 -52
- data/lib/gloo/verbs/quit.rb +0 -31
- data/lib/gloo/verbs/run.rb +23 -39
- data/lib/gloo/verbs/save.rb +0 -33
- data/lib/gloo/verbs/show.rb +6 -31
- data/lib/gloo/verbs/tell.rb +31 -31
- data/lib/gloo/verbs/unless.rb +47 -46
- data/lib/gloo/verbs/version.rb +0 -30
- data/lib/gloo/verbs/wait.rb +0 -31
- metadata +79 -3
data/lib/gloo/expr/expression.rb
CHANGED
|
@@ -8,7 +8,13 @@ module Gloo
|
|
|
8
8
|
module Expr
|
|
9
9
|
class Expression
|
|
10
10
|
|
|
11
|
+
# ---------------------------------------------------------------------
|
|
12
|
+
# Constructor
|
|
13
|
+
# ---------------------------------------------------------------------
|
|
14
|
+
|
|
15
|
+
#
|
|
11
16
|
# Create the expression from a list of tokens.
|
|
17
|
+
#
|
|
12
18
|
def initialize( tokens )
|
|
13
19
|
@tokens = tokens
|
|
14
20
|
@symbols = []
|
|
@@ -17,7 +23,13 @@ module Gloo
|
|
|
17
23
|
@op = nil
|
|
18
24
|
end
|
|
19
25
|
|
|
26
|
+
# ---------------------------------------------------------------------
|
|
27
|
+
# Evaluate Expression
|
|
28
|
+
# ---------------------------------------------------------------------
|
|
29
|
+
|
|
30
|
+
#
|
|
20
31
|
# Evaluate the expression and return the value.
|
|
32
|
+
#
|
|
21
33
|
def evaluate
|
|
22
34
|
identify_tokens
|
|
23
35
|
|
|
@@ -39,7 +51,15 @@ module Gloo
|
|
|
39
51
|
return @left
|
|
40
52
|
end
|
|
41
53
|
|
|
54
|
+
# ---------------------------------------------------------------------
|
|
55
|
+
# Private functions
|
|
56
|
+
# ---------------------------------------------------------------------
|
|
57
|
+
|
|
58
|
+
private
|
|
59
|
+
|
|
60
|
+
#
|
|
42
61
|
# Perform the operation.
|
|
62
|
+
#
|
|
43
63
|
def perform_op
|
|
44
64
|
@op ||= Gloo::Core::Op.default_op
|
|
45
65
|
l = evaluate_sym @left
|
|
@@ -49,7 +69,9 @@ module Gloo
|
|
|
49
69
|
@op = nil
|
|
50
70
|
end
|
|
51
71
|
|
|
72
|
+
#
|
|
52
73
|
# Evaluate the symbol and get a simple value.
|
|
74
|
+
#
|
|
53
75
|
def evaluate_sym( sym )
|
|
54
76
|
return sym.value if sym.is_a? Gloo::Core::Literal
|
|
55
77
|
return resolve_ref sym if sym.is_a? Gloo::Core::Pn
|
|
@@ -57,7 +79,9 @@ module Gloo
|
|
|
57
79
|
return sym
|
|
58
80
|
end
|
|
59
81
|
|
|
82
|
+
#
|
|
60
83
|
# resolve an object reference and get the value.
|
|
84
|
+
#
|
|
61
85
|
def resolve_ref( ref )
|
|
62
86
|
return ref.src if ref.named_color?
|
|
63
87
|
|
|
@@ -65,15 +89,13 @@ module Gloo
|
|
|
65
89
|
return ob.value if ob
|
|
66
90
|
end
|
|
67
91
|
|
|
92
|
+
#
|
|
68
93
|
# Identify each token in the list.
|
|
94
|
+
#
|
|
69
95
|
def identify_tokens
|
|
70
96
|
@tokens.each do |o|
|
|
71
97
|
@symbols << identify_token( o )
|
|
72
98
|
end
|
|
73
|
-
|
|
74
|
-
# @symbols.each do |o|
|
|
75
|
-
# puts o.class.name
|
|
76
|
-
# end
|
|
77
99
|
end
|
|
78
100
|
|
|
79
101
|
#
|
data/lib/gloo/expr/l_boolean.rb
CHANGED
|
@@ -8,17 +8,23 @@ module Gloo
|
|
|
8
8
|
module Expr
|
|
9
9
|
class LBoolean < Gloo::Core::Literal
|
|
10
10
|
|
|
11
|
+
#
|
|
11
12
|
# Is the given token a boolean?
|
|
13
|
+
#
|
|
12
14
|
def self.boolean?( token )
|
|
13
15
|
return Gloo::Objs::Boolean.boolean? token
|
|
14
16
|
end
|
|
15
17
|
|
|
18
|
+
#
|
|
16
19
|
# Set the value, converting to an boolean.
|
|
20
|
+
#
|
|
17
21
|
def set_value( value )
|
|
18
22
|
@value = Gloo::Objs::Boolean.coerse_to_bool value
|
|
19
23
|
end
|
|
20
24
|
|
|
25
|
+
#
|
|
21
26
|
# Get string representation
|
|
27
|
+
#
|
|
22
28
|
def to_s
|
|
23
29
|
return 'false' unless @value
|
|
24
30
|
|
data/lib/gloo/expr/l_decimal.rb
CHANGED
|
@@ -18,13 +18,18 @@ module Gloo
|
|
|
18
18
|
return s.to_f.to_s == s
|
|
19
19
|
end
|
|
20
20
|
|
|
21
|
+
#
|
|
21
22
|
# Set the value, converting to an integer.
|
|
23
|
+
#
|
|
22
24
|
def set_value( value )
|
|
23
25
|
value = value.to_s if value.is_a? Numeric
|
|
24
26
|
|
|
25
27
|
@value = value.to_f
|
|
26
28
|
end
|
|
27
29
|
|
|
30
|
+
#
|
|
31
|
+
# Get string representation
|
|
32
|
+
#
|
|
28
33
|
def to_s
|
|
29
34
|
return self.value.to_s
|
|
30
35
|
end
|
data/lib/gloo/expr/l_integer.rb
CHANGED
|
@@ -8,7 +8,9 @@ module Gloo
|
|
|
8
8
|
module Expr
|
|
9
9
|
class LInteger < Gloo::Core::Literal
|
|
10
10
|
|
|
11
|
+
#
|
|
11
12
|
# Is the given token an integer?
|
|
13
|
+
#
|
|
12
14
|
def self.integer?( token )
|
|
13
15
|
return true if token.is_a? Integer
|
|
14
16
|
|
|
@@ -16,11 +18,16 @@ module Gloo
|
|
|
16
18
|
return s.to_i.to_s == s
|
|
17
19
|
end
|
|
18
20
|
|
|
21
|
+
#
|
|
19
22
|
# Set the value, converting to an integer.
|
|
23
|
+
#
|
|
20
24
|
def set_value( value )
|
|
21
25
|
@value = value.to_i
|
|
22
26
|
end
|
|
23
27
|
|
|
28
|
+
#
|
|
29
|
+
# Get string representation
|
|
30
|
+
#
|
|
24
31
|
def to_s
|
|
25
32
|
return self.value.to_s
|
|
26
33
|
end
|
data/lib/gloo/expr/l_string.rb
CHANGED
|
@@ -8,8 +8,10 @@ module Gloo
|
|
|
8
8
|
module Expr
|
|
9
9
|
class LString < Gloo::Core::Literal
|
|
10
10
|
|
|
11
|
+
#
|
|
11
12
|
# Set the value, triming opening and closing
|
|
12
13
|
# quotations if necessary.
|
|
14
|
+
#
|
|
13
15
|
def set_value( value )
|
|
14
16
|
@value = value
|
|
15
17
|
return unless value
|
|
@@ -17,7 +19,9 @@ module Gloo
|
|
|
17
19
|
@value = LString.strip_quotes( @value )
|
|
18
20
|
end
|
|
19
21
|
|
|
22
|
+
#
|
|
20
23
|
# Is the given token a string?
|
|
24
|
+
#
|
|
21
25
|
def self.string?( token )
|
|
22
26
|
return false unless token.is_a? String
|
|
23
27
|
return true if token.start_with?( '"' )
|
|
@@ -42,6 +46,9 @@ module Gloo
|
|
|
42
46
|
end
|
|
43
47
|
end
|
|
44
48
|
|
|
49
|
+
#
|
|
50
|
+
# Get string representation
|
|
51
|
+
#
|
|
45
52
|
def to_s
|
|
46
53
|
return self.value
|
|
47
54
|
end
|
data/lib/gloo/expr/op_div.rb
CHANGED
data/lib/gloo/expr/op_minus.rb
CHANGED
data/lib/gloo/expr/op_mult.rb
CHANGED
data/lib/gloo/expr/op_plus.rb
CHANGED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
GLOO APPLICATION
|
|
2
|
+
|
|
3
|
+
DESCRIPTION
|
|
4
|
+
Gloo scripting language. A scripting language built on ruby.
|
|
5
|
+
More information coming soon.
|
|
6
|
+
|
|
7
|
+
SYNOPSIS
|
|
8
|
+
gloo [global option] [file]
|
|
9
|
+
|
|
10
|
+
GLOBAL OPTIONS
|
|
11
|
+
--cli - Run in CLI mode
|
|
12
|
+
- If no options are specified, this is the default.
|
|
13
|
+
--version - Show application version
|
|
14
|
+
--help - Show this help page
|
|
15
|
+
|
|
16
|
+
FILE
|
|
17
|
+
TODO: document running a gloo script
|
|
18
|
+
how to reference files by relative path in gloo folder
|
|
19
|
+
and also by absolute path
|
|
20
|
+
|
|
21
|
+
SEE ALSO
|
|
22
|
+
application, configuration
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
GLOO HELP
|
|
2
|
+
|
|
3
|
+
TODO: write this article
|
|
4
|
+
|
|
5
|
+
LISTS
|
|
6
|
+
Show options for object and verb lists
|
|
7
|
+
|
|
8
|
+
DETAIL
|
|
9
|
+
How to get help detail for verbs and objects
|
|
10
|
+
How to see a help pages
|
|
11
|
+
How to see a list of help pages (topics)
|
|
12
|
+
|
|
13
|
+
SEE ALSO
|
|
14
|
+
application, configuration
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
GLOO APPLICATION LOGGING
|
|
2
|
+
|
|
3
|
+
DESCRIPTION
|
|
4
|
+
Gloo writes to the gloo.log as well as to the console.
|
|
5
|
+
Debug messages are written to the log only, but other messages
|
|
6
|
+
are also written to the console unless the application is
|
|
7
|
+
running in quiet mode.
|
|
8
|
+
|
|
9
|
+
CONFIGURATION
|
|
10
|
+
The application logs folder is in the gloo folder.
|
|
11
|
+
When gloo is run, the gloo.log file will be written to.
|
|
12
|
+
|
|
13
|
+
TAIL
|
|
14
|
+
Example tail command to watch the gloo log:
|
|
15
|
+
|
|
16
|
+
tail -f ~/gloo/logs/gloo.log
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
COLOR
|
|
2
|
+
|
|
3
|
+
DESCRIPTION
|
|
4
|
+
The following colors can be used by the show verb to display
|
|
5
|
+
colored text:
|
|
6
|
+
|
|
7
|
+
red
|
|
8
|
+
blue
|
|
9
|
+
green
|
|
10
|
+
white
|
|
11
|
+
black
|
|
12
|
+
yellow
|
|
13
|
+
|
|
14
|
+
The color names are considered as virtual objects but may
|
|
15
|
+
also be referenced in variables. See the example below.
|
|
16
|
+
|
|
17
|
+
EXAMPLE
|
|
18
|
+
Here are some examples of expression usage:
|
|
19
|
+
|
|
20
|
+
#
|
|
21
|
+
# Show multiple messages in color
|
|
22
|
+
#
|
|
23
|
+
colors [can] :
|
|
24
|
+
var [string] : red
|
|
25
|
+
on_load [script] :
|
|
26
|
+
show "red" (colors.var)
|
|
27
|
+
show "blue" (blue)
|
|
28
|
+
show "green" (green)
|
|
29
|
+
|
|
30
|
+
SEE ALSO
|
|
31
|
+
show
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
ERROR
|
|
2
|
+
|
|
3
|
+
DESCRIPTION
|
|
4
|
+
Gloo has a special 'error' variable that's not part of the normal
|
|
5
|
+
object heap. The error will be empty most of the time, but
|
|
6
|
+
if a command results in an error, this variable will hold the
|
|
7
|
+
error message until the next command is executed. The error
|
|
8
|
+
is a string and can be accessed by simply referring to the
|
|
9
|
+
path-name 'error'.
|
|
10
|
+
|
|
11
|
+
EXAMPLE
|
|
12
|
+
To see the last error:
|
|
13
|
+
|
|
14
|
+
> show error
|
|
15
|
+
|
|
16
|
+
To run a command that generates an error:
|
|
17
|
+
|
|
18
|
+
> put 3 into
|
|
19
|
+
'put' must include 'into' target
|
|
20
|
+
|
|
21
|
+
Then, showing the error
|
|
22
|
+
|
|
23
|
+
> show error
|
|
24
|
+
'put' must include 'into' target
|
|
25
|
+
|
|
26
|
+
But, as mentioned, the next command will clear out the last error.
|
|
27
|
+
If you need to keep track of the result of a command, you should
|
|
28
|
+
put the error into another object.
|
|
29
|
+
|
|
30
|
+
> create err as string
|
|
31
|
+
> put 3 into
|
|
32
|
+
> put error into err
|
|
33
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
EVENTS
|
|
2
|
+
|
|
3
|
+
DESCRIPTION
|
|
4
|
+
Scripts can be written to be triggered by events. The current list is as
|
|
5
|
+
follows, but it is expected that the list of events will grow.
|
|
6
|
+
|
|
7
|
+
on_load - run when a script loads
|
|
8
|
+
on_unload - run when an object receives an unload message
|
|
9
|
+
|
|
10
|
+
TODO: add event types.
|
|
11
|
+
|
|
12
|
+
EXAMPLE
|
|
13
|
+
Show a message when a file is loaded:
|
|
14
|
+
|
|
15
|
+
start [container] :
|
|
16
|
+
on_load [script] : show "Welcome back!" (white)
|
|
17
|
+
|
|
18
|
+
Show a message when a file unloaded:
|
|
19
|
+
|
|
20
|
+
done [container] :
|
|
21
|
+
on_unload [script] : show "See ya soon!" (white)
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
GLOO SYSTEM OBJECTS
|
|
2
|
+
|
|
3
|
+
DESCRIPTION
|
|
4
|
+
The gloo system objects are virtual objects. That is that they
|
|
5
|
+
can be accessed like other objects. But the values are set by
|
|
6
|
+
the system. The values cannot be updated. The other difference
|
|
7
|
+
is that the virtual objects do not show up in the object heap.
|
|
8
|
+
|
|
9
|
+
ACCESS
|
|
10
|
+
The gloo objects can be accessed through the 'gloo' root level
|
|
11
|
+
virtual object designation. There is also a shortcut for the virtual
|
|
12
|
+
object path: '$'. For example, to see the current user:
|
|
13
|
+
|
|
14
|
+
> show gloo.user
|
|
15
|
+
|
|
16
|
+
Or:
|
|
17
|
+
|
|
18
|
+
> show $.user
|
|
19
|
+
|
|
20
|
+
Some objects include an '_' to separate words. As an alternative,
|
|
21
|
+
a '.' can be used instead. The following commands are treated as
|
|
22
|
+
identical:
|
|
23
|
+
|
|
24
|
+
> show gloo.working_dir
|
|
25
|
+
> show gloo.working.dir
|
|
26
|
+
> show $.working_dir
|
|
27
|
+
> show $.working.dir
|
|
28
|
+
|
|
29
|
+
OBJECTS
|
|
30
|
+
|
|
31
|
+
IDENTITY
|
|
32
|
+
gloo.hostname # Get the system hostname.
|
|
33
|
+
gloo.user # Get the logged in User.
|
|
34
|
+
|
|
35
|
+
FILE SYSTEM
|
|
36
|
+
gloo.user_home # Get the user's home directory.
|
|
37
|
+
gloo.working_dir # Get the working directory.
|
|
38
|
+
gloo.gloo_home # Get the gloo home directory
|
|
39
|
+
gloo.gloo_config # Get the gloo configuration directory
|
|
40
|
+
gloo.gloo_projects # Get the gloo projects directory
|
|
41
|
+
gloo.gloo_log # Get the gloo logging directory
|
|
42
|
+
|
|
43
|
+
SCREEN
|
|
44
|
+
gloo.screen_lines # Get the number of lines on screen.
|
|
45
|
+
gloo.screen_cols # Get the number of columns on screen.
|
|
46
|
+
|
|
47
|
+
PLATFORM
|
|
48
|
+
gloo.platform_cpu # Get the platform CPU
|
|
49
|
+
gloo.platform_os # Get the platform Operating System
|
|
50
|
+
gloo.platform_version # Get the platform version
|
|
51
|
+
gloo.platform_windows? # Is the platform Windows?
|
|
52
|
+
gloo.platform_unix? # Is the platform Unix?
|
|
53
|
+
gloo.platform_linux? # Is the platform Linux?
|
|
54
|
+
gloo.platform_mac? # Is the platform Mac?
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
HERE
|
|
2
|
+
|
|
3
|
+
DESCRIPTION
|
|
4
|
+
Gloo scripts can use relative referencing to access objects
|
|
5
|
+
without specifying the full path. This relative referencing is
|
|
6
|
+
referred to with the 'here' operator: ^
|
|
7
|
+
|
|
8
|
+
EXAMPLE
|
|
9
|
+
In the following script, the here reference is used several times:
|
|
10
|
+
|
|
11
|
+
#
|
|
12
|
+
# Use here reference.
|
|
13
|
+
#
|
|
14
|
+
here [can] :
|
|
15
|
+
s [str] : local string
|
|
16
|
+
on_load [script] : show ^.s
|
|
17
|
+
a [can] :
|
|
18
|
+
s [str] : A string
|
|
19
|
+
b [can] :
|
|
20
|
+
s [str] : B string
|
|
21
|
+
on_load [script] :
|
|
22
|
+
show ^.s
|
|
23
|
+
show ^^.s
|
|
24
|
+
|
|
25
|
+
A single use of '^' means: refer to an object at the same level
|
|
26
|
+
as the running script. It tells the interpreter to 'look here'
|
|
27
|
+
for the object.
|
|
28
|
+
|
|
29
|
+
Use of two ^^ here references means to go up a level, and
|
|
30
|
+
so forth.
|