gloo 0.7.6 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (125) hide show
  1. checksums.yaml +4 -4
  2. data/.DS_Store +0 -0
  3. data/Gemfile.lock +46 -39
  4. data/LICENSE.txt +1 -1
  5. data/gloo.gemspec +12 -6
  6. data/lib/VERSION +1 -1
  7. data/lib/dependencies.rb +28 -0
  8. data/lib/gloo/app/info.rb +3 -1
  9. data/lib/gloo/app/log.rb +1 -29
  10. data/lib/gloo/app/platform.rb +142 -0
  11. data/lib/gloo/objs/cli/banner.rb +2 -2
  12. data/lib/gloo/objs/cli/bar.rb +4 -4
  13. data/lib/gloo/objs/cli/colorize.rb +3 -3
  14. data/lib/gloo/objs/cli/confirm.rb +3 -3
  15. data/lib/gloo/objs/cli/menu.rb +9 -9
  16. data/lib/gloo/objs/cli/menu_item.rb +2 -2
  17. data/lib/gloo/objs/cli/pastel.rb +2 -2
  18. data/lib/gloo/objs/cli/prompt.rb +4 -4
  19. data/lib/gloo/objs/cli/select.rb +4 -4
  20. data/lib/gloo/objs/dev/git.rb +7 -7
  21. data/lib/gloo/objs/dev/stats.rb +8 -5
  22. data/lib/gloo/objs/snd/play.rb +1 -1
  23. data/lib/gloo/objs/snd/say.rb +2 -2
  24. data/lib/gloo/objs/system/file_handle.rb +9 -9
  25. data/lib/gloo/objs/system/ssh_exec.rb +3 -3
  26. data/lib/gloo/objs/system/system.rb +2 -2
  27. data/lib/gloo/verbs/alert.rb +7 -7
  28. data/lib/gloo/verbs/beep.rb +1 -1
  29. data/lib/gloo/verbs/cls.rb +2 -2
  30. data/lib/gloo.rb +7 -7
  31. data/lib/run.rb +7 -5
  32. metadata +42 -147
  33. data/lib/gloo/app/args.rb +0 -112
  34. data/lib/gloo/app/engine.rb +0 -230
  35. data/lib/gloo/app/help.rb +0 -156
  36. data/lib/gloo/app/mode.rb +0 -27
  37. data/lib/gloo/app/settings.rb +0 -186
  38. data/lib/gloo/convert/converter.rb +0 -35
  39. data/lib/gloo/convert/string_to_datetime.rb +0 -21
  40. data/lib/gloo/convert/string_to_decimal.rb +0 -20
  41. data/lib/gloo/convert/string_to_integer.rb +0 -20
  42. data/lib/gloo/core/baseo.rb +0 -28
  43. data/lib/gloo/core/dictionary.rb +0 -181
  44. data/lib/gloo/core/error.rb +0 -61
  45. data/lib/gloo/core/event_manager.rb +0 -44
  46. data/lib/gloo/core/factory.rb +0 -210
  47. data/lib/gloo/core/gloo_system.rb +0 -266
  48. data/lib/gloo/core/heap.rb +0 -52
  49. data/lib/gloo/core/here.rb +0 -36
  50. data/lib/gloo/core/it.rb +0 -36
  51. data/lib/gloo/core/literal.rb +0 -30
  52. data/lib/gloo/core/obj.rb +0 -305
  53. data/lib/gloo/core/obj_finder.rb +0 -30
  54. data/lib/gloo/core/op.rb +0 -40
  55. data/lib/gloo/core/parser.rb +0 -59
  56. data/lib/gloo/core/pn.rb +0 -188
  57. data/lib/gloo/core/tokens.rb +0 -165
  58. data/lib/gloo/core/verb.rb +0 -86
  59. data/lib/gloo/exec/action.rb +0 -48
  60. data/lib/gloo/exec/dispatch.rb +0 -40
  61. data/lib/gloo/exec/exec_env.rb +0 -74
  62. data/lib/gloo/exec/runner.rb +0 -45
  63. data/lib/gloo/exec/script.rb +0 -49
  64. data/lib/gloo/exec/stack.rb +0 -78
  65. data/lib/gloo/expr/expression.rb +0 -118
  66. data/lib/gloo/expr/l_boolean.rb +0 -36
  67. data/lib/gloo/expr/l_decimal.rb +0 -39
  68. data/lib/gloo/expr/l_integer.rb +0 -37
  69. data/lib/gloo/expr/l_string.rb +0 -58
  70. data/lib/gloo/expr/op_div.rb +0 -22
  71. data/lib/gloo/expr/op_minus.rb +0 -22
  72. data/lib/gloo/expr/op_mult.rb +0 -22
  73. data/lib/gloo/expr/op_plus.rb +0 -24
  74. data/lib/gloo/objs/basic/alias.rb +0 -78
  75. data/lib/gloo/objs/basic/boolean.rb +0 -120
  76. data/lib/gloo/objs/basic/container.rb +0 -76
  77. data/lib/gloo/objs/basic/decimal.rb +0 -76
  78. data/lib/gloo/objs/basic/integer.rb +0 -73
  79. data/lib/gloo/objs/basic/script.rb +0 -99
  80. data/lib/gloo/objs/basic/string.rb +0 -77
  81. data/lib/gloo/objs/basic/text.rb +0 -87
  82. data/lib/gloo/objs/basic/untyped.rb +0 -41
  83. data/lib/gloo/objs/ctrl/each.rb +0 -279
  84. data/lib/gloo/objs/ctrl/repeat.rb +0 -108
  85. data/lib/gloo/objs/data/markdown.rb +0 -84
  86. data/lib/gloo/objs/data/mysql.rb +0 -192
  87. data/lib/gloo/objs/data/query.rb +0 -176
  88. data/lib/gloo/objs/data/sqlite.rb +0 -159
  89. data/lib/gloo/objs/data/table.rb +0 -140
  90. data/lib/gloo/objs/dt/date.rb +0 -50
  91. data/lib/gloo/objs/dt/datetime.rb +0 -62
  92. data/lib/gloo/objs/dt/time.rb +0 -50
  93. data/lib/gloo/objs/ror/erb.rb +0 -116
  94. data/lib/gloo/objs/ror/eval.rb +0 -107
  95. data/lib/gloo/objs/web/http_get.rb +0 -159
  96. data/lib/gloo/objs/web/http_post.rb +0 -183
  97. data/lib/gloo/objs/web/json.rb +0 -135
  98. data/lib/gloo/objs/web/slack.rb +0 -130
  99. data/lib/gloo/objs/web/teams.rb +0 -117
  100. data/lib/gloo/objs/web/uri.rb +0 -148
  101. data/lib/gloo/persist/file_loader.rb +0 -191
  102. data/lib/gloo/persist/file_saver.rb +0 -49
  103. data/lib/gloo/persist/file_storage.rb +0 -45
  104. data/lib/gloo/persist/line_splitter.rb +0 -81
  105. data/lib/gloo/persist/persist_man.rb +0 -120
  106. data/lib/gloo/utils/format.rb +0 -21
  107. data/lib/gloo/utils/stats.rb +0 -205
  108. data/lib/gloo/utils/words.rb +0 -19
  109. data/lib/gloo/verbs/context.rb +0 -62
  110. data/lib/gloo/verbs/create.rb +0 -68
  111. data/lib/gloo/verbs/execute.rb +0 -56
  112. data/lib/gloo/verbs/help.rb +0 -264
  113. data/lib/gloo/verbs/if.rb +0 -92
  114. data/lib/gloo/verbs/list.rb +0 -98
  115. data/lib/gloo/verbs/load.rb +0 -45
  116. data/lib/gloo/verbs/move.rb +0 -89
  117. data/lib/gloo/verbs/put.rb +0 -94
  118. data/lib/gloo/verbs/quit.rb +0 -40
  119. data/lib/gloo/verbs/run.rb +0 -75
  120. data/lib/gloo/verbs/save.rb +0 -39
  121. data/lib/gloo/verbs/show.rb +0 -64
  122. data/lib/gloo/verbs/tell.rb +0 -79
  123. data/lib/gloo/verbs/unless.rb +0 -92
  124. data/lib/gloo/verbs/version.rb +0 -37
  125. data/lib/gloo/verbs/wait.rb +0 -42
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 23d506b2792a56c4a1d39865e3c68fa07505f2390ab8e1df3529e00d57ad3154
4
- data.tar.gz: c0e0088c3a0ae17349e7f1cf3690743f9c55cfc4a127f58b09b237b577f4f6b9
3
+ metadata.gz: be2491c8754aeb5997318b86f7a6b3f8473178c41aa4af8a36e78b4efcd662e5
4
+ data.tar.gz: bd6ba3f319a58164b3ce7aed2b9a68201fde3a8220407850af1c9eacbddf9311
5
5
  SHA512:
