gloo 4.7.0 → 5.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 (63) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +1 -1
  3. data/gloo.gemspec +22 -11
  4. data/lib/VERSION +1 -1
  5. data/lib/VERSION_NOTES +7 -0
  6. data/lib/gloo/app/engine.rb +3 -2
  7. data/lib/gloo/app/running_app.rb +13 -0
  8. data/lib/gloo/core/dictionary.rb +13 -2
  9. data/lib/gloo/objs/ctrl/each.rb +2 -2
  10. data/lib/gloo/{ext → plugin}/base.rb +1 -1
  11. data/lib/gloo/{ext → plugin}/callback.rb +2 -3
  12. data/lib/gloo/{ext/manager.rb → plugin/ext_manager.rb} +2 -2
  13. data/lib/gloo/plugin/lib_manager.rb +97 -0
  14. data/lib/gloo/verbs/exists.rb +75 -0
  15. data/lib/gloo/verbs/help.rb +28 -0
  16. data/lib/gloo/verbs/load.rb +8 -2
  17. data/lib/gloo/verbs/redirect.rb +2 -1
  18. metadata +38 -164
  19. data/lib/gloo/objs/cli/colorize.rb +0 -73
  20. data/lib/gloo/objs/cli/confirm.rb +0 -96
  21. data/lib/gloo/objs/cli/menu.rb +0 -370
  22. data/lib/gloo/objs/cli/menu_item.rb +0 -95
  23. data/lib/gloo/objs/cli/prompt.rb +0 -110
  24. data/lib/gloo/objs/cli/select.rb +0 -127
  25. data/lib/gloo/objs/ctrl/each_repo.rb +0 -84
  26. data/lib/gloo/objs/data/markdown.rb +0 -133
  27. data/lib/gloo/objs/data/markdown_ext.rb +0 -260
  28. data/lib/gloo/objs/data/mysql.rb +0 -254
  29. data/lib/gloo/objs/data/query.rb +0 -269
  30. data/lib/gloo/objs/data/query_result.rb +0 -158
  31. data/lib/gloo/objs/data/sqlite.rb +0 -174
  32. data/lib/gloo/objs/data/table.rb +0 -267
  33. data/lib/gloo/objs/dev/git.rb +0 -140
  34. data/lib/gloo/objs/dev/stats.rb +0 -123
  35. data/lib/gloo/objs/system/ssh_exec.rb +0 -126
  36. data/lib/gloo/objs/web_svr/element.rb +0 -254
  37. data/lib/gloo/objs/web_svr/field.rb +0 -429
  38. data/lib/gloo/objs/web_svr/form.rb +0 -271
  39. data/lib/gloo/objs/web_svr/page.rb +0 -562
  40. data/lib/gloo/objs/web_svr/partial.rb +0 -210
  41. data/lib/gloo/objs/web_svr/svr.rb +0 -713
  42. data/lib/gloo/utils/stats.rb +0 -206
  43. data/lib/gloo/web_svr/asset.rb +0 -407
  44. data/lib/gloo/web_svr/asset_info.rb +0 -116
  45. data/lib/gloo/web_svr/config.rb +0 -56
  46. data/lib/gloo/web_svr/embedded_renderer.rb +0 -154
  47. data/lib/gloo/web_svr/handler.rb +0 -154
  48. data/lib/gloo/web_svr/request.rb +0 -143
  49. data/lib/gloo/web_svr/request_params.rb +0 -181
  50. data/lib/gloo/web_svr/response.rb +0 -177
  51. data/lib/gloo/web_svr/response_code.rb +0 -69
  52. data/lib/gloo/web_svr/routing/resource_router.rb +0 -47
  53. data/lib/gloo/web_svr/routing/router.rb +0 -232
  54. data/lib/gloo/web_svr/routing/show_routes.rb +0 -94
  55. data/lib/gloo/web_svr/server.rb +0 -105
  56. data/lib/gloo/web_svr/session.rb +0 -215
  57. data/lib/gloo/web_svr/table_renderer.rb +0 -151
  58. data/lib/gloo/web_svr/web_method.rb +0 -54
  59. /data/lib/gloo/objs/{security → str_utils}/cipher.rb +0 -0
  60. /data/lib/gloo/objs/{security → str_utils}/csrf_token.rb +0 -0
  61. /data/lib/gloo/objs/{security → str_utils}/password.rb +0 -0
  62. /data/lib/gloo/objs/{ror → system}/erb.rb +0 -0
  63. /data/lib/gloo/objs/{ror → system}/eval.rb +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ce59cd8b3b1d064619f053e725f84531a53587ff1ded7c96d34ef6c7970b4790
