gloo 0.8.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
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 +12 -4
  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/data/mysql.rb +9 -9
  23. data/lib/gloo/objs/data/sqlite.rb +10 -10
  24. data/lib/gloo/objs/dev/git.rb +7 -7
  25. data/lib/gloo/objs/dev/stats.rb +8 -5
  26. data/lib/gloo/objs/snd/play.rb +1 -1
  27. data/lib/gloo/objs/snd/say.rb +2 -2
  28. data/lib/gloo/objs/system/file_handle.rb +9 -9
  29. data/lib/gloo/objs/system/ssh_exec.rb +3 -3
  30. data/lib/gloo/objs/system/system.rb +2 -2
  31. data/lib/gloo/verbs/alert.rb +7 -7
  32. data/lib/gloo/verbs/beep.rb +1 -1
  33. data/lib/gloo/verbs/cls.rb +2 -2
  34. data/lib/gloo/verbs/help.rb +7 -189
  35. data/lib/gloo/verbs/version.rb +3 -3
  36. data/lib/gloo.rb +5 -1
  37. data/lib/run.rb +5 -1
  38. metadata +41 -177
  39. data/Gemfile.lock +0 -171
  40. data/lib/gloo/app/args.rb +0 -112
  41. data/lib/gloo/app/engine.rb +0 -230
  42. data/lib/gloo/app/help.rb +0 -156
  43. data/lib/gloo/app/mode.rb +0 -27
  44. data/lib/gloo/app/settings.rb +0 -186
  45. data/lib/gloo/convert/converter.rb +0 -35
  46. data/lib/gloo/convert/string_to_datetime.rb +0 -21
  47. data/lib/gloo/convert/string_to_decimal.rb +0 -20
  48. data/lib/gloo/convert/string_to_integer.rb +0 -20
  49. data/lib/gloo/core/baseo.rb +0 -30
  50. data/lib/gloo/core/dictionary.rb +0 -181
  51. data/lib/gloo/core/error.rb +0 -61
  52. data/lib/gloo/core/event_manager.rb +0 -44
  53. data/lib/gloo/core/factory.rb +0 -210
  54. data/lib/gloo/core/gloo_system.rb +0 -266
  55. data/lib/gloo/core/heap.rb +0 -52
  56. data/lib/gloo/core/here.rb +0 -36
  57. data/lib/gloo/core/it.rb +0 -36
  58. data/lib/gloo/core/literal.rb +0 -30
  59. data/lib/gloo/core/obj.rb +0 -303
  60. data/lib/gloo/core/obj_finder.rb +0 -30
  61. data/lib/gloo/core/op.rb +0 -40
  62. data/lib/gloo/core/parser.rb +0 -59
  63. data/lib/gloo/core/pn.rb +0 -188
  64. data/lib/gloo/core/tokens.rb +0 -165
  65. data/lib/gloo/core/verb.rb +0 -86
  66. data/lib/gloo/exec/action.rb +0 -48
  67. data/lib/gloo/exec/dispatch.rb +0 -40
  68. data/lib/gloo/exec/exec_env.rb +0 -74
  69. data/lib/gloo/exec/runner.rb +0 -45
  70. data/lib/gloo/exec/script.rb +0 -49
  71. data/lib/gloo/exec/stack.rb +0 -78
  72. data/lib/gloo/expr/expression.rb +0 -118
  73. data/lib/gloo/expr/l_boolean.rb +0 -36
  74. data/lib/gloo/expr/l_decimal.rb +0 -39
  75. data/lib/gloo/expr/l_integer.rb +0 -37
  76. data/lib/gloo/expr/l_string.rb +0 -58
  77. data/lib/gloo/expr/op_div.rb +0 -22
  78. data/lib/gloo/expr/op_minus.rb +0 -22
  79. data/lib/gloo/expr/op_mult.rb +0 -22
  80. data/lib/gloo/expr/op_plus.rb +0 -24
  81. data/lib/gloo/help/app/application.txt +0 -22
  82. data/lib/gloo/help/app/configuration.txt +0 -7
  83. data/lib/gloo/help/app/default_help.txt +0 -14
  84. data/lib/gloo/help/app/logging.txt +0 -16
  85. data/lib/gloo/help/core/color.txt +0 -31
  86. data/lib/gloo/help/core/error.txt +0 -33
  87. data/lib/gloo/help/core/events.txt +0 -21
  88. data/lib/gloo/help/core/gloo_system.txt +0 -57
  89. data/lib/gloo/help/core/here.txt +0 -30
  90. data/lib/gloo/help/core/it.txt +0 -23
  91. data/lib/gloo/help/core/ops.txt +0 -16
  92. data/lib/gloo/help/core/pathname.txt +0 -29
  93. data/lib/gloo/help/objs/basic/alias.txt +0 -36
  94. data/lib/gloo/help/objs/basic/boolean.txt +0 -28
  95. data/lib/gloo/help/objs/basic/container.txt +0 -33
  96. data/lib/gloo/help/objs/basic/decimal.txt +0 -28
  97. data/lib/gloo/help/objs/basic/integer.txt +0 -27
  98. data/lib/gloo/help/objs/basic/script.txt +0 -29
  99. data/lib/gloo/help/objs/basic/string.txt +0 -28
  100. data/lib/gloo/help/objs/basic/text.txt +0 -27
  101. data/lib/gloo/help/objs/basic/untyped.txt +0 -22
  102. data/lib/gloo/help/objs/cli/banner.txt +0 -49
  103. data/lib/gloo/help/objs/cli/bar.txt +0 -37
  104. data/lib/gloo/help/objs/cli/colorize.txt +0 -33
  105. data/lib/gloo/help/objs/cli/confirm.txt +0 -26
  106. data/lib/gloo/help/objs/cli/menu.txt +0 -44
  107. data/lib/gloo/help/objs/cli/menu_item.txt +0 -26
  108. data/lib/gloo/help/objs/cli/pastel.txt +0 -43
  109. data/lib/gloo/help/objs/cli/prompt.txt +0 -27
  110. data/lib/gloo/help/objs/cli/select.txt +0 -34
  111. data/lib/gloo/help/objs/ctrl/each.txt +0 -48
  112. data/lib/gloo/help/objs/ctrl/repeat.txt +0 -38
  113. data/lib/gloo/help/objs/data/markdown.txt +0 -25
  114. data/lib/gloo/help/objs/data/mysql.txt +0 -40
  115. data/lib/gloo/help/objs/data/query.txt +0 -37
  116. data/lib/gloo/help/objs/data/sqlite.txt +0 -26
  117. data/lib/gloo/help/objs/data/table.txt +0 -46
  118. data/lib/gloo/help/objs/dev/git_repo.txt +0 -36
  119. data/lib/gloo/help/objs/dev/stats.txt +0 -36
  120. data/lib/gloo/help/objs/dt/date.txt +0 -23
  121. data/lib/gloo/help/objs/dt/datetime.txt +0 -24
  122. data/lib/gloo/help/objs/dt/time.txt +0 -23
  123. data/lib/gloo/help/objs/ror/erb.txt +0 -37
  124. data/lib/gloo/help/objs/ror/eval.txt +0 -24
  125. data/lib/gloo/help/objs/snd/play.txt +0 -23
  126. data/lib/gloo/help/objs/snd/say.txt +0 -28
  127. data/lib/gloo/help/objs/system/file.txt +0 -48
  128. data/lib/gloo/help/objs/system/ssh_exec.txt +0 -30
  129. data/lib/gloo/help/objs/system/system.txt +0 -32
  130. data/lib/gloo/help/objs/web/http_get.txt +0 -35
  131. data/lib/gloo/help/objs/web/http_post.txt +0 -34
  132. data/lib/gloo/help/objs/web/json.txt +0 -34
  133. data/lib/gloo/help/objs/web/slack.txt +0 -33
  134. data/lib/gloo/help/objs/web/teams.txt +0 -30
  135. data/lib/gloo/help/objs/web/uri.txt +0 -38
  136. data/lib/gloo/help/verbs/alert.txt +0 -33
  137. data/lib/gloo/help/verbs/beep.txt +0 -25
  138. data/lib/gloo/help/verbs/cls.txt +0 -24
  139. data/lib/gloo/help/verbs/context.txt +0 -43
  140. data/lib/gloo/help/verbs/create.txt +0 -33
  141. data/lib/gloo/help/verbs/execute.txt +0 -27
  142. data/lib/gloo/help/verbs/help.txt +0 -34
  143. data/lib/gloo/help/verbs/if.txt +0 -37
  144. data/lib/gloo/help/verbs/list.txt +0 -34
  145. data/lib/gloo/help/verbs/load.txt +0 -38
  146. data/lib/gloo/help/verbs/move.txt +0 -42
  147. data/lib/gloo/help/verbs/put.txt +0 -38
  148. data/lib/gloo/help/verbs/quit.txt +0 -25
  149. data/lib/gloo/help/verbs/run.txt +0 -41
  150. data/lib/gloo/help/verbs/save.txt +0 -26
  151. data/lib/gloo/help/verbs/show.txt +0 -30
  152. data/lib/gloo/help/verbs/tell.txt +0 -34
  153. data/lib/gloo/help/verbs/unless.txt +0 -38
  154. data/lib/gloo/help/verbs/version.txt +0 -32
  155. data/lib/gloo/help/verbs/wait.txt +0 -29
  156. data/lib/gloo/objs/basic/alias.rb +0 -78
  157. data/lib/gloo/objs/basic/boolean.rb +0 -120
  158. data/lib/gloo/objs/basic/container.rb +0 -76
  159. data/lib/gloo/objs/basic/decimal.rb +0 -76
  160. data/lib/gloo/objs/basic/integer.rb +0 -73
  161. data/lib/gloo/objs/basic/script.rb +0 -99
  162. data/lib/gloo/objs/basic/string.rb +0 -77
  163. data/lib/gloo/objs/basic/text.rb +0 -87
  164. data/lib/gloo/objs/basic/untyped.rb +0 -41
  165. data/lib/gloo/objs/ctrl/each.rb +0 -279
  166. data/lib/gloo/objs/ctrl/repeat.rb +0 -108
  167. data/lib/gloo/objs/data/markdown.rb +0 -84
  168. data/lib/gloo/objs/data/query.rb +0 -176
  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: 8f92932b8d062032ed668790dd9402424d7d61aa54e0c1a19237090eb733e8b6