6
- metadata.gz: 0e6965451d72d2195e99d089186fcf159149fed4766d55b74e7729706b27f2a2bed3c1e95dab3d03a47c1b347bee43de5490d73b767a8f168874fcdd30c50e72
7
- data.tar.gz: 0a702520842c8091a0d7379875ae28f7b89ed48b79de0dc4e30aaed7ced8a0ffa9d6eebfa9a46604cd6320c4e5519a9229569e6534d6fba868321bc27f8bdcc8
6
+ metadata.gz: c48baf591661121a625dea69ea38e8913e8a01beac350024e7b0844ec9564ee9645900c8ef25b0f1de49f45ea89bffeecd8266c992d3ff34461a9f713f6b819f
7
+ data.tar.gz: c65e8f1c3aa5af175336ad4ea9d97fd224132c59793a58c77850985da0f90bb519370a3a86e24b4486f8defaadb6950af57983936c5c2a9c1680858e69b0c8a9
data/.DS_Store CHANGED
Binary file
data/Gemfile.lock CHANGED
@@ -1,71 +1,77 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gloo (0.7.6)
5
- activesupport (~> 5.2, >= 5.2.4.3)
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
- sqlite3 (~> 1.4, >= 1.4.2)
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 (5.2.6)
17
+ activesupport (6.1.5)
19
18
  concurrent-ruby (~> 1.0, >= 1.0.2)
