gloo 0.8.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.DS_Store +0 -0
- data/.gitignore +2 -1
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/LICENSE.txt +1 -1
- data/gloo.gemspec +12 -4
- data/lib/VERSION +1 -1
- data/lib/dependencies.rb +4 -4
- data/lib/gloo/app/info.rb +3 -1
- data/lib/gloo/app/log.rb +1 -29
- data/lib/gloo/app/platform.rb +142 -0
- data/lib/gloo/objs/cli/banner.rb +2 -2
- data/lib/gloo/objs/cli/bar.rb +4 -4
- data/lib/gloo/objs/cli/colorize.rb +3 -3
- data/lib/gloo/objs/cli/confirm.rb +3 -3
- data/lib/gloo/objs/cli/menu.rb +9 -9
- data/lib/gloo/objs/cli/menu_item.rb +2 -2
- data/lib/gloo/objs/cli/pastel.rb +2 -2
- data/lib/gloo/objs/cli/prompt.rb +4 -4
- data/lib/gloo/objs/cli/select.rb +4 -4
- data/lib/gloo/objs/data/mysql.rb +9 -9
- data/lib/gloo/objs/data/sqlite.rb +10 -10
- data/lib/gloo/objs/dev/git.rb +7 -7
- data/lib/gloo/objs/dev/stats.rb +8 -5
- data/lib/gloo/objs/snd/play.rb +1 -1
- data/lib/gloo/objs/snd/say.rb +2 -2
- data/lib/gloo/objs/system/file_handle.rb +9 -9
- data/lib/gloo/objs/system/ssh_exec.rb +3 -3
- data/lib/gloo/objs/system/system.rb +2 -2
- data/lib/gloo/verbs/alert.rb +7 -7
- data/lib/gloo/verbs/beep.rb +1 -1
- data/lib/gloo/verbs/cls.rb +2 -2
- data/lib/gloo/verbs/help.rb +7 -189
- data/lib/gloo/verbs/version.rb +3 -3
- data/lib/gloo.rb +5 -1
- data/lib/run.rb +5 -1
- metadata +41 -177
- data/Gemfile.lock +0 -171
- data/lib/gloo/app/args.rb +0 -112
- data/lib/gloo/app/engine.rb +0 -230
- data/lib/gloo/app/help.rb +0 -156
- data/lib/gloo/app/mode.rb +0 -27
- data/lib/gloo/app/settings.rb +0 -186
- data/lib/gloo/convert/converter.rb +0 -35
- data/lib/gloo/convert/string_to_datetime.rb +0 -21
- data/lib/gloo/convert/string_to_decimal.rb +0 -20
- data/lib/gloo/convert/string_to_integer.rb +0 -20
- data/lib/gloo/core/baseo.rb +0 -30
- data/lib/gloo/core/dictionary.rb +0 -181
- data/lib/gloo/core/error.rb +0 -61
- data/lib/gloo/core/event_manager.rb +0 -44
- data/lib/gloo/core/factory.rb +0 -210
- data/lib/gloo/core/gloo_system.rb +0 -266
- data/lib/gloo/core/heap.rb +0 -52
- data/lib/gloo/core/here.rb +0 -36
- data/lib/gloo/core/it.rb +0 -36
- data/lib/gloo/core/literal.rb +0 -30
- data/lib/gloo/core/obj.rb +0 -303
- data/lib/gloo/core/obj_finder.rb +0 -30
- data/lib/gloo/core/op.rb +0 -40
- data/lib/gloo/core/parser.rb +0 -59
- data/lib/gloo/core/pn.rb +0 -188
- data/lib/gloo/core/tokens.rb +0 -165
- data/lib/gloo/core/verb.rb +0 -86
- data/lib/gloo/exec/action.rb +0 -48
- data/lib/gloo/exec/dispatch.rb +0 -40
- data/lib/gloo/exec/exec_env.rb +0 -74
- data/lib/gloo/exec/runner.rb +0 -45
- data/lib/gloo/exec/script.rb +0 -49
- data/lib/gloo/exec/stack.rb +0 -78
- data/lib/gloo/expr/expression.rb +0 -118
- data/lib/gloo/expr/l_boolean.rb +0 -36
- data/lib/gloo/expr/l_decimal.rb +0 -39
- data/lib/gloo/expr/l_integer.rb +0 -37
- data/lib/gloo/expr/l_string.rb +0 -58
- data/lib/gloo/expr/op_div.rb +0 -22
- data/lib/gloo/expr/op_minus.rb +0 -22
- data/lib/gloo/expr/op_mult.rb +0 -22
- data/lib/gloo/expr/op_plus.rb +0 -24
- data/lib/gloo/help/app/application.txt +0 -22
- data/lib/gloo/help/app/configuration.txt +0 -7
- data/lib/gloo/help/app/default_help.txt +0 -14
- data/lib/gloo/help/app/logging.txt +0 -16
- data/lib/gloo/help/core/color.txt +0 -31
- data/lib/gloo/help/core/error.txt +0 -33
- data/lib/gloo/help/core/events.txt +0 -21
- data/lib/gloo/help/core/gloo_system.txt +0 -57
- data/lib/gloo/help/core/here.txt +0 -30
- data/lib/gloo/help/core/it.txt +0 -23
- data/lib/gloo/help/core/ops.txt +0 -16
- data/lib/gloo/help/core/pathname.txt +0 -29
- data/lib/gloo/help/objs/basic/alias.txt +0 -36
- data/lib/gloo/help/objs/basic/boolean.txt +0 -28
- data/lib/gloo/help/objs/basic/container.txt +0 -33
- data/lib/gloo/help/objs/basic/decimal.txt +0 -28
- data/lib/gloo/help/objs/basic/integer.txt +0 -27
- data/lib/gloo/help/objs/basic/script.txt +0 -29
- data/lib/gloo/help/objs/basic/string.txt +0 -28
- data/lib/gloo/help/objs/basic/text.txt +0 -27
- data/lib/gloo/help/objs/basic/untyped.txt +0 -22
- data/lib/gloo/help/objs/cli/banner.txt +0 -49
- data/lib/gloo/help/objs/cli/bar.txt +0 -37
- data/lib/gloo/help/objs/cli/colorize.txt +0 -33
- data/lib/gloo/help/objs/cli/confirm.txt +0 -26
- data/lib/gloo/help/objs/cli/menu.txt +0 -44
- data/lib/gloo/help/objs/cli/menu_item.txt +0 -26
- data/lib/gloo/help/objs/cli/pastel.txt +0 -43
- data/lib/gloo/help/objs/cli/prompt.txt +0 -27
- data/lib/gloo/help/objs/cli/select.txt +0 -34
- data/lib/gloo/help/objs/ctrl/each.txt +0 -48
- data/lib/gloo/help/objs/ctrl/repeat.txt +0 -38
- data/lib/gloo/help/objs/data/markdown.txt +0 -25
- data/lib/gloo/help/objs/data/mysql.txt +0 -40
- data/lib/gloo/help/objs/data/query.txt +0 -37
- data/lib/gloo/help/objs/data/sqlite.txt +0 -26
- data/lib/gloo/help/objs/data/table.txt +0 -46
- data/lib/gloo/help/objs/dev/git_repo.txt +0 -36
- data/lib/gloo/help/objs/dev/stats.txt +0 -36
- data/lib/gloo/help/objs/dt/date.txt +0 -23
- data/lib/gloo/help/objs/dt/datetime.txt +0 -24
- data/lib/gloo/help/objs/dt/time.txt +0 -23
- data/lib/gloo/help/objs/ror/erb.txt +0 -37
- data/lib/gloo/help/objs/ror/eval.txt +0 -24
- data/lib/gloo/help/objs/snd/play.txt +0 -23
- data/lib/gloo/help/objs/snd/say.txt +0 -28
- data/lib/gloo/help/objs/system/file.txt +0 -48
- data/lib/gloo/help/objs/system/ssh_exec.txt +0 -30
- data/lib/gloo/help/objs/system/system.txt +0 -32
- data/lib/gloo/help/objs/web/http_get.txt +0 -35
- data/lib/gloo/help/objs/web/http_post.txt +0 -34
- data/lib/gloo/help/objs/web/json.txt +0 -34
- data/lib/gloo/help/objs/web/slack.txt +0 -33
- data/lib/gloo/help/objs/web/teams.txt +0 -30
- data/lib/gloo/help/objs/web/uri.txt +0 -38
- data/lib/gloo/help/verbs/alert.txt +0 -33
- data/lib/gloo/help/verbs/beep.txt +0 -25
- data/lib/gloo/help/verbs/cls.txt +0 -24
- data/lib/gloo/help/verbs/context.txt +0 -43
- data/lib/gloo/help/verbs/create.txt +0 -33
- data/lib/gloo/help/verbs/execute.txt +0 -27
- data/lib/gloo/help/verbs/help.txt +0 -34
- data/lib/gloo/help/verbs/if.txt +0 -37
- data/lib/gloo/help/verbs/list.txt +0 -34
- data/lib/gloo/help/verbs/load.txt +0 -38
- data/lib/gloo/help/verbs/move.txt +0 -42
- data/lib/gloo/help/verbs/put.txt +0 -38
- data/lib/gloo/help/verbs/quit.txt +0 -25
- data/lib/gloo/help/verbs/run.txt +0 -41
- data/lib/gloo/help/verbs/save.txt +0 -26
- data/lib/gloo/help/verbs/show.txt +0 -30
- data/lib/gloo/help/verbs/tell.txt +0 -34
- data/lib/gloo/help/verbs/unless.txt +0 -38
- data/lib/gloo/help/verbs/version.txt +0 -32
- data/lib/gloo/help/verbs/wait.txt +0 -29
- data/lib/gloo/objs/basic/alias.rb +0 -78
- data/lib/gloo/objs/basic/boolean.rb +0 -120
- data/lib/gloo/objs/basic/container.rb +0 -76
- data/lib/gloo/objs/basic/decimal.rb +0 -76
- data/lib/gloo/objs/basic/integer.rb +0 -73
- data/lib/gloo/objs/basic/script.rb +0 -99
- data/lib/gloo/objs/basic/string.rb +0 -77
- data/lib/gloo/objs/basic/text.rb +0 -87
- data/lib/gloo/objs/basic/untyped.rb +0 -41
- data/lib/gloo/objs/ctrl/each.rb +0 -279
- data/lib/gloo/objs/ctrl/repeat.rb +0 -108
- data/lib/gloo/objs/data/markdown.rb +0 -84
- data/lib/gloo/objs/data/query.rb +0 -176
- data/lib/gloo/objs/data/table.rb +0 -140
- data/lib/gloo/objs/dt/date.rb +0 -50
- data/lib/gloo/objs/dt/datetime.rb +0 -62
- data/lib/gloo/objs/dt/time.rb +0 -50
- data/lib/gloo/objs/ror/erb.rb +0 -116
- data/lib/gloo/objs/ror/eval.rb +0 -107
- data/lib/gloo/objs/web/http_get.rb +0 -159
- data/lib/gloo/objs/web/http_post.rb +0 -183
- data/lib/gloo/objs/web/json.rb +0 -135
- data/lib/gloo/objs/web/slack.rb +0 -130
- data/lib/gloo/objs/web/teams.rb +0 -117
- data/lib/gloo/objs/web/uri.rb +0 -148
- data/lib/gloo/persist/file_loader.rb +0 -191
- data/lib/gloo/persist/file_saver.rb +0 -49
- data/lib/gloo/persist/file_storage.rb +0 -45
- data/lib/gloo/persist/line_splitter.rb +0 -81
- data/lib/gloo/persist/persist_man.rb +0 -120
- data/lib/gloo/utils/format.rb +0 -21
- data/lib/gloo/utils/stats.rb +0 -205
- data/lib/gloo/utils/words.rb +0 -19
- data/lib/gloo/verbs/context.rb +0 -62
- data/lib/gloo/verbs/create.rb +0 -68
- data/lib/gloo/verbs/execute.rb +0 -56
- data/lib/gloo/verbs/if.rb +0 -92
- data/lib/gloo/verbs/list.rb +0 -98
- data/lib/gloo/verbs/load.rb +0 -45
- data/lib/gloo/verbs/move.rb +0 -89
- data/lib/gloo/verbs/put.rb +0 -94
- data/lib/gloo/verbs/quit.rb +0 -40
- data/lib/gloo/verbs/run.rb +0 -75
- data/lib/gloo/verbs/save.rb +0 -39
- data/lib/gloo/verbs/show.rb +0 -64
- data/lib/gloo/verbs/tell.rb +0 -79
- data/lib/gloo/verbs/unless.rb +0 -92
- data/lib/gloo/verbs/wait.rb +0 -42
@@ -19,7 +19,7 @@ require 'sqlite3'
|
|
19
19
|
|
20
20
|
module Gloo
|
21
21
|
module Objs
|
22
|
-
class Sqlite <
|
22
|
+
class Sqlite < GlooLang::Core::Obj
|
23
23
|
|
24
24
|
KEYWORD = 'sqlite'.freeze
|
25
25
|
KEYWORD_SHORT = 'sqlite'.freeze
|
@@ -63,7 +63,7 @@ module Gloo
|
|
63
63
|
# for default configurations.
|
64
64
|
#
|
65
65
|
def add_default_children
|
66
|
-
fac =
|
66
|
+
fac = @engine.factory
|
67
67
|
fac.create_string DB, DEFAULT_DB, self
|
68
68
|
end
|
69
69
|
|
@@ -84,20 +84,20 @@ module Gloo
|
|
84
84
|
def msg_verify
|
85
85
|
name = db_value
|
86
86
|
if name.empty?
|
87
|
-
|
88
|
-
|
87
|
+
@engine.err DB_REQUIRED_ERR
|
88
|
+
@engine.heap.it.set_to false
|
89
89
|
return
|
90
90
|
end
|
91
91
|
|
92
92
|
unless File.exist? name
|
93
|
-
|
94
|
-
|
93
|
+
@engine.err DB_NOT_FOUND_ERR
|
94
|
+
@engine.heap.it.set_to false
|
95
95
|
return
|
96
96
|
end
|
97
97
|
|
98
98
|
return unless connects?
|
99
99
|
|
100
|
-
|
100
|
+
@engine.heap.it.set_to true
|
101
101
|
end
|
102
102
|
|
103
103
|
# ---------------------------------------------------------------------
|
@@ -111,7 +111,7 @@ module Gloo
|
|
111
111
|
def query( sql, params = nil )
|
112
112
|
name = db_value
|
113
113
|
unless name
|
114
|
-
|
114
|
+
@engine.err DB_REQUIRED_ERR
|
115
115
|
return
|
116
116
|
end
|
117
117
|
|
@@ -147,8 +147,8 @@ module Gloo
|
|
147
147
|
sql = "SELECT COUNT(name) FROM sqlite_master WHERE type='table'"
|
148
148
|
db.get_first_value sql
|
149
149
|
rescue => e
|
150
|
-
|
151
|
-
|
150
|
+
@engine.err e.message
|
151
|
+
@engine.heap.it.set_to false
|
152
152
|
return false
|
153
153
|
end
|
154
154
|
return true
|
data/lib/gloo/objs/dev/git.rb
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
module Gloo
|
8
8
|
module Objs
|
9
|
-
class Git <
|
9
|
+
class Git < GlooLang::Core::Obj
|
10
10
|
|
11
11
|
KEYWORD = 'git_repo'.freeze
|
12
12
|
KEYWORD_SHORT = 'git'.freeze
|
@@ -56,7 +56,7 @@ module Gloo
|
|
56
56
|
branch = branch.strip
|
57
57
|
end
|
58
58
|
|
59
|
-
|
59
|
+
@engine.heap.it.set_to branch
|
60
60
|
end
|
61
61
|
|
62
62
|
#
|
@@ -77,7 +77,7 @@ module Gloo
|
|
77
77
|
path = path_value
|
78
78
|
if path_is_dir?( path )
|
79
79
|
if @params&.token_count&.positive?
|
80
|
-
expr =
|
80
|
+
expr = GlooLang::Expr::Expression.new( @engine, @params.tokens )
|
81
81
|
msg = expr.evaluate
|
82
82
|
end
|
83
83
|
branch = `cd #{path}; git rev-parse --abbrev-ref HEAD`
|
@@ -87,7 +87,7 @@ module Gloo
|
|
87
87
|
psh = 'git push origin '
|
88
88
|
`cd #{path};#{add};#{cmt}"#{msg}";#{psh}#{branch}`
|
89
89
|
end
|
90
|
-
|
90
|
+
@engine.heap.it.set_to msg
|
91
91
|
end
|
92
92
|
|
93
93
|
#
|
@@ -97,7 +97,7 @@ module Gloo
|
|
97
97
|
path = path_value
|
98
98
|
result = `cd #{path}; git status -s` if path_is_dir?( path )
|
99
99
|
result ||= ''
|
100
|
-
|
100
|
+
@engine.heap.it.set_to result
|
101
101
|
end
|
102
102
|
|
103
103
|
#
|
@@ -118,7 +118,7 @@ module Gloo
|
|
118
118
|
result = true unless data.strip.empty?
|
119
119
|
end
|
120
120
|
|
121
|
-
|
121
|
+
@engine.heap.it.set_to result
|
122
122
|
end
|
123
123
|
|
124
124
|
#
|
@@ -132,7 +132,7 @@ module Gloo
|
|
132
132
|
result = File.exist? pn
|
133
133
|
end
|
134
134
|
|
135
|
-
|
135
|
+
@engine.heap.it.set_to result
|
136
136
|
end
|
137
137
|
|
138
138
|
end
|
data/lib/gloo/objs/dev/stats.rb
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
module Gloo
|
8
8
|
module Objs
|
9
|
-
class Stats <
|
9
|
+
class Stats < GlooLang::Core::Obj
|
10
10
|
|
11
11
|
KEYWORD = 'stats'.freeze
|
12
12
|
KEYWORD_SHORT = 'stat'.freeze
|
@@ -72,7 +72,7 @@ module Gloo
|
|
72
72
|
# for default configurations.
|
73
73
|
#
|
74
74
|
def add_default_children
|
75
|
-
fac =
|
75
|
+
fac = @engine.factory
|
76
76
|
fac.create_file FOLDER, '', self
|
77
77
|
fac.create_string TYPES, '', self
|
78
78
|
fac.create_can SKIP, self
|
@@ -95,7 +95,8 @@ module Gloo
|
|
95
95
|
# Show all project stats.
|
96
96
|
#
|
97
97
|
def msg_show_all
|
98
|
-
o =
|
98
|
+
o = GlooLang::Utils::Stats.new(
|
99
|
+
@engine, path_value, types_value, skip_list )
|
99
100
|
o.show_all
|
100
101
|
end
|
101
102
|
|
@@ -103,7 +104,8 @@ module Gloo
|
|
103
104
|
# Show file types.
|
104
105
|
#
|
105
106
|
def msg_show_types
|
106
|
-
o =
|
107
|
+
o = GlooLang::Utils::Stats.new(
|
108
|
+
@engine, path_value, types_value, skip_list )
|
107
109
|
o.file_types
|
108
110
|
end
|
109
111
|
|
@@ -111,7 +113,8 @@ module Gloo
|
|
111
113
|
# Show busy folders: those with the most files.
|
112
114
|
#
|
113
115
|
def msg_show_busy_folders
|
114
|
-
o =
|
116
|
+
o = GlooLang::Utils::Stats.new(
|
117
|
+
@engine, path_value, types_value, skip_list )
|
115
118
|
o.busy_folders
|
116
119
|
end
|
117
120
|
|
data/lib/gloo/objs/snd/play.rb
CHANGED
data/lib/gloo/objs/snd/say.rb
CHANGED
@@ -7,7 +7,7 @@ require 'erb'
|
|
7
7
|
|
8
8
|
module Gloo
|
9
9
|
module Objs
|
10
|
-
class Say <
|
10
|
+
class Say < GlooLang::Core::Obj
|
11
11
|
|
12
12
|
KEYWORD = 'say'.freeze
|
13
13
|
KEYWORD_SHORT = 'say'.freeze
|
@@ -68,7 +68,7 @@ module Gloo
|
|
68
68
|
# for default configurations.
|
69
69
|
#
|
70
70
|
def add_default_children
|
71
|
-
fac =
|
71
|
+
fac = @engine.factory
|
72
72
|
fac.create_string VOICE, '', self
|
73
73
|
fac.create_string MSG, DEFAULT_MSG, self
|
74
74
|
end
|
@@ -7,7 +7,7 @@ require 'tty-pager'
|
|
7
7
|
|
8
8
|
module Gloo
|
9
9
|
module Objs
|
10
|
-
class FileHandle <
|
10
|
+
class FileHandle < GlooLang::Core::Obj
|
11
11
|
|
12
12
|
KEYWORD = 'file'.freeze
|
13
13
|
KEYWORD_SHORT = 'dir'.freeze
|
@@ -47,7 +47,7 @@ module Gloo
|
|
47
47
|
def msg_open
|
48
48
|
return unless value && File.exist?( value )
|
49
49
|
|
50
|
-
cmd =
|
50
|
+
cmd = GlooLang::Core::GlooSystem.open_for_platform
|
51
51
|
cmd_with_param = "#{cmd} \"#{value}\""
|
52
52
|
`#{cmd_with_param}`
|
53
53
|
end
|
@@ -79,11 +79,11 @@ module Gloo
|
|
79
79
|
|
80
80
|
data = File.read( value )
|
81
81
|
if @params&.token_count&.positive?
|
82
|
-
pn =
|
82
|
+
pn = GlooLang::Core::Pn.new( @engine, @params.first )
|
83
83
|
o = pn.resolve
|
84
84
|
o.set_value data
|
85
85
|
else
|
86
|
-
|
86
|
+
@engine.heap.it.set_to data
|
87
87
|
end
|
88
88
|
end
|
89
89
|
|
@@ -95,7 +95,7 @@ module Gloo
|
|
95
95
|
return unless value
|
96
96
|
|
97
97
|
if @params&.token_count&.positive?
|
98
|
-
expr =
|
98
|
+
expr = GlooLang::Expr::Expression.new( @engine, @params.tokens )
|
99
99
|
data = expr.evaluate
|
100
100
|
end
|
101
101
|
File.write( value, data )
|
@@ -106,7 +106,7 @@ module Gloo
|
|
106
106
|
#
|
107
107
|
def msg_check_exists
|
108
108
|
result = File.exist? value
|
109
|
-
|
109
|
+
@engine.heap.it.set_to result
|
110
110
|
end
|
111
111
|
|
112
112
|
#
|
@@ -114,7 +114,7 @@ module Gloo
|
|
114
114
|
#
|
115
115
|
def msg_check_is_file
|
116
116
|
result = File.file? value
|
117
|
-
|
117
|
+
@engine.heap.it.set_to result
|
118
118
|
end
|
119
119
|
|
120
120
|
#
|
@@ -122,7 +122,7 @@ module Gloo
|
|
122
122
|
#
|
123
123
|
def msg_check_is_dir
|
124
124
|
result = File.directory? value
|
125
|
-
|
125
|
+
@engine.heap.it.set_to result
|
126
126
|
end
|
127
127
|
|
128
128
|
#
|
@@ -130,7 +130,7 @@ module Gloo
|
|
130
130
|
#
|
131
131
|
def msg_find_match
|
132
132
|
result = !Dir.glob( value ).empty?
|
133
|
-
|
133
|
+
@engine.heap.it.set_to result
|
134
134
|
end
|
135
135
|
|
136
136
|
end
|
@@ -7,7 +7,7 @@ require 'net/ssh'
|
|
7
7
|
|
8
8
|
module Gloo
|
9
9
|
module Objs
|
10
|
-
class SshExec <
|
10
|
+
class SshExec < GlooLang::Core::Obj
|
11
11
|
|
12
12
|
KEYWORD = 'ssh_exec'.freeze
|
13
13
|
KEYWORD_SHORT = 'ssh'.freeze
|
@@ -50,7 +50,7 @@ module Gloo
|
|
50
50
|
# for default configurations.
|
51
51
|
#
|
52
52
|
def add_default_children
|
53
|
-
fac =
|
53
|
+
fac = @engine.factory
|
54
54
|
fac.create_string HOST, DEFAULT_HOST, self
|
55
55
|
fac.create_string CMD, nil, self
|
56
56
|
fac.create_string RESULT, nil, self
|
@@ -73,7 +73,7 @@ module Gloo
|
|
73
73
|
def msg_run
|
74
74
|
h = host_value
|
75
75
|
unless h
|
76
|
-
|
76
|
+
@engine.err HOST_REQUIRED_ERR
|
77
77
|
return
|
78
78
|
end
|
79
79
|
|
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
module Gloo
|
8
8
|
module Objs
|
9
|
-
class System <
|
9
|
+
class System < GlooLang::Core::Obj
|
10
10
|
|
11
11
|
KEYWORD = 'system'.freeze
|
12
12
|
KEYWORD_SHORT = 'sys'.freeze
|
@@ -81,7 +81,7 @@ module Gloo
|
|
81
81
|
# for default configurations.
|
82
82
|
#
|
83
83
|
def add_default_children
|
84
|
-
fac =
|
84
|
+
fac = @engine.factory
|
85
85
|
fac.create_string CMD, DEFAULT_CMD, self
|
86
86
|
fac.create_bool GET_OUTPUT, true, self
|
87
87
|
fac.create_string RESULT, nil, self
|
data/lib/gloo/verbs/alert.rb
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
module Gloo
|
8
8
|
module Verbs
|
9
|
-
class Alert <
|
9
|
+
class Alert < GlooLang::Core::Verb
|
10
10
|
|
11
11
|
KEYWORD = 'alert'.freeze
|
12
12
|
KEYWORD_SHORT = '!'.freeze
|
@@ -19,18 +19,18 @@ module Gloo
|
|
19
19
|
#
|
20
20
|
def run
|
21
21
|
unless @tokens.token_count > 1
|
22
|
-
|
22
|
+
@engine.err MISSING_EXPR_ERR
|
23
23
|
return
|
24
24
|
end
|
25
25
|
|
26
|
-
expr =
|
26
|
+
expr = GlooLang::Expr::Expression.new( @engine, @tokens.params )
|
27
27
|
result = expr.evaluate
|
28
28
|
|
29
29
|
if result
|
30
|
-
|
30
|
+
@engine.heap.it.set_to result
|
31
31
|
post_alert result
|
32
32
|
else
|
33
|
-
|
33
|
+
@engine.err NO_RESULT_ERR
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
@@ -59,8 +59,8 @@ module Gloo
|
|
59
59
|
# Notice is not posted if we're in quiet mode.
|
60
60
|
#
|
61
61
|
def post_alert( msg )
|
62
|
-
|
63
|
-
return if
|
62
|
+
@engine.log.info msg
|
63
|
+
return if @engine.args.quiet?
|
64
64
|
|
65
65
|
post_osx msg
|
66
66
|
end
|
data/lib/gloo/verbs/beep.rb
CHANGED
data/lib/gloo/verbs/cls.rb
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
module Gloo
|
8
8
|
module Verbs
|
9
|
-
class Cls <
|
9
|
+
class Cls < GlooLang::Core::Verb
|
10
10
|
|
11
11
|
KEYWORD = 'cls'.freeze
|
12
12
|
KEYWORD_SHORT = 'cls'.freeze
|
@@ -15,7 +15,7 @@ module Gloo
|
|
15
15
|
# Run the verb.
|
16
16
|
#
|
17
17
|
def run
|
18
|
-
|
18
|
+
@engine.platform&.clear_screen
|
19
19
|
end
|
20
20
|
|
21
21
|
#
|
data/lib/gloo/verbs/help.rb
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
module Gloo
|
8
8
|
module Verbs
|
9
|
-
class Help <
|
9
|
+
class Help < GlooLang::Core::Verb
|
10
10
|
|
11
11
|
KEYWORD = 'help'.freeze
|
12
12
|
KEYWORD_SHORT = '?'.freeze
|
@@ -30,80 +30,8 @@ module Gloo
|
|
30
30
|
# Run the verb.
|
31
31
|
#
|
32
32
|
def run
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
if opts
|
37
|
-
dispatch opts
|
38
|
-
else
|
39
|
-
$engine.help.page_topic DEFAULT_HELP
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
#
|
44
|
-
# Get the text for the list of verbs.
|
45
|
-
#
|
46
|
-
def get_verb_list
|
47
|
-
out = "Verbs:\n"
|
48
|
-
str = ''
|
49
|
-
verbs = $engine.dictionary.get_verbs.sort_by( &:keyword )
|
50
|
-
verbs.each_with_index do |v, i|
|
51
|
-
cut = v.keyword_shortcut.ljust( 5, ' ' )
|
52
|
-
str << " #{cut} #{v.keyword.ljust( 20, ' ' )}"
|
53
|
-
if ( ( i + 1 ) % 3 ).zero?
|
54
|
-
out << "#{str}\n"
|
55
|
-
str = ''
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
return out
|
60
|
-
end
|
61
|
-
|
62
|
-
#
|
63
|
-
# Lookup the opts in the dispatch table.
|
64
|
-
#
|
65
|
-
def lookup_opts( opts )
|
66
|
-
return DISPATCH[ opts.to_sym ]
|
67
|
-
end
|
68
|
-
|
69
|
-
#
|
70
|
-
# Get the text for the list of verbs.
|
71
|
-
#
|
72
|
-
def get_obj_list
|
73
|
-
out = "Object Types:\n"
|
74
|
-
str = ''
|
75
|
-
objs = $engine.dictionary.get_obj_types.sort_by( &:typename )
|
76
|
-
objs.each_with_index do |o, i|
|
77
|
-
name = o.typename
|
78
|
-
if o.short_typename != o.typename
|
79
|
-
name = "#{name} (#{o.short_typename})"
|
80
|
-
end
|
81
|
-
str << " #{name.ljust( 30, ' ' )}"
|
82
|
-
if ( ( i + 1 ) % 4 ).zero?
|
83
|
-
out << "#{str}\n"
|
84
|
-
str = ''
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
return out
|
89
|
-
end
|
90
|
-
|
91
|
-
#
|
92
|
-
# Get the list of help topics.
|
93
|
-
#
|
94
|
-
def get_topics
|
95
|
-
out = "Help Topics:\n"
|
96
|
-
str = ''
|
97
|
-
objs = $engine.help.topics.keys.sort
|
98
|
-
objs.each_with_index do |o, i|
|
99
|
-
str << " #{o.ljust( 30, ' ' )}"
|
100
|
-
if ( ( i + 1 ) % 4 ).zero?
|
101
|
-
out << "#{str}\n"
|
102
|
-
str = ''
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
return out
|
33
|
+
data = "\n For documentation use the gloo website. \n\n"
|
34
|
+
@engine.log.show data
|
107
35
|
end
|
108
36
|
|
109
37
|
#
|
@@ -126,137 +54,27 @@ module Gloo
|
|
126
54
|
|
127
55
|
private
|
128
56
|
|
129
|
-
#
|
130
|
-
# Report an error with the inline help.
|
131
|
-
#
|
132
|
-
def report_help_error( opts )
|
133
|
-
$engine.err "#{HELP_NOT_FOUND_ERR} '#{opts}'"
|
134
|
-
end
|
135
|
-
|
136
|
-
#
|
137
|
-
# Dispatch the help to the right place.
|
138
|
-
#
|
139
|
-
def dispatch( opts )
|
140
|
-
return if dispatch_help_page( opts )
|
141
|
-
|
142
|
-
$log.debug 'looking for built in help topic'
|
143
|
-
cmd = DISPATCH[ opts.to_sym ]
|
144
|
-
if cmd
|
145
|
-
$log.debug 'found help index'
|
146
|
-
send cmd
|
147
|
-
else
|
148
|
-
$log.debug 'looking for entity help'
|
149
|
-
entity_help opts
|
150
|
-
end
|
151
|
-
rescue
|
152
|
-
report_help_error opts
|
153
|
-
end
|
154
|
-
|
155
|
-
#
|
156
|
-
# Dispatch to a help page if we can find one.
|
157
|
-
#
|
158
|
-
def dispatch_help_page( opts )
|
159
|
-
if $engine.help.topic? opts
|
160
|
-
$log.debug 'found expanded help topic'
|
161
|
-
$engine.help.page_topic opts
|
162
|
-
return true
|
163
|
-
end
|
164
|
-
|
165
|
-
key = $engine.dictionary.lookup_keyword opts
|
166
|
-
if $engine.help.topic? key
|
167
|
-
$log.debug 'found expanded help topic'
|
168
|
-
$engine.help.page_topic key
|
169
|
-
return true
|
170
|
-
end
|
171
|
-
|
172
|
-
return false
|
173
|
-
end
|
174
|
-
|
175
57
|
#
|
176
58
|
# Write output to it and show it unless we are in
|
177
59
|
# silent mode.
|
178
60
|
#
|
179
61
|
def show_output( out )
|
180
|
-
|
181
|
-
puts out unless
|
182
|
-
end
|
183
|
-
|
184
|
-
#
|
185
|
-
# List all help topics (articles)
|
186
|
-
#
|
187
|
-
def show_topics
|
188
|
-
out = self.get_topics
|
189
|
-
show_output out
|
190
|
-
end
|
191
|
-
|
192
|
-
#
|
193
|
-
# Dispatch the help command to a verb or object
|
194
|
-
# if we can find one matching the request.
|
195
|
-
#
|
196
|
-
def entity_help( opts )
|
197
|
-
return if try_verb_help opts
|
198
|
-
return if try_object_help opts
|
199
|
-
|
200
|
-
report_help_error opts
|
201
|
-
end
|
202
|
-
|
203
|
-
#
|
204
|
-
# See if there is a verb we can show help
|
205
|
-
# information about.
|
206
|
-
#
|
207
|
-
def try_verb_help( opts )
|
208
|
-
if $engine.dictionary.verb?( opts )
|
209
|
-
t = $engine.dictionary.find_verb( opts )
|
210
|
-
out = t.send 'help'
|
211
|
-
show_output out
|
212
|
-
return true
|
213
|
-
end
|
214
|
-
|
215
|
-
return false
|
216
|
-
end
|
217
|
-
|
218
|
-
#
|
219
|
-
# See if there is a verb we can show help
|
220
|
-
# information about.
|
221
|
-
#
|
222
|
-
def try_object_help( opts )
|
223
|
-
if $engine.dictionary.obj?( opts )
|
224
|
-
t = $engine.dictionary.find_obj( opts )
|
225
|
-
out = t.send 'help'
|
226
|
-
show_output out
|
227
|
-
return true
|
228
|
-
end
|
229
|
-
|
230
|
-
return false
|
62
|
+
@engine.heap.it.set_to out
|
63
|
+
puts out unless @engine.args.quiet?
|
231
64
|
end
|
232
65
|
|
233
66
|
#
|
234
67
|
# Show application settings.
|
235
68
|
#
|
236
69
|
def show_settings
|
237
|
-
|
70
|
+
@engine.settings.show
|
238
71
|
end
|
239
72
|
|
240
73
|
#
|
241
74
|
# Show all keywords: verbs and objects.
|
242
75
|
#
|
243
76
|
def show_keywords
|
244
|
-
|
245
|
-
end
|
246
|
-
|
247
|
-
#
|
248
|
-
# List the verbs
|
249
|
-
#
|
250
|
-
def show_verbs
|
251
|
-
show_output get_verb_list
|
252
|
-
end
|
253
|
-
|
254
|
-
#
|
255
|
-
# List the object types
|
256
|
-
#
|
257
|
-
def show_objs
|
258
|
-
out = self.get_obj_list
|
259
|
-
show_output out
|
77
|
+
@engine.dictionary.show_keywords
|
260
78
|
end
|
261
79
|
|
262
80
|
end
|
data/lib/gloo/verbs/version.rb
CHANGED
@@ -4,9 +4,9 @@
|
|
4
4
|
# Show the current application version.
|
5
5
|
#
|
6
6
|
|
7
|
-
module
|
7
|
+
module GlooLang
|
8
8
|
module Verbs
|
9
|
-
class Version <
|
9
|
+
class Version < GlooLang::Core::Verb
|
10
10
|
|
11
11
|
KEYWORD = 'version'.freeze
|
12
12
|
KEYWORD_SHORT = 'v'.freeze
|
@@ -15,7 +15,7 @@ module Gloo
|
|
15
15
|
# Run the verb.
|
16
16
|
#
|
17
17
|
def run
|
18
|
-
|
18
|
+
@engine.log.show GlooLang::App::Info.full_version
|
19
19
|
end
|
20
20
|
|
21
21
|
#
|
data/lib/gloo.rb
CHANGED
@@ -12,6 +12,10 @@ module Gloo
|
|
12
12
|
def self.run
|
13
13
|
params = []
|
14
14
|
( params << '--cli' ) if ARGV.count.zero?
|
15
|
-
|
15
|
+
|
16
|
+
platform = Gloo::App::Platform.new
|
17
|
+
context = GlooLang::App::EngineContext.new(
|
18
|
+
params, platform, Gloo::App::Log, nil )
|
19
|
+
GlooLang::App::Engine.new( context ).start
|
16
20
|
end
|
17
21
|
end
|
data/lib/run.rb
CHANGED
@@ -11,4 +11,8 @@ require File.join( path, 'dependencies.rb' )
|
|
11
11
|
|
12
12
|
params = []
|
13
13
|
( params << '--cli' ) if ARGV.count.zero?
|
14
|
-
|
14
|
+
|
15
|
+
platform = Gloo::App::Platform.new
|
16
|
+
context = GlooLang::App::EngineContext.new(
|
17
|
+
params, platform, Gloo::App::Log, nil )
|
18
|
+
GlooLang::App::Engine.new( context ).start
|