4
- data.tar.gz: f11e6ec9a15d94b9bec2f04ab92cddc76bb2bb6c188738436c6f92b27cfa12a4
3
+ metadata.gz: 795a2a504aa74f3089a84d31a2328bb390ddf1aa7f635e2ff195f8fb702c1a3b
4
+ data.tar.gz: bdd936b143644a0738b7608af0a7babd3449dfca44cbfb5eafa93ce5cafafba0
5
5
  SHA512:
6
- metadata.gz: a03dae0b31837e793c6a71a8b410581e93f4844dc3df6fa2f1f04285f4a4ca45a51e28d491fe0d1f09ab485c0a605fdc60f136fbb1f1c1c62b4084d8d87e0e75
7
- data.tar.gz: e6d6c02c2d7ef885a3cf98337bfd05dd42c3358098bc26e7ec3bd23102cf730b12a21f6c46888cfe0441284ea18ddfee2ed35beb5d9f795ce78cd0de56a61993
6
+ metadata.gz: 86ddd2862739a3a1b7a889129d6417c546b15e59e4fb7cc86fad6452eb2edc0e2d2176fedfec2b890ec6225ceeaaaf612eb4f2d9d73d867aa68348a25c4c70dd
7
+ data.tar.gz: fa430128e804363656cfc02a07d6223db8e9f55a50efa3cace35a8095c5a3a911d837c80c769ac57060ea5e1f9e0aea4937d06680faf1a0657221b1ad168f0a0
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,17 +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
+ #
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", '~> 6.1', ">= 6.1.4.6"
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"
36
44
  # spec.add_dependency "activesupport", '~> 5.2', ">= 5.2.4.3"