20
- i18n (>= 0.7, < 2)
21
- minitest (~> 5.1)
22
- tzinfo (~> 1.1)
23
- ast (2.4.1)
19
+ i18n (>= 1.6, < 2)
20
+ minitest (>= 5.1)
21
+ tzinfo (~> 2.0)
22
+ zeitwerk (~> 2.3)
23
+ ast (2.4.2)
24
24
  chronic (0.10.2)
25
25
  colorize (0.8.1)
26
- concurrent-ruby (1.1.9)
27
- diff-lcs (1.4.4)
26
+ concurrent-ruby (1.1.10)
27
+ diff-lcs (1.5.0)
28
28
  equatable (0.7.0)
29
- i18n (1.8.11)
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)
36
+ i18n (1.10.0)
30
37
  concurrent-ruby (~> 1.0)
31
- json (2.5.1)
38
+ ipaddr (1.2.4)
39
+ json (2.6.1)
32
40
  kramdown (1.16.2)
33
- minitest (5.14.2)
34
- mysql2 (0.5.3)
41
+ minitest (5.15.0)
35
42
  necromancer (0.5.1)
36
43
  net-ssh (6.1.0)
37
- openssl (2.2.0)
38
- parallel (1.19.2)
39
- parser (2.7.2.0)
44
+ openssl (2.2.1)
45
+ ipaddr
46
+ parallel (1.22.0)
47
+ parser (3.1.1.0)
40
48
  ast (~> 2.4.1)
41
49
  pastel (0.7.4)
42
50
  equatable (~> 0.6)
43
51
  tty-color (~> 0.5)