4
- data.tar.gz: 592bb098d11801db860648841f30718b7ef1ede6929ddd230fbae82221b3e97d
3
+ metadata.gz: 124d817789d21c4e9899f12195b66ae06cb26a8cba150a03a3b97ec63a524160
4
+ data.tar.gz: 3694e28d17ff419835889026b25ef96bc7316e13cc3c8c51e42dcde215ccaca1
5
5
  SHA512:
6
- metadata.gz: b72b4200ad1115f0f74e7df0532370f9c33621d70dd20e50a912da03a86a26c63a57d1911baf110754305af0ce92cf770434bb72c8edcee6f6dcd6b6ad395bcb
7
- data.tar.gz: fcf2d0e68d0b5eddbcfafae93c99686ed11dac85e8f5e1277dc31cbfdf575a7190fb3a726c320bce6cb3606a717b12bb0fb4c04b0931efd6a57a36524ee12fb4
6
+ metadata.gz: 729f3041b377589a22186b4fbe42b9971e3376f4404a2b5f1bc21b312d92b490b90dc40edcf5e651ba41799371f4594c8c9c1a17170c1c36e2d2488972d3a8b8
7
+ data.tar.gz: 6e8162b00779c17012b2ac0177686a98928729a34e46390bf742df663c61266ae8024f5dfbd32a2c75a2db1949f766add6b218282620160ec59e325673569261
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2022 Eric Crane
3
+ Copyright (c) 2026 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,27 +27,38 @@ Gem::Specification.new do |spec|
27
27
  spec.executables << 'o'
28
28
  spec.executables << 'gloo'
29
29
 
30
+ #
31
+ # Development Dependencies
32
+ #
30
33
  spec.add_development_dependency 'bundler'
31
34
  spec.add_development_dependency 'minitest', '~> 5.1', '>= 5.14.2'
32
35
  spec.add_development_dependency "rake", '~> 13.0', '>= 13.0.1'
33
36
  spec.add_development_dependency 'concurrent-ruby', '1.3.4'
34
37
 
38
+ # Used by many objects
35
39
  spec.add_dependency "activesupport", '~> 6.1', ">= 6.1.5"
40
+
41
+ # Used by date and time tools
36
42
  spec.add_dependency 'chronic', '~> 0.10', '>= 0.10.2'
37
43
 
44
+ # Used by json tools
45
+ spec.add_dependency 'json', '~> 2.1', '>= 2.1.0'
46
+
47
+ # Used by cipher string tool
48
+ spec.add_dependency 'openssl'
49
+
50
+ # Used by password generation
51
+ spec.add_dependency 'bcrypt', '~> 3.1.20'
52
+
53
+ # Used by gloo system
54
+ spec.add_dependency 'os', '~> 1.1', '>= 1.1.4'
55
+
56
+ #
57
+ # App UI libs
58
+ #
38
59
  spec.add_dependency 'colorize', '~> 1.1.0', '>= 1.1.0'
39
60
  spec.add_dependency 'inquirer'
40
61
  spec.add_dependency 'reline'
41
62
  spec.add_dependency 'terminal-table'
42
-
43
- spec.add_dependency 'json', '~> 2.1', '>= 2.1.0'
44
- spec.add_dependency 'openssl'
45
- spec.add_dependency 'net-ssh', '~> 6.1', '>= 6.1.0'
46
- spec.add_dependency 'mysql2', '~> 0.5', '>= 0.5.3'
47
- spec.add_dependency 'sqlite3', '~> 1.4', '>= 1.4.2'
48
- spec.add_dependency 'os', '~> 1.1', '>= 1.1.4'
49
- # spec.add_dependency 'pg', '~> 1.5.4'
50
- spec.add_dependency 'thin', '~> 1.8.2'
51
- spec.add_dependency 'redcarpet', '~> 3.6.0'
52
- spec.add_dependency 'bcrypt', '~> 3.1.20'
63
+
53
64
  end
data/lib/VERSION CHANGED
@@ -1 +1 @@
1
- 4.7.0
1
+ 5.0
data/lib/VERSION_NOTES CHANGED
@@ -1,3 +1,10 @@
1
+ 5.0 - 2026.02.07
2
+ - Adds plugin systems for extensions and core libraries
3
+ - Adds exists? verb
4
+ - Updates help to show extensions and libraries
5
+ - Moves a number of objects into the new core libraries structure
6
+
7
+
1
8
  4.7.0 - 2026.01.18
