gloo 0.8.0 → 1.0.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/.DS_Store +0 -0
- data/Gemfile.lock +32 -28
- data/LICENSE.txt +1 -1
- data/gloo.gemspec +11 -6
- 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/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.rb +5 -1
- data/lib/run.rb +5 -1
- metadata +39 -145
- 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/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/mysql.rb +0 -192
- data/lib/gloo/objs/data/query.rb +0 -176
- data/lib/gloo/objs/data/sqlite.rb +0 -159
- 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/help.rb +0 -264
- 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/version.rb +0 -37
- data/lib/gloo/verbs/wait.rb +0 -42
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: be2491c8754aeb5997318b86f7a6b3f8473178c41aa4af8a36e78b4efcd662e5
|
|
4
|
+
data.tar.gz: bd6ba3f319a58164b3ce7aed2b9a68201fde3a8220407850af1c9eacbddf9311
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c48baf591661121a625dea69ea38e8913e8a01beac350024e7b0844ec9564ee9645900c8ef25b0f1de49f45ea89bffeecd8266c992d3ff34461a9f713f6b819f
|
|
7
|
+
data.tar.gz: c65e8f1c3aa5af175336ad4ea9d97fd224132c59793a58c77850985da0f90bb519370a3a86e24b4486f8defaadb6950af57983936c5c2a9c1680858e69b0c8a9
|
data/.DS_Store
CHANGED
|
Binary file
|
data/Gemfile.lock
CHANGED
|
@@ -1,67 +1,71 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
gloo (0.
|
|
5
|
-
activesupport (~> 6.1, >= 6.1.
|
|
4
|
+
gloo (0.8.0)
|
|
5
|
+
activesupport (~> 6.1, >= 6.1.5)
|
|
6
6
|
chronic (~> 0.10, >= 0.10.2)
|
|
7
7
|
colorize (~> 0.8, >= 0.8.1)
|
|
8
|
+
gloo-lang (~> 1.0, >= 1.0.1)
|
|
8
9
|
json (~> 2.1, >= 2.1.0)
|
|
9
|
-
mysql2 (~> 0.5, >= 0.5.3)
|
|
10
10
|
net-ssh (~> 6.1, >= 6.1.0)
|
|
11
11
|
openssl (~> 2.1, >= 2.1.0)
|
|
12
|
-
|
|
13
|
-
tty (~> 0.8, >= 0.8.1)
|
|
12
|
+
tty (~> 0.10, >= 0.10.0)
|
|
14
13
|
|
|
15
14
|
GEM
|
|
16
15
|
remote: https://rubygems.org/
|
|
17
16
|
specs:
|
|
18
|
-
activesupport (6.1.
|
|
17
|
+
activesupport (6.1.5)
|
|
19
18
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
20
19
|
i18n (>= 1.6, < 2)
|
|
21
20
|
minitest (>= 5.1)
|
|
22
21
|
tzinfo (~> 2.0)
|
|
23
22
|
zeitwerk (~> 2.3)
|
|
24
|
-
ast (2.4.
|
|
23
|
+
ast (2.4.2)
|
|
25
24
|
chronic (0.10.2)
|
|
26
25
|
colorize (0.8.1)
|
|
27
|
-
concurrent-ruby (1.1.
|
|
26
|
+
concurrent-ruby (1.1.10)
|
|
28
27
|
diff-lcs (1.5.0)
|
|
29
28
|
equatable (0.7.0)
|
|
29
|
+
gloo-lang (1.0.1)
|
|
30
|
+
activesupport (~> 6.1, >= 6.1.4.6)
|
|
31
|
+
chronic (~> 0.10, >= 0.10.2)
|
|
32
|
+
json (~> 2.1, >= 2.1.0)
|
|
33
|
+
net-ssh (~> 6.1, >= 6.1.0)
|
|
34
|
+
openssl (~> 2.1, >= 2.1.0)
|
|
35
|
+
tty-platform (~> 0.3, >= 0.3.0)
|
|
30
36
|
i18n (1.10.0)
|
|
31
37
|
concurrent-ruby (~> 1.0)
|
|
32
38
|
ipaddr (1.2.4)
|
|
33
39
|
json (2.6.1)
|
|
34
40
|
kramdown (1.16.2)
|
|
35
|
-
minitest (5.
|
|
36
|
-
mysql2 (0.5.3)
|
|
41
|
+
minitest (5.15.0)
|
|
37
42
|
necromancer (0.5.1)
|
|
38
43
|
net-ssh (6.1.0)
|
|
39
44
|
openssl (2.2.1)
|
|
40
45
|
ipaddr
|
|
41
|
-
parallel (1.
|
|
42
|
-
parser (
|
|
46
|
+
parallel (1.22.0)
|
|
47
|
+
parser (3.1.1.0)
|
|
43
48
|
ast (~> 2.4.1)
|
|
44
49
|
pastel (0.7.4)
|
|
45
50
|
equatable (~> 0.6)
|
|
46
51
|
tty-color (~> 0.5)
|
|
47
|
-
rainbow (3.
|
|
48
|
-
rake (13.0.
|
|
49
|
-
regexp_parser (
|
|
50
|
-
rexml (3.2.
|
|
52
|
+
rainbow (3.1.1)
|
|
53
|
+
rake (13.0.6)
|
|
54
|
+
regexp_parser (2.2.1)
|
|
55
|
+
rexml (3.2.5)
|
|
51
56
|
rouge (3.28.0)
|
|
52
|
-
rubocop (1.
|
|
57
|
+
rubocop (1.26.1)
|
|
53
58
|
parallel (~> 1.10)
|
|
54
|
-
parser (>=
|
|
59
|
+
parser (>= 3.1.0.0)
|
|
55
60
|
rainbow (>= 2.2.2, < 4.0)
|
|
56
|
-
regexp_parser (>= 1.8)
|
|
61
|
+
regexp_parser (>= 1.8, < 3.0)
|
|
57
62
|
rexml
|
|
58
|
-
rubocop-ast (>= 1.0.
|
|
63
|
+
rubocop-ast (>= 1.16.0, < 2.0)
|
|
59
64
|
ruby-progressbar (~> 1.7)
|
|
60
|
-
unicode-display_width (>= 1.4.0, <
|
|
61
|
-
rubocop-ast (1.
|
|
62
|
-
parser (>=
|
|
63
|
-
ruby-progressbar (1.
|
|
64
|
-
sqlite3 (1.4.2)
|
|
65
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
|
66
|
+
rubocop-ast (1.16.0)
|
|
67
|
+
parser (>= 3.1.1.0)
|
|
68
|
+
ruby-progressbar (1.11.0)
|
|
65
69
|
strings (0.1.8)
|
|
66
70
|
strings-ansi (~> 0.1)
|
|
67
71
|
unicode-display_width (~> 1.5)
|
|
@@ -152,7 +156,7 @@ GEM
|
|
|
152
156
|
tty-which (0.5.0)
|
|
153
157
|
tzinfo (2.0.4)
|
|
154
158
|
concurrent-ruby (~> 1.0)
|
|
155
|
-
unicode-display_width (1.
|
|
159
|
+
unicode-display_width (1.8.0)
|
|
156
160
|
unicode_utils (1.4.0)
|
|
157
161
|
wisper (2.0.1)
|
|
158
162
|
zeitwerk (2.5.4)
|
|
@@ -161,9 +165,9 @@ PLATFORMS
|
|
|
161
165
|
ruby
|
|
162
166
|
|
|
163
167
|
DEPENDENCIES
|
|
164
|
-
bundler (~> 1.
|
|
168
|
+
bundler (~> 1.17.3)
|
|
165
169
|
gloo!
|
|
166
|
-
minitest (~> 5.
|
|
170
|
+
minitest (~> 5.1, >= 5.14.2)
|
|
167
171
|
rake (~> 13.0, >= 13.0.1)
|
|
168
172
|
rubocop
|
|
169
173
|
|
data/LICENSE.txt
CHANGED
data/gloo.gemspec
CHANGED
|
@@ -27,20 +27,25 @@ Gem::Specification.new do |spec|
|
|
|
27
27
|
spec.executables << 'o'
|
|
28
28
|
spec.executables << 'gloo'
|
|
29
29
|
|
|
30
|
-
spec.add_development_dependency 'bundler', '~>
|
|
31
|
-
spec.add_development_dependency '
|
|
30
|
+
# spec.add_development_dependency 'bundler', '~> 2.2.22'
|
|
31
|
+
# spec.add_development_dependency 'bundler', '~> 2.3.9'
|
|
32
|
+
spec.add_development_dependency 'bundler', '~> 1.17.3'
|
|
33
|
+
spec.add_development_dependency 'minitest', '~> 5.1', '>= 5.14.2'
|
|
32
34
|
# spec.add_development_dependency 'rake', '~> 10.0'
|
|
33
35
|
spec.add_development_dependency "rake", '~> 13.0', '>= 13.0.1'
|
|
34
36
|
|
|
35
|
-
spec.add_dependency "
|
|
37
|
+
spec.add_dependency "gloo-lang", '~> 1.0', ">= 1.0.1"
|
|
38
|
+
|
|
39
|
+
spec.add_dependency "activesupport", '~> 6.1', ">= 6.1.5"
|
|
40
|
+
# spec.add_dependency "activesupport", '~> 6.1', ">= 6.1.4.6"
|
|
36
41
|
# spec.add_dependency "activesupport", '~> 5.2', ">= 5.2.4.3"
|
|
37
42
|
# spec.add_dependency 'activesupport', '~> 5.2', '>= 5.2.1'
|
|
38
43
|
spec.add_dependency 'chronic', '~> 0.10', '>= 0.10.2'
|
|
39
44
|
spec.add_dependency 'colorize', '~> 0.8', '>= 0.8.1'
|
|
40
|
-
spec.add_dependency 'tty', '~> 0.
|
|
45
|
+
spec.add_dependency 'tty', '~> 0.10', '>= 0.10.0'
|
|
41
46
|
spec.add_dependency 'json', '~> 2.1', '>= 2.1.0'
|
|
42
47
|
spec.add_dependency 'openssl', '~> 2.1', '>= 2.1.0'
|
|
43
48
|
spec.add_dependency 'net-ssh', '~> 6.1', '>= 6.1.0'
|
|
44
|
-
spec.add_dependency 'mysql2', '~> 0.5', '>= 0.5.3'
|
|
45
|
-
spec.add_dependency 'sqlite3', '~> 1.4', '>= 1.4.2'
|
|
49
|
+
# spec.add_dependency 'mysql2', '~> 0.5', '>= 0.5.3'
|
|
50
|
+
# spec.add_dependency 'sqlite3', '~> 1.4', '>= 1.4.2'
|
|
46
51
|
end
|
data/lib/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.
|
|
1
|
+
1.0.0
|
data/lib/dependencies.rb
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
# Script to build a list of dependencies
|
|
3
3
|
#
|
|
4
4
|
|
|
5
|
-
require '
|
|
6
|
-
require '
|
|
5
|
+
require 'gloo_lang/core/baseo'
|
|
6
|
+
require 'gloo_lang/core/obj'
|
|
7
7
|
|
|
8
8
|
path = File.dirname( File.absolute_path( __FILE__ ) )
|
|
9
9
|
|
|
@@ -11,8 +11,8 @@ files = []
|
|
|
11
11
|
#
|
|
12
12
|
# We want to start with these to avoid dependency errors later on.
|
|
13
13
|
#
|
|
14
|
-
files << File.join( path, '
|
|
15
|
-
files << File.join( path, '
|
|
14
|
+
# files << File.join( path, 'gloo_lang', 'core', 'baseo.rb' )
|
|
15
|
+
# files << File.join( path, 'gloo_lang', 'core', 'obj.rb' )
|
|
16
16
|
|
|
17
17
|
root = File.join( path, 'gloo', '**/*.rb' )
|
|
18
18
|
Dir.glob( root ).each do |ruby_file|
|
data/lib/gloo/app/info.rb
CHANGED
data/lib/gloo/app/log.rb
CHANGED
|
@@ -9,35 +9,7 @@ require 'colorized_string'
|
|
|
9
9
|
|
|
10
10
|
module Gloo
|
|
11
11
|
module App
|
|
12
|
-
class Log
|
|
13
|
-
|
|
14
|
-
attr_reader :logger, :quiet
|
|
15
|
-
|
|
16
|
-
#
|
|
17
|
-
# Set up a logger.
|
|
18
|
-
# If quiet is true, then message are written to the log
|
|
19
|
-
# but not to the console.
|
|
20
|
-
#
|
|
21
|
-
def initialize( quiet )
|
|
22
|
-
f = File.join( $settings.log_path, 'gloo.log' )
|
|
23
|
-
@logger = Logger.new( f )
|
|
24
|
-
@logger.level = Logger::DEBUG
|
|
25
|
-
@quiet = quiet
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
#
|
|
29
|
-
# Show a message unless we're in quite mode.
|
|
30
|
-
#
|
|
31
|
-
def show( msg )
|
|
32
|
-
puts msg unless @quiet
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
#
|
|
36
|
-
# Write a debug message to the log.
|
|
37
|
-
#
|
|
38
|
-
def debug( msg )
|
|
39
|
-
@logger.debug msg
|
|
40
|
-
end
|
|
12
|
+
class Log < GlooLang::App::Log
|
|
41
13
|
|
|
42
14
|
#
|
|
43
15
|
# Write an information message to the log.
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# Author:: Eric Crane (mailto:eric.crane@mac.com)
|
|
2
|
+
# Copyright:: Copyright (c) 2022 Eric Crane. All rights reserved.
|
|
3
|
+
#
|
|
4
|
+
# Handle input and output for the CLI platform.
|
|
5
|
+
#
|
|
6
|
+
require 'active_support'
|
|
7
|
+
require 'tty-prompt'
|
|
8
|
+
require 'tty-cursor'
|
|
9
|
+
require 'tty-screen'
|
|
10
|
+
require 'tty-pager'
|
|
11
|
+
require 'tty-markdown'
|
|
12
|
+
require 'tty-editor'
|
|
13
|
+
require 'tty-table'
|
|
14
|
+
require 'colorize'
|
|
15
|
+
require 'colorized_string'
|
|
16
|
+
require 'pastel'
|
|
17
|
+
|
|
18
|
+
module Gloo
|
|
19
|
+
module App
|
|
20
|
+
class Platform < GlooLang::App::Platform
|
|
21
|
+
|
|
22
|
+
DEFAULT_TMP_FILE = 'tmp.txt'.freeze
|
|
23
|
+
|
|
24
|
+
attr_reader :prompt
|
|
25
|
+
|
|
26
|
+
#
|
|
27
|
+
# Set up Platform.
|
|
28
|
+
#
|
|
29
|
+
def initialize
|
|
30
|
+
@prompt = TTY::Prompt.new
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
#
|
|
34
|
+
# Show a message.
|
|
35
|
+
#
|
|
36
|
+
def show( msg, md=false, page=false )
|
|
37
|
+
if md
|
|
38
|
+
msg = TTY::Markdown.parse msg
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
if page
|
|
42
|
+
# pager = TTY::Pager::SystemPager.new command: 'less -R'
|
|
43
|
+
pager = TTY::Pager.new
|
|
44
|
+
pager.page( msg )
|
|
45
|
+
else
|
|
46
|
+
puts msg
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
#
|
|
51
|
+
# Prompt for the next command.
|
|
52
|
+
#
|
|
53
|
+
def prompt_cmd
|
|
54
|
+
return @prompt.ask( default_prompt )
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
#
|
|
58
|
+
# Clear the screen.
|
|
59
|
+
#
|
|
60
|
+
def clear_screen
|
|
61
|
+
@cursor ||= TTY::Cursor
|
|
62
|
+
print @cursor.clear_screen
|
|
63
|
+
print @cursor.move_to( 0, 0 )
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
#
|
|
67
|
+
# Edit some temporary text and return the edited text.
|
|
68
|
+
#
|
|
69
|
+
def edit initial_value
|
|
70
|
+
tmp = File.join( $settings.tmp_path, DEFAULT_TMP_FILE )
|
|
71
|
+
File.open( tmp, 'w' ) { |file| file.write( initial_value ) }
|
|
72
|
+
TTY::Editor.open( tmp )
|
|
73
|
+
return File.read( tmp )
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
# ---------------------------------------------------------------------
|
|
77
|
+
# Table helper
|
|
78
|
+
# ---------------------------------------------------------------------
|
|
79
|
+
|
|
80
|
+
#
|
|
81
|
+
# Show the given table data.
|
|
82
|
+
#
|
|
83
|
+
def show_table( headers, data, title = nil )
|
|
84
|
+
pastel = ::Pastel.new
|
|
85
|
+
if headers
|
|
86
|
+
table = TTY::Table.new headers, data
|
|
87
|
+
else
|
|
88
|
+
table = TTY::Table.new rows: data
|
|
89
|
+
end
|
|
90
|
+
pad = [ 0, 1, 0, 1 ]
|
|
91
|
+
rendered = table.render( :ascii, indent: 2, padding: pad ) do |r|
|
|
92
|
+
r.border.style = :blue
|
|
93
|
+
r.filter = proc do |val, row_index, _col_index|
|
|
94
|
+
# col_index % 2 == 1 ? pastel.red.on_green(val) : val
|
|
95
|
+
if headers && row_index.zero?
|
|
96
|
+
pastel.blue( val )
|
|
97
|
+
else
|
|
98
|
+
row_index.odd? ? pastel.white( val ) : pastel.yellow( val )
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
puts
|
|
103
|
+
puts "#{title.white}" if title
|
|
104
|
+
puts "#{rendered}\n\n"
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
# ---------------------------------------------------------------------
|
|
108
|
+
# Sceen helpers
|
|
109
|
+
# ---------------------------------------------------------------------
|
|
110
|
+
#
|
|
111
|
+
# Get the number of vertical lines on screen.
|
|
112
|
+
#
|
|
113
|
+
def lines
|
|
114
|
+
TTY::Screen.rows
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
#
|
|
118
|
+
# Get the number of horizontal columns on screen.
|
|
119
|
+
#
|
|
120
|
+
def cols
|
|
121
|
+
TTY::Screen.cols
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
# ---------------------------------------------------------------------
|
|
125
|
+
# Private Functions
|
|
126
|
+
# ---------------------------------------------------------------------
|
|
127
|
+
|
|
128
|
+
private
|
|
129
|
+
|
|
130
|
+
#
|
|
131
|
+
# Get the default prompt text.
|
|
132
|
+
#
|
|
133
|
+
def default_prompt
|
|
134
|
+
dt = DateTime.now
|
|
135
|
+
d = dt.strftime( '%Y.%m.%d' )
|
|
136
|
+
t = dt.strftime( '%I:%M:%S' )
|
|
137
|
+
return "#{'gloo'.blue} #{d.yellow} #{t.white} >"
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
end
|
|
141
|
+
end
|
|
142
|
+
end
|
data/lib/gloo/objs/cli/banner.rb
CHANGED
|
@@ -8,7 +8,7 @@ require 'pastel'
|
|
|
8
8
|
|
|
9
9
|
module Gloo
|
|
10
10
|
module Objs
|
|
11
|
-
class Banner <
|
|
11
|
+
class Banner < GlooLang::Core::Obj
|
|
12
12
|
|
|
13
13
|
KEYWORD = 'banner'.freeze
|
|
14
14
|
KEYWORD_SHORT = 'ban'.freeze
|
|
@@ -75,7 +75,7 @@ module Gloo
|
|
|
75
75
|
# This is used by containers to add children needed
|
|
76
76
|
# for default configurations.
|
|
77
77
|
def add_default_children
|
|
78
|
-
fac =
|
|
78
|
+
fac = @engine.factory
|
|
79
79
|
fac.create_string TEXT, '', self
|
|
80
80
|
fac.create_string STYLE, '', self
|
|
81
81
|
fac.create_string COLOR, '', self
|
data/lib/gloo/objs/cli/bar.rb
CHANGED
|
@@ -7,7 +7,7 @@ require 'tty-progressbar'
|
|
|
7
7
|
|
|
8
8
|
module Gloo
|
|
9
9
|
module Objs
|
|
10
|
-
class Bar <
|
|
10
|
+
class Bar < GlooLang::Core::Obj
|
|
11
11
|
|
|
12
12
|
KEYWORD = 'bar'.freeze
|
|
13
13
|
KEYWORD_SHORT = 'bar'.freeze
|
|
@@ -63,7 +63,7 @@ module Gloo
|
|
|
63
63
|
# This is used by containers to add children needed
|
|
64
64
|
# for default configurations.
|
|
65
65
|
def add_default_children
|
|
66
|
-
fac =
|
|
66
|
+
fac = @engine.factory
|
|
67
67
|
fac.create_string NAME, '', self
|
|
68
68
|
fac.create_int TOTAL, 100, self
|
|
69
69
|
end
|
|
@@ -100,7 +100,7 @@ module Gloo
|
|
|
100
100
|
def msg_advance
|
|
101
101
|
x = 1
|
|
102
102
|
if @params&.token_count&.positive?
|
|
103
|
-
expr =
|
|
103
|
+
expr = GlooLang::Expr::Expression.new( @engine, @params.tokens )
|
|
104
104
|
x = expr.evaluate.to_i
|
|
105
105
|
end
|
|
106
106
|
|
|
@@ -116,7 +116,7 @@ module Gloo
|
|
|
116
116
|
|
|
117
117
|
x = 1
|
|
118
118
|
if @params&.token_count&.positive?
|
|
119
|
-
expr =
|
|
119
|
+
expr = GlooLang::Expr::Expression.new( @engine, @params.tokens )
|
|
120
120
|
x = expr.evaluate.to_i
|
|
121
121
|
end
|
|
122
122
|
|
|
@@ -7,7 +7,7 @@ require 'colorized_string'
|
|
|
7
7
|
|
|
8
8
|
module Gloo
|
|
9
9
|
module Objs
|
|
10
|
-
class Colorize <
|
|
10
|
+
class Colorize < GlooLang::Core::Obj
|
|
11
11
|
|
|
12
12
|
KEYWORD = 'colorize'.freeze
|
|
13
13
|
KEYWORD_SHORT = 'color'.freeze
|
|
@@ -41,7 +41,7 @@ module Gloo
|
|
|
41
41
|
# This is used by containers to add children needed
|
|
42
42
|
# for default configurations.
|
|
43
43
|
def add_default_children
|
|
44
|
-
fac =
|
|
44
|
+
fac = @engine.factory
|
|
45
45
|
fac.create_string 'white', '', self
|
|
46
46
|
end
|
|
47
47
|
|
|
@@ -65,7 +65,7 @@ module Gloo
|
|
|
65
65
|
msg += ColorizedString[ o.value_display ].colorize( o.name.to_sym )
|
|
66
66
|
end
|
|
67
67
|
$log.show msg
|
|
68
|
-
|
|
68
|
+
@engine.heap.it.set_to msg.to_s
|
|
69
69
|
end
|
|
70
70
|
|
|
71
71
|
end
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
module Gloo
|
|
8
8
|
module Objs
|
|
9
|
-
class Confirm <
|
|
9
|
+
class Confirm < GlooLang::Core::Obj
|
|
10
10
|
|
|
11
11
|
KEYWORD = 'confirm'.freeze
|
|
12
12
|
KEYWORD_SHORT = 'confirm'.freeze
|
|
@@ -64,7 +64,7 @@ module Gloo
|
|
|
64
64
|
# This is used by containers to add children needed
|
|
65
65
|
# for default configurations.
|
|
66
66
|
def add_default_children
|
|
67
|
-
fac =
|
|
67
|
+
fac = @engine.factory
|
|
68
68
|
fac.create_string PROMPT, DEFAULT_PROMPT, self
|
|
69
69
|
fac.create_bool RESULT, nil, self
|
|
70
70
|
end
|
|
@@ -87,7 +87,7 @@ module Gloo
|
|
|
87
87
|
prompt = prompt_value
|
|
88
88
|
return unless prompt
|
|
89
89
|
|
|
90
|
-
result =
|
|
90
|
+
result = @engine.platform.prompt.yes?( prompt )
|
|
91
91
|
set_result result
|
|
92
92
|
end
|
|
93
93
|
|
data/lib/gloo/objs/cli/menu.rb
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
module Gloo
|
|
10
10
|
module Objs
|
|
11
|
-
class Menu <
|
|
11
|
+
class Menu < GlooLang::Core::Obj
|
|
12
12
|
|
|
13
13
|
KEYWORD = 'menu'.freeze
|
|
14
14
|
KEYWORD_SHORT = 'menu'.freeze
|
|
@@ -74,7 +74,7 @@ module Gloo
|
|
|
74
74
|
# for default configurations.
|
|
75
75
|
#
|
|
76
76
|
def add_default_children
|
|
77
|
-
fac =
|
|
77
|
+
fac = @engine.factory
|
|
78
78
|
fac.create_string PROMPT, '> ', self
|
|
79
79
|
fac.create_can ITEMS, self
|
|
80
80
|
fac.create_bool LOOP, true, self
|
|
@@ -102,9 +102,9 @@ module Gloo
|
|
|
102
102
|
dt = DateTime.now
|
|
103
103
|
d = dt.strftime( '%Y.%m.%d' )
|
|
104
104
|
t = dt.strftime( '%I:%M:%S' )
|
|
105
|
-
cmd =
|
|
105
|
+
cmd = @engine.platform.prompt.ask( "#{d.yellow} #{t.white} >" )
|
|
106
106
|
else
|
|
107
|
-
cmd =
|
|
107
|
+
cmd = @engine.platform.prompt.ask( prompt_value )
|
|
108
108
|
end
|
|
109
109
|
cmd ? run_command( cmd ) : run_default
|
|
110
110
|
break unless loop?
|
|
@@ -137,7 +137,7 @@ module Gloo
|
|
|
137
137
|
o = find_child BEFORE_MENU
|
|
138
138
|
return unless o
|
|
139
139
|
|
|
140
|
-
|
|
140
|
+
GlooLang::Exec::Dispatch.message( @engine, 'run', o )
|
|
141
141
|
end
|
|
142
142
|
|
|
143
143
|
#
|
|
@@ -148,7 +148,7 @@ module Gloo
|
|
|
148
148
|
return unless o
|
|
149
149
|
|
|
150
150
|
o.children.each do |mitem|
|
|
151
|
-
mitem =
|
|
151
|
+
mitem = GlooLang::Objs::Alias.resolve_alias( @engine, mitem )
|
|
152
152
|
puts " #{mitem.shortcut_value} - #{mitem.description_value}"
|
|
153
153
|
end
|
|
154
154
|
end
|
|
@@ -161,7 +161,7 @@ module Gloo
|
|
|
161
161
|
return nil unless o
|
|
162
162
|
|
|
163
163
|
o.children.each do |mitem|
|
|
164
|
-
mitem =
|
|
164
|
+
mitem = GlooLang::Objs::Alias.resolve_alias( @engine, mitem )
|
|
165
165
|
return mitem if mitem.shortcut_value.downcase == cmd.downcase
|
|
166
166
|
end
|
|
167
167
|
|
|
@@ -175,7 +175,7 @@ module Gloo
|
|
|
175
175
|
obj = find_child DEFAULT
|
|
176
176
|
return unless obj
|
|
177
177
|
|
|
178
|
-
s =
|
|
178
|
+
s = GlooLang::Exec::Script.new( @engine, obj )
|
|
179
179
|
s.run
|
|
180
180
|
end
|
|
181
181
|
|
|
@@ -197,7 +197,7 @@ module Gloo
|
|
|
197
197
|
script = obj.do_script
|
|
198
198
|
return unless script
|
|
199
199
|
|
|
200
|
-
s =
|
|
200
|
+
s = GlooLang::Exec::Script.new( @engine, script )
|
|
201
201
|
s.run
|
|
202
202
|
end
|
|
203
203
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
module Gloo
|
|
8
8
|
module Objs
|
|
9
|
-
class MenuItem <
|
|
9
|
+
class MenuItem < GlooLang::Core::Obj
|
|
10
10
|
|
|
11
11
|
KEYWORD = 'menu_item'.freeze
|
|
12
12
|
KEYWORD_SHORT = 'mitem'.freeze
|
|
@@ -73,7 +73,7 @@ module Gloo
|
|
|
73
73
|
# This is used by containers to add children needed
|
|
74
74
|
# for default configurations.
|
|
75
75
|
def add_default_children
|
|
76
|
-
fac =
|
|
76
|
+
fac = @engine.factory
|
|
77
77
|
fac.create_string SHORTCUT, '', self
|
|
78
78
|
fac.create_string DESCRIPTION, '', self
|
|
79
79
|
fac.create_script DO, '', self
|
data/lib/gloo/objs/cli/pastel.rb
CHANGED
|
@@ -7,7 +7,7 @@ require 'pastel'
|
|
|
7
7
|
|
|
8
8
|
module Gloo
|
|
9
9
|
module Objs
|
|
10
|
-
class Pastel <
|
|
10
|
+
class Pastel < GlooLang::Core::Obj
|
|
11
11
|
|
|
12
12
|
KEYWORD = 'pastel'.freeze
|
|
13
13
|
KEYWORD_SHORT = 'pastel'.freeze
|
|
@@ -67,7 +67,7 @@ module Gloo
|
|
|
67
67
|
# for default configurations.
|
|
68
68
|
#
|
|
69
69
|
def add_default_children
|
|
70
|
-
fac =
|
|
70
|
+
fac = @engine.factory
|
|
71
71
|
fac.create_string TEXT, '', self
|
|
72
72
|
fac.create_string COLOR, '', self
|
|
73
73
|
end
|
data/lib/gloo/objs/cli/prompt.rb
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
module Gloo
|
|
8
8
|
module Objs
|
|
9
|
-
class Prompt <
|
|
9
|
+
class Prompt < GlooLang::Core::Obj
|
|
10
10
|
|
|
11
11
|
KEYWORD = 'prompt'.freeze
|
|
12
12
|
KEYWORD_SHORT = 'ask'.freeze
|
|
@@ -67,7 +67,7 @@ module Gloo
|
|
|
67
67
|
# for default configurations.
|
|
68
68
|
#
|
|
69
69
|
def add_default_children
|
|
70
|
-
fac =
|
|
70
|
+
fac = @engine.factory
|
|
71
71
|
fac.create_string PROMPT, '>', self
|
|
72
72
|
fac.create_string RESULT, nil, self
|
|
73
73
|
end
|
|
@@ -90,7 +90,7 @@ module Gloo
|
|
|
90
90
|
prompt = prompt_value
|
|
91
91
|
return unless prompt
|
|
92
92
|
|
|
93
|
-
result =
|
|
93
|
+
result = @engine.platform.prompt.multiline( prompt )
|
|
94
94
|
set_result result.join
|
|
95
95
|
end
|
|
96
96
|
|
|
@@ -101,7 +101,7 @@ module Gloo
|
|
|
101
101
|
prompt = prompt_value
|
|
102
102
|
return unless prompt
|
|
103
103
|
|
|
104
|
-
result =
|
|
104
|
+
result = @engine.platform.prompt.ask( prompt )
|
|
105
105
|
set_result result
|
|
106
106
|
end
|
|
107
107
|
|
data/lib/gloo/objs/cli/select.rb
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
module Gloo
|
|
8
8
|
module Objs
|
|
9
|
-
class Select <
|
|
9
|
+
class Select < GlooLang::Core::Obj
|
|
10
10
|
|
|
11
11
|
KEYWORD = 'select'.freeze
|
|
12
12
|
KEYWORD_SHORT = 'sel'.freeze
|
|
@@ -92,7 +92,7 @@ module Gloo
|
|
|
92
92
|
# for default configurations.
|
|
93
93
|
#
|
|
94
94
|
def add_default_children
|
|
95
|
-
fac =
|
|
95
|
+
fac = @engine.factory
|
|
96
96
|
fac.create_string PROMPT, '>', self
|
|
97
97
|
fac.create_can OPTIONS, self
|
|
98
98
|
fac.create_string RESULT, nil, self
|
|
@@ -116,8 +116,8 @@ module Gloo
|
|
|
116
116
|
prompt = prompt_value
|
|
117
117
|
return unless prompt
|
|
118
118
|
|
|
119
|
-
per =
|
|
120
|
-
result =
|
|
119
|
+
per = GlooLang::App::Settings.page_size( @engine )
|
|
120
|
+
result = @engine.platform.prompt.select( prompt, options, :per_page => per )
|
|
121
121
|
set_result self.key_for_option( result )
|
|
122
122
|
end
|
|
123
123
|
|