44
- rainbow (3.0.0)
45
- rake (13.0.1)
46
- regexp_parser (1.8.2)
47
- rexml (3.2.4)
48
- rouge (3.26.1)
49
- rubocop (1.2.0)
52
+ rainbow (3.1.1)
53
+ rake (13.0.6)
54
+ regexp_parser (2.2.1)
55
+ rexml (3.2.5)
56
+ rouge (3.28.0)
57
+ rubocop (1.26.1)
50
58
  parallel (~> 1.10)
51
- parser (>= 2.7.1.5)
59
+ parser (>= 3.1.0.0)
52
60
  rainbow (>= 2.2.2, < 4.0)
53
- regexp_parser (>= 1.8)
61
+ regexp_parser (>= 1.8, < 3.0)
54
62
  rexml
55
- rubocop-ast (>= 1.0.1)
63
+ rubocop-ast (>= 1.16.0, < 2.0)
56
64
  ruby-progressbar (~> 1.7)
57
- unicode-display_width (>= 1.4.0, < 2.0)
58
- rubocop-ast (1.1.1)
59
- parser (>= 2.7.1.5)
60
- ruby-progressbar (1.10.1)
61
- 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)
62
69
  strings (0.1.8)
63
70
  strings-ansi (~> 0.1)
64
71
  unicode-display_width (~> 1.5)
65
72
  unicode_utils (~> 1.4)
66
73
  strings-ansi (0.2.0)
67
74
  thor (0.20.3)
68
- thread_safe (0.3.6)
69
75
  tty (0.10.0)
70
76
  bundler (~> 1.16, < 2.0)
71
77
  equatable (~> 0.5)
@@ -148,19 +154,20 @@ GEM
148
154
  tty-screen (~> 0.7)
149
155
  tty-tree (0.4.0)
150
156
  tty-which (0.5.0)
151
- tzinfo (1.2.9)
152
- thread_safe (~> 0.1)
153
- unicode-display_width (1.7.0)
157
+ tzinfo (2.0.4)
158
+ concurrent-ruby (~> 1.0)
159
+ unicode-display_width (1.8.0)
154
160
  unicode_utils (1.4.0)
155
161
  wisper (2.0.1)
162
+ zeitwerk (2.5.4)
156
163
 
157
164
  PLATFORMS
158
165
  ruby
159
166
 
160
167
  DEPENDENCIES
161
- bundler (~> 1.16)
168
+ bundler (~> 1.17.3)
162
169
  gloo!
163
- minitest (~> 5.0)
170
+ minitest (~> 5.1, >= 5.14.2)
164
171
  rake (~> 13.0, >= 13.0.1)
165
172
  rubocop
166
173
 
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2018 Eric Crane
3
+ Copyright (c) 2022 Eric Crane
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/gloo.gemspec CHANGED
@@ -27,19 +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', '~> 1.16'
31
- spec.add_development_dependency 'minitest', '~> 5.0'
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 "activesupport", '~> 5.2', ">= 5.2.4.3"
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"
41
+ # spec.add_dependency "activesupport", '~> 5.2', ">= 5.2.4.3"
36
42
  # spec.add_dependency 'activesupport', '~> 5.2', '>= 5.2.1'
37
43
  spec.add_dependency 'chronic', '~> 0.10', '>= 0.10.2'
38
44
  spec.add_dependency 'colorize', '~> 0.8', '>= 0.8.1'
39
- spec.add_dependency 'tty', '~> 0.8', '>= 0.8.1'
45
+ spec.add_dependency 'tty', '~> 0.10', '>= 0.10.0'
40
46
  spec.add_dependency 'json', '~> 2.1', '>= 2.1.0'
41
47
  spec.add_dependency 'openssl', '~> 2.1', '>= 2.1.0'
42
48
  spec.add_dependency 'net-ssh', '~> 6.1', '>= 6.1.0'
43
- spec.add_dependency 'mysql2', '~> 0.5', '>= 0.5.3'
44
- 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'
45
51
  end
