gloo 0.5.4 → 0.7.2
Sign up to get free protection for your applications and to get access to all the features.
- 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/verbs/quit.rb
CHANGED
@@ -35,37 +35,6 @@ module Gloo
|
|
35
35
|
return KEYWORD_SHORT
|
36
36
|
end
|
37
37
|
|
38
|
-
# ---------------------------------------------------------------------
|
39
|
-
# Help
|
40
|
-
# ---------------------------------------------------------------------
|
41
|
-
|
42
|
-
#
|
43
|
-
# Get help for this verb.
|
44
|
-
#
|
45
|
-
def self.help
|
46
|
-
return <<~TEXT
|
47
|
-
QUIT VERB
|
48
|
-
NAME: quit
|
49
|
-
SHORTCUT: q
|
50
|
-
|
51
|
-
DESCRIPTION
|
52
|
-
Stop running the gloo application.
|
53
|
-
Cleanup and shutdown.
|
54
|
-
|
55
|
-
SYNTAX
|
56
|
-
quit
|
57
|
-
|
58
|
-
PARAMETERS
|
59
|
-
None
|
60
|
-
|
61
|
-
RESULT
|
62
|
-
None
|
63
|
-
|
64
|
-
ERRORS
|
65
|
-
None
|
66
|
-
TEXT
|
67
|
-
end
|
68
|
-
|
69
38
|
end
|
70
39
|
end
|
71
40
|
end
|
data/lib/gloo/verbs/run.rb
CHANGED
@@ -12,11 +12,17 @@ module Gloo
|
|
12
12
|
KEYWORD = 'run'.freeze
|
13
13
|
KEYWORD_SHORT = 'r'.freeze
|
14
14
|
EVALUATE_RUN = '~>'.freeze
|
15
|
+
MISSING_EXPR_ERR = 'Missing Expression!'.freeze
|
15
16
|
|
16
17
|
#
|
17
18
|
# Run the verb.
|
18
19
|
#
|
19
20
|
def run
|
21
|
+
if @tokens.token_count < 2
|
22
|
+
$engine.err MISSING_EXPR_ERR
|
23
|
+
return
|
24
|
+
end
|
25
|
+
|
20
26
|
if @tokens.second == EVALUATE_RUN
|
21
27
|
run_expression
|
22
28
|
else
|
@@ -24,23 +30,6 @@ module Gloo
|
|
24
30
|
end
|
25
31
|
end
|
26
32
|
|
27
|
-
#
|
28
|
-
# Run a script specified by pathname
|
29
|
-
#
|
30
|
-
def run_script
|
31
|
-
Gloo::Exec::Runner.run @tokens.second
|
32
|
-
end
|
33
|
-
|
34
|
-
#
|
35
|
-
# Evaluate an expression and run that.
|
36
|
-
#
|
37
|
-
def run_expression
|
38
|
-
return unless @tokens.token_count > 2
|
39
|
-
|
40
|
-
expr = Gloo::Expr::Expression.new( @tokens.params[ 1..-1 ] )
|
41
|
-
$engine.parser.run expr.evaluate
|
42
|
-
end
|
43
|
-
|
44
33
|
#
|
45
34
|
# Get the Verb's keyword.
|
46
35
|
#
|
@@ -56,34 +45,29 @@ module Gloo
|
|
56
45
|
end
|
57
46
|
|
58
47
|
# ---------------------------------------------------------------------
|
59
|
-
#
|
48
|
+
# Private functions
|
60
49
|
# ---------------------------------------------------------------------
|
61
50
|
|
51
|
+
private
|
52
|
+
|
62
53
|
#
|
63
|
-
#
|
54
|
+
# Run a script specified by pathname
|
64
55
|
#
|
65
|
-
def
|
66
|
-
|
67
|
-
|
68
|
-
NAME: run
|
69
|
-
SHORTCUT: r
|
70
|
-
|
71
|
-
DESCRIPTION
|
72
|
-
Run a script or other object.
|
73
|
-
This is the same as sending a 'run' message to the object.
|
74
|
-
|
75
|
-
SYNTAX
|
76
|
-
run <path.to.object>
|
77
|
-
|
78
|
-
PARAMETERS
|
79
|
-
path.to.object - Reference to the object which will be run.
|
56
|
+
def run_script
|
57
|
+
Gloo::Exec::Runner.run @tokens.second
|
58
|
+
end
|
80
59
|
|
81
|
-
|
82
|
-
|
60
|
+
#
|
61
|
+
# Evaluate an expression and run that.
|
62
|
+
#
|
63
|
+
def run_expression
|
64
|
+
unless @tokens.token_count > 2
|
65
|
+
$engine.err MISSING_EXPR_ERR
|
66
|
+
return
|
67
|
+
end
|
83
68
|
|
84
|
-
|
85
|
-
|
86
|
-
TEXT
|
69
|
+
expr = Gloo::Expr::Expression.new( @tokens.params[ 1..-1 ] )
|
70
|
+
$engine.parser.run expr.evaluate
|
87
71
|
end
|
88
72
|
|
89
73
|
end
|
data/lib/gloo/verbs/save.rb
CHANGED
@@ -34,39 +34,6 @@ module Gloo
|
|
34
34
|
return KEYWORD_SHORT
|
35
35
|
end
|
36
36
|
|
37
|
-
# ---------------------------------------------------------------------
|
38
|
-
# Help
|
39
|
-
# ---------------------------------------------------------------------
|
40
|
-
|
41
|
-
#
|
42
|
-
# Get help for this verb.
|
43
|
-
#
|
44
|
-
def self.help
|
45
|
-
return <<~TEXT
|
46
|
-
SAVE VERB
|
47
|
-
NAME: save
|
48
|
-
SHORTCUT: >
|
49
|
-
|
50
|
-
DESCRIPTION
|
51
|
-
Stop running the gloo application.
|
52
|
-
Cleanup and shutdown.
|
53
|
-
|
54
|
-
SYNTAX
|
55
|
-
save <path.to.object>
|
56
|
-
Save a previously loaded object. The path will be for the
|
57
|
-
root level object that was loaded earlier.
|
58
|
-
|
59
|
-
PARAMETERS
|
60
|
-
path.to.object - Name of the object file that is to be saved.
|
61
|
-
|
62
|
-
RESULT
|
63
|
-
The file is updated with the latest object state.
|
64
|
-
|
65
|
-
ERRORS
|
66
|
-
None
|
67
|
-
TEXT
|
68
|
-
end
|
69
|
-
|
70
37
|
end
|
71
38
|
end
|
72
39
|
end
|
data/lib/gloo/verbs/show.rb
CHANGED
@@ -40,6 +40,12 @@ module Gloo
|
|
40
40
|
return KEYWORD_SHORT
|
41
41
|
end
|
42
42
|
|
43
|
+
# ---------------------------------------------------------------------
|
44
|
+
# Private functions
|
45
|
+
# ---------------------------------------------------------------------
|
46
|
+
|
47
|
+
private
|
48
|
+
|
43
49
|
#
|
44
50
|
# Get the formatted string.
|
45
51
|
#
|
@@ -53,37 +59,6 @@ module Gloo
|
|
53
59
|
return str
|
54
60
|
end
|
55
61
|
|
56
|
-
# ---------------------------------------------------------------------
|
57
|
-
# Help
|
58
|
-
# ---------------------------------------------------------------------
|
59
|
-
|
60
|
-
#
|
61
|
-
# Get help for this verb.
|
62
|
-
#
|
63
|
-
def self.help
|
64
|
-
return <<~TEXT
|
65
|
-
SHOW VERB
|
66
|
-
NAME: show
|
67
|
-
SHORTCUT: =
|
68
|
-
|
69
|
-
DESCRIPTION
|
70
|
-
Show an object's value.
|
71
|
-
|
72
|
-
SYNTAX
|
73
|
-
show <path.to.object>
|
74
|
-
|
75
|
-
PARAMETERS
|
76
|
-
path.to.object - The object that we want to see.
|
77
|
-
|
78
|
-
RESULT
|
79
|
-
The object's value is shown.
|
80
|
-
<it> will contain the object's value.
|
81
|
-
|
82
|
-
ERRORS
|
83
|
-
None
|
84
|
-
TEXT
|
85
|
-
end
|
86
|
-
|
87
62
|
end
|
88
63
|
end
|
89
64
|
end
|
data/lib/gloo/verbs/tell.rb
CHANGED
@@ -11,21 +11,18 @@ module Gloo
|
|
11
11
|
KEYWORD = 'tell'.freeze
|
12
12
|
KEYWORD_SHORT = '->'.freeze
|
13
13
|
TO = 'to'.freeze
|
14
|
+
OBJ_NOT_FOUND_ERR = 'Object was not found: '.freeze
|
15
|
+
UNKNOWN_MSG_ERR = 'Missing message!'.freeze
|
14
16
|
|
15
17
|
#
|
16
18
|
# Run the verb.
|
17
19
|
#
|
18
20
|
def run
|
19
|
-
|
20
|
-
|
21
|
-
pn = Gloo::Core::Pn.new name
|
22
|
-
o = pn.resolve
|
21
|
+
setup_msg
|
22
|
+
return unless @msg
|
23
23
|
|
24
|
-
|
25
|
-
|
26
|
-
else
|
27
|
-
$log.error "Could not send message to object. Bad path: #{name}"
|
28
|
-
end
|
24
|
+
setup_target
|
25
|
+
dispatch_msg
|
29
26
|
end
|
30
27
|
|
31
28
|
#
|
@@ -43,35 +40,38 @@ module Gloo
|
|
43
40
|
end
|
44
41
|
|
45
42
|
# ---------------------------------------------------------------------
|
46
|
-
#
|
43
|
+
# Private functions
|
47
44
|
# ---------------------------------------------------------------------
|
48
45
|
|
46
|
+
private
|
47
|
+
|
49
48
|
#
|
50
|
-
#
|
49
|
+
# Lookup the message to send.
|
51
50
|
#
|
52
|
-
def
|
53
|
-
|
54
|
-
TELL VERB
|
55
|
-
NAME: tell
|
56
|
-
SHORTCUT: ->
|
57
|
-
|
58
|
-
DESCRIPTION
|
59
|
-
Send a message to an object.
|
60
|
-
Ask the object to perform an action.
|
51
|
+
def setup_msg
|
52
|
+
@msg = @tokens.after_token( TO )
|
61
53
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
PARAMETERS
|
66
|
-
path.to.object - The object that we want to see.
|
67
|
-
message - The message to send.
|
54
|
+
$engine.err( UNKNOWN_MSG_ERR ) unless @msg
|
55
|
+
end
|
68
56
|
|
69
|
-
|
70
|
-
|
57
|
+
#
|
58
|
+
# Setup the target of the message.
|
59
|
+
#
|
60
|
+
def setup_target
|
61
|
+
@obj_name = @tokens.second
|
62
|
+
pn = Gloo::Core::Pn.new @obj_name
|
63
|
+
@target_obj = pn.resolve
|
64
|
+
end
|
71
65
|
|
72
|
-
|
73
|
-
|
74
|
-
|
66
|
+
#
|
67
|
+
# Dispatch the message to the target object.
|
68
|
+
#
|
69
|
+
def dispatch_msg
|
70
|
+
if @target_obj
|
71
|
+
Gloo::Exec::Dispatch.message @msg, @target_obj, @params
|
72
|
+
else
|
73
|
+
$engine.err "#{OBJ_NOT_FOUND_ERR} #{@obj_name}"
|
74
|
+
end
|
75
75
|
end
|
76
76
|
|
77
77
|
end
|
data/lib/gloo/verbs/unless.rb
CHANGED
@@ -10,32 +10,19 @@ module Gloo
|
|
10
10
|
|
11
11
|
KEYWORD = 'unless'.freeze
|
12
12
|
KEYWORD_SHORT = 'if!'.freeze
|
13
|
-
|
13
|
+
DO = 'do'.freeze
|
14
|
+
MISSING_EXPR_ERR = 'Missing Expression!'.freeze
|
14
15
|
|
15
16
|
#
|
16
17
|
# Run the verb.
|
17
18
|
#
|
18
19
|
def run
|
19
|
-
value =
|
20
|
-
if value.
|
21
|
-
# The first token is the verb, so we drop it.
|
22
|
-
value = value[ 1..-1 ]
|
23
|
-
end
|
20
|
+
value = value_tokens
|
21
|
+
return if value.nil?
|
24
22
|
|
25
|
-
evals_false
|
26
|
-
if value.count.positive?
|
27
|
-
expr = Gloo::Expr::Expression.new( value )
|
28
|
-
result = expr.evaluate
|
29
|
-
evals_false = true if result == false
|
30
|
-
evals_false = true if result.is_a?( Numeric ) && result.zero?
|
31
|
-
end
|
32
|
-
return unless evals_false
|
23
|
+
return unless evals_false( value )
|
33
24
|
|
34
|
-
|
35
|
-
i = $engine.parser.parse_immediate cmd
|
36
|
-
return unless i
|
37
|
-
|
38
|
-
i.run
|
25
|
+
run_do
|
39
26
|
end
|
40
27
|
|
41
28
|
#
|
@@ -53,37 +40,51 @@ module Gloo
|
|
53
40
|
end
|
54
41
|
|
55
42
|
# ---------------------------------------------------------------------
|
56
|
-
#
|
43
|
+
# Private functions
|
57
44
|
# ---------------------------------------------------------------------
|
58
45
|
|
46
|
+
private
|
47
|
+
|
59
48
|
#
|
60
|
-
# Get
|
49
|
+
# Get the list of tokens that represent the parameters
|
50
|
+
# of the unless command.
|
61
51
|
#
|
62
|
-
def
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
52
|
+
def value_tokens
|
53
|
+
value = @tokens.before_token( DO )
|
54
|
+
if value && value.count > 1
|
55
|
+
# The first token is the verb, so we drop it.
|
56
|
+
value = value[ 1..-1 ]
|
57
|
+
else
|
58
|
+
$engine.err MISSING_EXPR_ERR
|
59
|
+
end
|
60
|
+
|
61
|
+
return value
|
62
|
+
end
|
63
|
+
|
64
|
+
#
|
65
|
+
# Does the given value evalute to true?
|
66
|
+
#
|
67
|
+
def evals_false( value )
|
68
|
+
eval_result = false
|
69
|
+
if value.count.positive?
|
70
|
+
expr = Gloo::Expr::Expression.new( value )
|
71
|
+
result = expr.evaluate
|
72
|
+
eval_result = true if result == false
|
73
|
+
eval_result = true if result.is_a?( Numeric ) && result.zero?
|
74
|
+
end
|
75
|
+
|
76
|
+
return eval_result
|
77
|
+
end
|
78
|
+
|
79
|
+
#
|
80
|
+
# Run the 'do' command.
|
81
|
+
#
|
82
|
+
def run_do
|
83
|
+
cmd = @tokens.expr_after( DO )
|
84
|
+
i = $engine.parser.parse_immediate cmd
|
85
|
+
return unless i
|
86
|
+
|
87
|
+
i.run
|
87
88
|
end
|
88
89
|
|
89
90
|
end
|
data/lib/gloo/verbs/version.rb
CHANGED
@@ -32,36 +32,6 @@ module Gloo
|
|
32
32
|
return KEYWORD_SHORT
|
33
33
|
end
|
34
34
|
|
35
|
-
# ---------------------------------------------------------------------
|
36
|
-
# Help
|
37
|
-
# ---------------------------------------------------------------------
|
38
|
-
|
39
|
-
#
|
40
|
-
# Get help for this verb.
|
41
|
-
#
|
42
|
-
def self.help
|
43
|
-
return <<~TEXT
|
44
|
-
VERSION VERB
|
45
|
-
NAME: version
|
46
|
-
SHORTCUT: v
|
47
|
-
|
48
|
-
DESCRIPTION
|
49
|
-
Show the application version information.
|
50
|
-
|
51
|
-
SYNTAX
|
52
|
-
version
|
53
|
-
|
54
|
-
PARAMETERS
|
55
|
-
None
|
56
|
-
|
57
|
-
RESULT
|
58
|
-
None
|
59
|
-
|
60
|
-
ERRORS
|
61
|
-
None
|
62
|
-
TEXT
|
63
|
-
end
|
64
|
-
|
65
35
|
end
|
66
36
|
end
|
67
37
|
end
|