gloo 0.7.7 → 1.1.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.
Files changed (203) hide show
  1. checksums.yaml +4 -4
  2. data/.DS_Store +0 -0
  3. data/.gitignore +2 -1
  4. data/.ruby-gemset +1 -0
  5. data/.ruby-version +1 -0
  6. data/LICENSE.txt +1 -1
  7. data/gloo.gemspec +15 -6
  8. data/lib/VERSION +1 -1
  9. data/lib/dependencies.rb +4 -4
  10. data/lib/gloo/app/info.rb +3 -1
  11. data/lib/gloo/app/log.rb +1 -29
  12. data/lib/gloo/app/platform.rb +142 -0
  13. data/lib/gloo/objs/cli/banner.rb +2 -2
  14. data/lib/gloo/objs/cli/bar.rb +4 -4
  15. data/lib/gloo/objs/cli/colorize.rb +3 -3
  16. data/lib/gloo/objs/cli/confirm.rb +3 -3
  17. data/lib/gloo/objs/cli/menu.rb +9 -9
  18. data/lib/gloo/objs/cli/menu_item.rb +2 -2
  19. data/lib/gloo/objs/cli/pastel.rb +2 -2
  20. data/lib/gloo/objs/cli/prompt.rb +4 -4
  21. data/lib/gloo/objs/cli/select.rb +4 -4
  22. data/lib/gloo/objs/dev/git.rb +7 -7
  23. data/lib/gloo/objs/dev/stats.rb +8 -5
  24. data/lib/gloo/objs/snd/play.rb +1 -1
  25. data/lib/gloo/objs/snd/say.rb +2 -2
  26. data/lib/gloo/objs/system/file_handle.rb +9 -9
  27. data/lib/gloo/objs/system/ssh_exec.rb +3 -3
  28. data/lib/gloo/objs/system/system.rb +2 -2
  29. data/lib/gloo/verbs/alert.rb +7 -7
  30. data/lib/gloo/verbs/beep.rb +1 -1
  31. data/lib/gloo/verbs/cls.rb +2 -2
  32. data/lib/gloo/verbs/help.rb +7 -189
  33. data/lib/gloo/verbs/version.rb +3 -3
  34. data/lib/gloo.rb +5 -1
  35. data/lib/run.rb +5 -1
  36. metadata +43 -221
  37. data/Gemfile.lock +0 -168
  38. data/lib/gloo/app/args.rb +0 -112
  39. data/lib/gloo/app/engine.rb +0 -230
  40. data/lib/gloo/app/help.rb +0 -156
  41. data/lib/gloo/app/mode.rb +0 -27
  42. data/lib/gloo/app/settings.rb +0 -186
  43. data/lib/gloo/convert/converter.rb +0 -35
  44. data/lib/gloo/convert/string_to_datetime.rb +0 -21
  45. data/lib/gloo/convert/string_to_decimal.rb +0 -20
  46. data/lib/gloo/convert/string_to_integer.rb +0 -20
  47. data/lib/gloo/core/baseo.rb +0 -30
  48. data/lib/gloo/core/dictionary.rb +0 -181
  49. data/lib/gloo/core/error.rb +0 -61
  50. data/lib/gloo/core/event_manager.rb +0 -44
  51. data/lib/gloo/core/factory.rb +0 -210
  52. data/lib/gloo/core/gloo_system.rb +0 -266
  53. data/lib/gloo/core/heap.rb +0 -52
  54. data/lib/gloo/core/here.rb +0 -36
  55. data/lib/gloo/core/it.rb +0 -36
  56. data/lib/gloo/core/literal.rb +0 -30
  57. data/lib/gloo/core/obj.rb +0 -303
  58. data/lib/gloo/core/obj_finder.rb +0 -30
  59. data/lib/gloo/core/op.rb +0 -40
  60. data/lib/gloo/core/parser.rb +0 -59
  61. data/lib/gloo/core/pn.rb +0 -188
  62. data/lib/gloo/core/tokens.rb +0 -165
  63. data/lib/gloo/core/verb.rb +0 -86
  64. data/lib/gloo/exec/action.rb +0 -48
  65. data/lib/gloo/exec/dispatch.rb +0 -40
  66. data/lib/gloo/exec/exec_env.rb +0 -74
  67. data/lib/gloo/exec/runner.rb +0 -45
  68. data/lib/gloo/exec/script.rb +0 -49
  69. data/lib/gloo/exec/stack.rb +0 -78
  70. data/lib/gloo/expr/expression.rb +0 -118
  71. data/lib/gloo/expr/l_boolean.rb +0 -36
  72. data/lib/gloo/expr/l_decimal.rb +0 -39
  73. data/lib/gloo/expr/l_integer.rb +0 -37
  74. data/lib/gloo/expr/l_string.rb +0 -58
  75. data/lib/gloo/expr/op_div.rb +0 -22
  76. data/lib/gloo/expr/op_minus.rb +0 -22
  77. data/lib/gloo/expr/op_mult.rb +0 -22
  78. data/lib/gloo/expr/op_plus.rb +0 -24
  79. data/lib/gloo/help/app/application.txt +0 -22
  80. data/lib/gloo/help/app/configuration.txt +0 -7
  81. data/lib/gloo/help/app/default_help.txt +0 -14
  82. data/lib/gloo/help/app/logging.txt +0 -16
  83. data/lib/gloo/help/core/color.txt +0 -31
  84. data/lib/gloo/help/core/error.txt +0 -33
  85. data/lib/gloo/help/core/events.txt +0 -21
  86. data/lib/gloo/help/core/gloo_system.txt +0 -57
  87. data/lib/gloo/help/core/here.txt +0 -30
  88. data/lib/gloo/help/core/it.txt +0 -23
  89. data/lib/gloo/help/core/ops.txt +0 -16
  90. data/lib/gloo/help/core/pathname.txt +0 -29
  91. data/lib/gloo/help/objs/basic/alias.txt +0 -36
  92. data/lib/gloo/help/objs/basic/boolean.txt +0 -28
  93. data/lib/gloo/help/objs/basic/container.txt +0 -33
  94. data/lib/gloo/help/objs/basic/decimal.txt +0 -28
  95. data/lib/gloo/help/objs/basic/integer.txt +0 -27
  96. data/lib/gloo/help/objs/basic/script.txt +0 -29
  97. data/lib/gloo/help/objs/basic/string.txt +0 -28
  98. data/lib/gloo/help/objs/basic/text.txt +0 -27
  99. data/lib/gloo/help/objs/basic/untyped.txt +0 -22
  100. data/lib/gloo/help/objs/cli/banner.txt +0 -49
  101. data/lib/gloo/help/objs/cli/bar.txt +0 -37
  102. data/lib/gloo/help/objs/cli/colorize.txt +0 -33
  103. data/lib/gloo/help/objs/cli/confirm.txt +0 -26
  104. data/lib/gloo/help/objs/cli/menu.txt +0 -44
  105. data/lib/gloo/help/objs/cli/menu_item.txt +0 -26
  106. data/lib/gloo/help/objs/cli/pastel.txt +0 -43
  107. data/lib/gloo/help/objs/cli/prompt.txt +0 -27
  108. data/lib/gloo/help/objs/cli/select.txt +0 -34
  109. data/lib/gloo/help/objs/ctrl/each.txt +0 -48
  110. data/lib/gloo/help/objs/ctrl/repeat.txt +0 -38
  111. data/lib/gloo/help/objs/data/markdown.txt +0 -25
  112. data/lib/gloo/help/objs/data/mysql.txt +0 -40
  113. data/lib/gloo/help/objs/data/query.txt +0 -37
  114. data/lib/gloo/help/objs/data/sqlite.txt +0 -26
  115. data/lib/gloo/help/objs/data/table.txt +0 -46
  116. data/lib/gloo/help/objs/dev/git_repo.txt +0 -36
  117. data/lib/gloo/help/objs/dev/stats.txt +0 -36
  118. data/lib/gloo/help/objs/dt/date.txt +0 -23
  119. data/lib/gloo/help/objs/dt/datetime.txt +0 -24
  120. data/lib/gloo/help/objs/dt/time.txt +0 -23
  121. data/lib/gloo/help/objs/ror/erb.txt +0 -37
  122. data/lib/gloo/help/objs/ror/eval.txt +0 -24
  123. data/lib/gloo/help/objs/snd/play.txt +0 -23
  124. data/lib/gloo/help/objs/snd/say.txt +0 -28
  125. data/lib/gloo/help/objs/system/file.txt +0 -48
  126. data/lib/gloo/help/objs/system/ssh_exec.txt +0 -30
  127. data/lib/gloo/help/objs/system/system.txt +0 -32
  128. data/lib/gloo/help/objs/web/http_get.txt +0 -35
  129. data/lib/gloo/help/objs/web/http_post.txt +0 -34
  130. data/lib/gloo/help/objs/web/json.txt +0 -34
  131. data/lib/gloo/help/objs/web/slack.txt +0 -33
  132. data/lib/gloo/help/objs/web/teams.txt +0 -30
  133. data/lib/gloo/help/objs/web/uri.txt +0 -38
  134. data/lib/gloo/help/verbs/alert.txt +0 -33
  135. data/lib/gloo/help/verbs/beep.txt +0 -25
  136. data/lib/gloo/help/verbs/cls.txt +0 -24
  137. data/lib/gloo/help/verbs/context.txt +0 -43
  138. data/lib/gloo/help/verbs/create.txt +0 -33
  139. data/lib/gloo/help/verbs/execute.txt +0 -27
  140. data/lib/gloo/help/verbs/help.txt +0 -34
  141. data/lib/gloo/help/verbs/if.txt +0 -37
  142. data/lib/gloo/help/verbs/list.txt +0 -34
  143. data/lib/gloo/help/verbs/load.txt +0 -38
  144. data/lib/gloo/help/verbs/move.txt +0 -42
  145. data/lib/gloo/help/verbs/put.txt +0 -38
  146. data/lib/gloo/help/verbs/quit.txt +0 -25
  147. data/lib/gloo/help/verbs/run.txt +0 -41
  148. data/lib/gloo/help/verbs/save.txt +0 -26
  149. data/lib/gloo/help/verbs/show.txt +0 -30
  150. data/lib/gloo/help/verbs/tell.txt +0 -34
  151. data/lib/gloo/help/verbs/unless.txt +0 -38
  152. data/lib/gloo/help/verbs/version.txt +0 -32
  153. data/lib/gloo/help/verbs/wait.txt +0 -29
  154. data/lib/gloo/objs/basic/alias.rb +0 -78
  155. data/lib/gloo/objs/basic/boolean.rb +0 -120
  156. data/lib/gloo/objs/basic/container.rb +0 -76
  157. data/lib/gloo/objs/basic/decimal.rb +0 -76
  158. data/lib/gloo/objs/basic/integer.rb +0 -73
  159. data/lib/gloo/objs/basic/script.rb +0 -99
  160. data/lib/gloo/objs/basic/string.rb +0 -77
  161. data/lib/gloo/objs/basic/text.rb +0 -87
  162. data/lib/gloo/objs/basic/untyped.rb +0 -41
  163. data/lib/gloo/objs/ctrl/each.rb +0 -279
  164. data/lib/gloo/objs/ctrl/repeat.rb +0 -108
  165. data/lib/gloo/objs/data/markdown.rb +0 -84
  166. data/lib/gloo/objs/data/mysql.rb +0 -192
  167. data/lib/gloo/objs/data/query.rb +0 -176
  168. data/lib/gloo/objs/data/sqlite.rb +0 -159
  169. data/lib/gloo/objs/data/table.rb +0 -140
  170. data/lib/gloo/objs/dt/date.rb +0 -50
  171. data/lib/gloo/objs/dt/datetime.rb +0 -62
  172. data/lib/gloo/objs/dt/time.rb +0 -50
  173. data/lib/gloo/objs/ror/erb.rb +0 -116
  174. data/lib/gloo/objs/ror/eval.rb +0 -107
  175. data/lib/gloo/objs/web/http_get.rb +0 -159
  176. data/lib/gloo/objs/web/http_post.rb +0 -183
  177. data/lib/gloo/objs/web/json.rb +0 -135
  178. data/lib/gloo/objs/web/slack.rb +0 -130
  179. data/lib/gloo/objs/web/teams.rb +0 -117
  180. data/lib/gloo/objs/web/uri.rb +0 -148
  181. data/lib/gloo/persist/file_loader.rb +0 -191
  182. data/lib/gloo/persist/file_saver.rb +0 -49
  183. data/lib/gloo/persist/file_storage.rb +0 -45
  184. data/lib/gloo/persist/line_splitter.rb +0 -81
  185. data/lib/gloo/persist/persist_man.rb +0 -120
  186. data/lib/gloo/utils/format.rb +0 -21
  187. data/lib/gloo/utils/stats.rb +0 -205
  188. data/lib/gloo/utils/words.rb +0 -19
  189. data/lib/gloo/verbs/context.rb +0 -62
  190. data/lib/gloo/verbs/create.rb +0 -68
  191. data/lib/gloo/verbs/execute.rb +0 -56
  192. data/lib/gloo/verbs/if.rb +0 -92
  193. data/lib/gloo/verbs/list.rb +0 -98
  194. data/lib/gloo/verbs/load.rb +0 -45
  195. data/lib/gloo/verbs/move.rb +0 -89
  196. data/lib/gloo/verbs/put.rb +0 -94
  197. data/lib/gloo/verbs/quit.rb +0 -40
  198. data/lib/gloo/verbs/run.rb +0 -75
  199. data/lib/gloo/verbs/save.rb +0 -39
  200. data/lib/gloo/verbs/show.rb +0 -64
  201. data/lib/gloo/verbs/tell.rb +0 -79
  202. data/lib/gloo/verbs/unless.rb +0 -92
  203. data/lib/gloo/verbs/wait.rb +0 -42
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4a3e2cb80e6c835a4b74747356c94b4f67ce2ae0fa36d76324f1fb16d92b4baf
4
- data.tar.gz: b4577bc7f5ef1aed113600c3df5b39bbbb3292bff4c050aa81a5d7f0031fd891
3
+ metadata.gz: 62d4c3076b0a61719c6a62ef65aa793a758074e0ab306376671b445582e70822
4
+ data.tar.gz: a2938182e0675a6992861da6dfea7da7a23e6998f235a9cb6b376ee823b7d8a7
5
5
  SHA512:
6
- metadata.gz: 6dd3bff3c3e0dfe95dc82b53382d4c38528d0588007b1cb42d98747b2cf0fd06d2a9ca3486c7e29b836584e793f7eab18b74f51864f53a2dd86ca700116d8c1c
7
- data.tar.gz: 41d2029d98b4d70472d822f3636c8ad5ed5c97c906f179751469e98e962ef8503582201d7aac7a8c5b5b1db7ce667f13e16e82d8f71103c6585ceb722349fff8
6
+ metadata.gz: a3de2e0895ec0da13278af8ea8e3ffca79bf69d65c503254198ad4441f2e29d84f5393db01768ec5a0458c12666de14f6e06a2d33f1005c083039b7dfa4abc80
7
+ data.tar.gz: 40e4aa7fc2a957e53cccc880c8aa2e0e9061fb0dd8eb2294ca6b93866e1820b086e694b06207897daabe89747e01cca6830952c8045078a5f4aa53ddf5b588a3
data/.DS_Store CHANGED
Binary file
data/.gitignore CHANGED
@@ -9,4 +9,5 @@
9
9
  *.gem
10
10
  *.log
11
11
  test/gloo/debug/*
12
- .DS_Store
12
+ Gemfile.lock
13
+ *.DS_Store
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ gloo-gem
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ ruby-3.0.2
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,28 @@ 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
+ #
31
+ # tty uses an older version of bundle
32
+ #
33
+ # spec.add_development_dependency 'bundler', '~> 2.2.22'
34
+ # spec.add_development_dependency 'bundler', '~> 2.3.17'
35
+ spec.add_development_dependency 'bundler', '~> 1.17.3'
36
+ spec.add_development_dependency 'minitest', '~> 5.1', '>= 5.14.2'
32
37
  # spec.add_development_dependency 'rake', '~> 10.0'
33
38
  spec.add_development_dependency "rake", '~> 13.0', '>= 13.0.1'
34
39
 
35
- spec.add_dependency "activesupport", '~> 5.2', ">= 5.2.4.3"
40
+ spec.add_dependency "gloo-lang", '~> 1.1', ">= 1.1.0"
41
+
42
+ spec.add_dependency "activesupport", '~> 6.1', ">= 6.1.5"
43
+ # spec.add_dependency "activesupport", '~> 6.1', ">= 6.1.4.6"
44
+ # spec.add_dependency "activesupport", '~> 5.2', ">= 5.2.4.3"
36
45
  # spec.add_dependency 'activesupport', '~> 5.2', '>= 5.2.1'
37
46
  spec.add_dependency 'chronic', '~> 0.10', '>= 0.10.2'
38
47
  spec.add_dependency 'colorize', '~> 0.8', '>= 0.8.1'
39
- spec.add_dependency 'tty', '~> 0.8', '>= 0.8.1'
48
+ spec.add_dependency 'tty', '~> 0.10', '>= 0.10.0'
40
49
  spec.add_dependency 'json', '~> 2.1', '>= 2.1.0'
41
50
  spec.add_dependency 'openssl', '~> 2.1', '>= 2.1.0'
42
51
  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'
52
+ # spec.add_dependency 'mysql2', '~> 0.5', '>= 0.5.3'
53
+ # spec.add_dependency 'sqlite3', '~> 1.4', '>= 1.4.2'
45
54
  end
data/lib/VERSION CHANGED
@@ -1 +1 @@
1
- 0.7.7
1
+ 1.1.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 'gloo/core/baseo'
6
- require 'gloo/core/obj'
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, 'gloo', 'core', 'baseo.rb' )
15
- files << File.join( path, 'gloo', 'core', 'obj.rb' )
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
@@ -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
 
@@ -6,7 +6,7 @@
6
6
 
7
7
  module Gloo
8
8
  module Objs
9
- class Select < Gloo::Core::Obj
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 = $engine.factory
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 = Gloo::App::Settings.page_size
120
- result = $prompt.select( prompt, options, :per_page => per )
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
 
@@ -6,7 +6,7 @@
6
6
 
7
7
  module Gloo
8
8
  module Objs
9
- class Git < Gloo::Core::Obj
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
- $engine.heap.it.set_to branch
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 = Gloo::Expr::Expression.new( @params.tokens )
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
- $engine.heap.it.set_to msg
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
- $engine.heap.it.set_to result
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
- $engine.heap.it.set_to result
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
- $engine.heap.it.set_to result
135
+ @engine.heap.it.set_to result
136
136
  end
137
137
 
138
138
  end