2
9
  - Adds the Extension Manager.
3
10
  - Moves alert, beep, slack, teams out of gloo into extensions.
@@ -14,7 +14,7 @@ module Gloo
14
14
  attr_reader :settings, :log, :running_app
15
15
  attr_reader :args, :mode, :running, :platform,
16
16
  :dictionary, :parser, :heap, :factory,
17
- :ext_manager
17
+ :ext_manager, :lib_manager
18
18
  attr_accessor :last_cmd, :persist_man, :event_manager,
19
19
  :exec_env, :converter
20
20
 
@@ -51,7 +51,8 @@ module Gloo
51
51
  @factory = Gloo::Core::Factory.new( self )
52
52
  @persist_man = Gloo::Persist::PersistMan.new( self )
53
53
  @event_manager = Gloo::Core::EventManager.new( self )
54
- @ext_manager = Gloo::Ext::Manager.new( self )
54
+ @ext_manager = Gloo::Plugin::ExtManager.new( self )
55
+ @lib_manager = Gloo::Plugin::LibManager.new( self )
55
56
 
56
57
  @exec_env = Gloo::Exec::ExecEnv.new( self )
57
58
  @converter = Gloo::Convert::Converter.new( self )
@@ -77,6 +77,19 @@ module Gloo
77
77
  return @db_clients[ obj.pn ]
78
78
  end
79
79
 
80
+
81
+ # ---------------------------------------------------------------------
82
+ # Running app helpers
83
+ # ---------------------------------------------------------------------
84
+
85
+ #
86
+ # Create a table renderer if the web server core lib is loaded.
87
+ #
88
+ def create_table_renderer
89
+ # if exists
90
+ return WebSvr::TableRenderer.new( @engine )
91
+ end
92
+
80
93
  end
81
94
  end
82
95
  end
@@ -223,7 +223,12 @@ module Gloo
223
223
  # Add an object to the dictionary
224
224
  #
225
225
  def add_object o
226
- # @engine.log.debug o
226
+ # Make sure it hasn't already been registered
227
+ if ( @objs.key?(o.typename) || @objs.key?(o.short_typename) )
228
+ @engine.err "duplicate object type '#{o.typename}' or '#{o.short_typename}'"
229
+ return
230
+ end
231
+
227
232
  @objs[ o.typename ] = o
228
233
  @objs[ o.short_typename ] = o
229
234
  add_key o.typename
@@ -234,7 +239,13 @@ module Gloo
234
239
  # Add a verb to the dictionary
235
240
  #
236
241
  def add_verb v
237
- # @engine.log.debug v
242
+ # Make sure it hasn't already been registered
243
+ if ( verb?( v.keyword ) || verb?( v.keyword_shortcut ))
244
+ puts "duplicate verb keyword '#{v.keyword}' or '#{v.keyword_shortcut}'"
245
+ @engine.err "duplicate verb keyword '#{v.keyword}' or '#{v.keyword_shortcut}'"
246
+ return
247
+ end
248
+
238
249
  @verbs[ v.keyword ] = v
239
250
  @verbs[ v.keyword_shortcut ] = v
240
251
  # v.send( :new ).run
@@ -100,8 +100,8 @@ module Gloo
100
100
  EachLine.new( @engine, self ).run
101
101
  elsif EachFile.use_for?( self )
102
102
  EachFile.new( @engine, self ).run
103
- elsif EachRepo.use_for?( self )
104
- EachRepo.new( @engine, self ).run
103
+ # elsif EachRepo.use_for?( self )
104
+ # EachRepo.new( @engine, self ).run
105
105
  else
106
106
  @engine.err "Not set up to run each for that target."
107
107
  end
@@ -3,7 +3,7 @@
3
3
  # Used by extensions to register verbs and objects.
4
4
  #
5
5
  module Gloo
6
- module Ext
6
+ module Plugin
7
7
  class Base
8
8
 
9
9
  #
@@ -2,7 +2,7 @@
2
2
  # A mechanism for registering extension components.
3
3
  #
4
4
  module Gloo
5
- module Ext
5
+ module Plugin
6
6
  class Callback
7
7
 
8
8
  #
@@ -30,5 +30,4 @@ module Gloo
30
30
 
31
31
  end
32
32
  end
33
- end
34
-
33
+ end
@@ -6,8 +6,8 @@
6
6
  #