data/lib/VERSION CHANGED
@@ -1 +1 @@
1
- 0.7.6
1
+ 1.0.0
@@ -0,0 +1,28 @@
1
+ #
2
+ # Script to build a list of dependencies
3
+ #
4
+
5
+ require 'gloo_lang/core/baseo'
6
+ require 'gloo_lang/core/obj'
7
+
8
+ path = File.dirname( File.absolute_path( __FILE__ ) )
9
+
10
+ files = []
11
+ #
12
+ # We want to start with these to avoid dependency errors later on.
13
+ #
14
+ # files << File.join( path, 'gloo_lang', 'core', 'baseo.rb' )
15
+ # files << File.join( path, 'gloo_lang', 'core', 'obj.rb' )
16
+
17
+ root = File.join( path, 'gloo', '**/*.rb' )
18
+ Dir.glob( root ).each do |ruby_file|
19
+ files << ruby_file unless files.include?( ruby_file )
20
+ end
21
+
22
+ #
23
+ # Now that we have the first with some key dependencies
24
+ # at the top, we'll require them.
25
+ #
26
+ files.each do |ruby_file|
27
+ require ruby_file
28
+ end
data/lib/gloo/app/info.rb CHANGED
@@ -4,9 +4,11 @@
4
4
  # Application information such as Version and public name.
5
5
  #
6
6
 
7
+ require 'gloo-lang'
8
+
7
9
  module Gloo
8
10
  module App
9
- class Info
11
+ class Info < GlooLang::App::Info
10
12
 
11
13
  #
12
14
  # Load the version from the VERSION file.
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
@@ -8,7 +8,7 @@ require 'pastel'
8
8
 
9
9
  module Gloo
10
10
  module Objs
11
- class Banner < Gloo::Core::Obj
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 = $engine.factory
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
@@ -7,7 +7,7 @@ require 'tty-progressbar'
7
7
 
8
8
  module Gloo
9
9
  module Objs
10
- class Bar < Gloo::Core::Obj
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 = $engine.factory
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 = Gloo::Expr::Expression.new( @params.tokens )
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 = Gloo::Expr::Expression.new( @params.tokens )
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 < Gloo::Core::Obj
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 = $engine.factory
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
- $engine.heap.it.set_to msg.to_s
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 < Gloo::Core::Obj
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 = $engine.factory
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 = $prompt.yes?( prompt )
90
+ result = @engine.platform.prompt.yes?( prompt )
91
91
  set_result result
92
92
  end
93
93
 
@@ -8,7 +8,7 @@
8
8
 
9
9
  module Gloo
10
10
  module Objs
11
- class Menu < Gloo::Core::Obj
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 = $engine.factory
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 = $prompt.ask( "#{d.yellow} #{t.white} >" )
105
+ cmd = @engine.platform.prompt.ask( "#{d.yellow} #{t.white} >" )
106
106
  else
107
- cmd = $prompt.ask( prompt_value )
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
- Gloo::Exec::Dispatch.message 'run', o
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 = Gloo::Objs::Alias.resolve_alias( 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 = Gloo::Objs::Alias.resolve_alias( 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 = Gloo::Exec::Script.new obj
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 = Gloo::Exec::Script.new script
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 < Gloo::Core::Obj
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 = $engine.factory
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
@@ -7,7 +7,7 @@ require 'pastel'
7
7
 
8
8
  module Gloo
9
9
  module Objs
10
- class Pastel < Gloo::Core::Obj
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 = $engine.factory
70
+ fac = @engine.factory
71
71
  fac.create_string TEXT, '', self
72
72
  fac.create_string COLOR, '', self
73
73
  end
@@ -6,7 +6,7 @@
6
6
 
7
7
  module Gloo
8
8
  module Objs
9
- class Prompt < Gloo::Core::Obj
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 = $engine.factory
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 = $prompt.multiline( prompt )
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 = $prompt.ask( prompt )
104
+ result = @engine.platform.prompt.ask( prompt )
105
105
  set_result result
106
106
  end
107
107