37
45
  # spec.add_dependency 'activesupport', '~> 5.2', '>= 5.2.1'
38
46
  spec.add_dependency 'chronic', '~> 0.10', '>= 0.10.2'
39
47
  spec.add_dependency 'colorize', '~> 0.8', '>= 0.8.1'
40
- spec.add_dependency 'tty', '~> 0.8', '>= 0.8.1'
48
+ spec.add_dependency 'tty', '~> 0.10', '>= 0.10.0'
41
49
  spec.add_dependency 'json', '~> 2.1', '>= 2.1.0'
42
50
  spec.add_dependency 'openssl', '~> 2.1', '>= 2.1.0'
43
51
  spec.add_dependency 'net-ssh', '~> 6.1', '>= 6.1.0'
data/lib/VERSION CHANGED
@@ -1 +1 @@
1
- 0.8.0
1
+ 1.2.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
 
@@ -20,7 +20,7 @@ require 'mysql2'
20
20
 
21
21
  module Gloo
22
22
  module Objs
23
- class Mysql < Gloo::Core::Obj
23
+ class Mysql < GlooLang::Core::Obj
24
24
 
25
25
  KEYWORD = 'mysql'.freeze
26
26
  KEYWORD_SHORT = 'mysql'.freeze
@@ -63,7 +63,7 @@ module Gloo
63
63
  # for default configurations.