7
7
 
8
8
  module Gloo
9
- module Ext
10
- class Manager
9
+ module Plugin
10
+ class ExtManager
11
11
 
12
12
  # Constants for extension management
13
13
  EXT_FILE = '_ext.rb'
@@ -0,0 +1,97 @@
1
+ # Author:: Eric Crane (mailto:eric.crane@mac.com)
2
+ # Copyright:: Copyright (c) 2026 Eric Crane. All rights reserved.
3
+ #
4
+ # The Library Manager.
5
+ # Load libraries as needed and register their verbs and objects.
6
+ #
7
+
8
+ module Gloo
9
+ module Plugin
10
+ class LibManager
11
+
12
+ # Constants for library management
13
+ GEM_PREFIX = 'gloo-'
14
+ INIT_CLASS_SUFFIX = 'Init'
15
+
16
+ #
17
+ # Set up the library manager.
18
+ #
19
+ def initialize( engine )
20
+ @engine = engine
21
+ @libraries = {}
22
+ @engine.log.debug 'library manager intialized...'
23
+ end
24
+
25
+ #
26
+ # Get the loaded libraries.
27
+ #
28
+ def loaded_libraries
29
+ return @libraries
30
+ end
31
+
32
+ #
33
+ # Get the start file for the gem core library.
34
+ #
35
+ def core_lib_name name
36
+ return GEM_PREFIX + name
37
+ end
38
+
39
+ #
40
+ # Get the library initialization class name.
41
+ #
42
+ def init_class_name name
43
+ return name.camelize + INIT_CLASS_SUFFIX
44
+ end
45
+
46
+ #
47
+ # Load the library of the given name.
48
+ # The name will correspond with the name of a directory
49
+ # within the gloo libraries directory.
50
+ #
51
+ def load_lib( name )
52
+ @engine.log.debug "Loading core library: #{name}"
53
+ gem_name = core_lib_name name
54
+
55
+ @libraries[name] = gem_name
56
+ register_library name, gem_name
57
+ @engine.log.debug "Core library loaded: #{name}"
58
+ end
59
+
60
+ #
61
+ # Require a gem by name, installing it if it's not available.
62
+ #
63
+ def require_gem gem_name
64
+ @engine.log.debug "Going to require gem: #{gem_name}"
65
+ begin
66
+ gem gem_name
67
+ rescue Gem::LoadError
68
+ @engine.log.info "Gem not found, attempting to install: #{gem_name}"
69
+ system("gem install #{gem_name}")
70
+ Gem.clear_paths
71
+ gem gem_name
72
+ end
73
+
74
+ require gem_name
75
+ end
76
+
77
+ #
78
+ # Give the library a chance to register its verbs and objects.
79
+ #
80
+ def register_library( name, gem_name )
81
+ require_gem gem_name
82
+
83
+ class_name = init_class_name name
84
+ @engine.log.debug "Looking for library entry point class to register: #{class_name}"
85
+ begin
86
+ plugin_class = Object.const_get( class_name )
87
+ inst = plugin_class.new
88
+ lib_cb = Callback.new( @engine )
89
+ inst.register( lib_cb )
90
+ rescue NameError
91
+ @engine.log.error "Warning: Could not find class #{class_name}"
92
+ end
93
+ end
94
+
95
+ end
96
+ end
97
+ end
@@ -0,0 +1,75 @@
1
+ # Author:: Eric Crane (mailto:eric.crane@mac.com)
2
+ # Copyright:: Copyright (c) 2026 Eric Crane. All rights reserved.
3
+ #
4
+ # Check to see if a verb or object type has been defined (or loaded).
5
+ #
6
+
7
+ module Gloo
8
+ module Verbs
9
+ class Exists < Gloo::Core::Verb
10
+
11
+ KEYWORD = 'exists?'.freeze
12
+ KEYWORD_SHORT = 'exist'.freeze
13
+ VERB_TYPE = 'verb'.freeze
14
+ OBJ_TYPE = 'object'.freeze
15
+ ANY_TYPE = 'any'.freeze
16
+ MISSING_EXPR_ERR = 'Missing Expression!'.freeze
17
+ WRONG_NUM_ARGS_ERR = 'Wrong number of arguments! 2 or 3 expected.'.freeze
18
+
19
+ #
20
+ # Run the verb.
21
+ #
22
+ def run
23
+ if @tokens.token_count == 3
24
+ type = @tokens.second.strip.downcase
25
+ keyword = @tokens.last
26
+ elsif @tokens.token_count == 2
27
+ type = ANY_TYPE
28
+ keyword = @tokens.second
29
+ else
30
+ @engine.err WRONG_NUM_ARGS_ERR
31
+ return
32
+ end
33
+
34
+ @engine.heap.it.set_to lookup_keyword(keyword, type)
35
+ end
36
+
37
+ #
38
+ # Get the Verb's keyword.
39
+ #
40
+ def self.keyword
41
+ return KEYWORD
42
+ end
43
+
44
+ #
45
+ # Get the Verb's keyword shortcut.
46
+ #
47
+ def self.keyword_shortcut
48
+ return KEYWORD_SHORT
49
+ end
50
+
51
+
52
+ # ---------------------------------------------------------------------
53
+ # Private functions
54
+ # ---------------------------------------------------------------------
55
+
56
+ private
57
+
58
+ #
59
+ # Lookup a keyword in the dictionary.
60
+ #
61
+ def lookup_keyword( keyword, type )
62
+ if type == VERB_TYPE
63
+ return @engine.dictionary.verb?(keyword)
64
+ elsif type == OBJ_TYPE
65
+ return @engine.dictionary.obj?(keyword)
66
+ elsif type == ANY_TYPE
67
+ return @engine.dictionary.verb?(keyword) || @engine.dictionary.obj?(keyword)
68
+ end
69
+
70
+ return false
71
+ end
72
+
73
+ end
74
+ end
75
+ end
@@ -25,6 +25,10 @@ module Gloo
25
25
  objects: 'show_objs',