64
64
  #
65
65
  def add_default_children
66
- fac = $engine.factory
66
+ fac = @engine.factory
67
67
  fac.create_string HOST, nil, self
68
68
  fac.create_string DB, nil, self
69
69
  fac.create_string USER, nil, self
@@ -87,7 +87,7 @@ module Gloo
87
87
  def msg_verify
88
88
  return unless connects?
89
89
 
90
- $engine.heap.it.set_to true
90
+ @engine.heap.it.set_to true
91
91
  end
92
92
 
93
93
  # ---------------------------------------------------------------------
@@ -126,7 +126,7 @@ module Gloo
126
126
  o = find_child HOST
127
127
  return nil unless o
128
128
 
129
- o = Gloo::Objs::Alias.resolve_alias( o )
129
+ o = GlooLang::Objs::Alias.resolve_alias( @engine, o )
130
130
  return o.value
131
131
  end
132
132
 
@@ -138,7 +138,7 @@ module Gloo
138
138
  o = find_child DB
139
139
  return nil unless o
140
140
 
141
- o = Gloo::Objs::Alias.resolve_alias( o )
141
+ o = GlooLang::Objs::Alias.resolve_alias( @engine, o )
142
142
  return o.value
143
143
  end
144
144
 
@@ -150,7 +150,7 @@ module Gloo
150
150
  o = find_child USER
151
151
  return nil unless o
152
152
 
153
- o = Gloo::Objs::Alias.resolve_alias( o )
153
+ o = GlooLang::Objs::Alias.resolve_alias( @engine, o )
154
154
  return o.value
155
155
  end
156
156
 
@@ -162,7 +162,7 @@ module Gloo
162
162
  o = find_child PASSWD
163
163
  return nil unless o
164
164
 
165
- o = Gloo::Objs::Alias.resolve_alias( o )
165
+ o = GlooLang::Objs::Alias.resolve_alias( @engine, o )
166
166
  return o.value
167
167
  end
168
168
 
@@ -180,8 +180,8 @@ module Gloo
180
180
  }
181
181
  Mysql2::Client.new( h )
182
182
  rescue => e
183
- $engine.err e.message
184
- $engine.heap.it.set_to false
183
+ @engine.err e.message
184
+ @engine.heap.it.set_to false
185
185
  return false
186
186
  end
187
187
  return true