26
26
  e: 'show_ext',
27
27
  ext: 'show_ext',
28
+ l: 'show_lib',
29
+ lib: 'show_lib',
30
+ library: 'show_lib',
31
+ libraries: 'show_lib',
28
32
  extension: 'show_ext',
29
33
  extensions: 'show_ext'
30
34
  }.freeze
@@ -96,6 +100,7 @@ module Gloo
96
100
  data << " ? objects (obj, o) \n"
97
101
  data << " ? verbs (v) \n"
98
102
  data << " ? ext (e) \n"
103
+ data << " ? lib (l) \n"
99
104
  data << " ? settings (s) \n"
100
105
  data << "\n For detailed documentation use the gloo website. \n"
101
106
  data << "\n https://gloo.ecrane.us/doc/. \n\n"
@@ -209,6 +214,29 @@ module Gloo
209
214
  return str
210
215
  end
211
216
 
217
+ #
218
+ # List the libraries
219
+ #
220
+ def show_lib
221
+ data = "\n"
222
+ data << " Libraries\n".blue
223
+ data << "#{get_libraries}\n\n"
224
+ @engine.log.show data
225
+ end
226
+
227
+ #
228
+ # Get the text for the list of libraries.
229
+ #
230
+ def get_libraries
231
+ str = ''
232
+ libs = @engine.lib_manager.loaded_libraries.sort
233
+ libs.each do |name, lib|
234
+ str << " #{name.white} \n"
235
+ end
236
+
237
+ return str
238
+ end
239
+
212
240
 
213
241
  end
214
242
  end
@@ -41,8 +41,7 @@ module Gloo
41
41
  elsif opt == EXT_OPT
42
42
  load_extension fn
43
43
  elsif opt == LIB_OPT
44
- # TODO: implement library loading
45
- @engine.err FEATURE_NOT_IMPLEMENTED_ERR
44
+ load_library fn
46
45
  else
47
46
  @engine.err UNKNOWN_OPT_ERR
48
47
  end
@@ -78,6 +77,13 @@ module Gloo
78
77
  @engine.ext_manager.load_ext name
79
78
  end
80
79
 
80
+ #
81
+ # Load a library
82
+ #
83
+ def load_library( name )
84
+ @engine.log.debug "Getting ready to load library: #{name}"
85
+ @engine.lib_manager.load_lib name
86
+ end
81
87
  end
82
88
  end
83
89
  end
@@ -87,7 +87,8 @@ module Gloo
87
87
  # This could be a page or a script.
88
88
  #
89
89
  def redirect_to_target
90
- if @target_obj.class == Gloo::Objs::Page
90
+ # TODO: Use a better way to determine if the target is a page or a script.
91
+ if @engine.app_running? && ( @target_obj.class.name == 'Page' )
91
92
  redirect_to_page
92
93
  elsif @target_obj.can_receive_message?( RUN_MESSAGE )
93
94
  redirect_to_script