gloo 6.7.0 → 6.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/docs/application.md +5 -0
- data/lib/VERSION +1 -1
- data/lib/VERSION_NOTES +8 -0
- data/lib/gloo/app/args.rb +21 -2
- data/lib/gloo/app/engine.rb +2 -2
- data/lib/gloo/core/dictionary.rb +30 -21
- data/lib/gloo/plugin/callback.rb +2 -2
- data/lib/gloo/shell/runner.rb +22 -3
- metadata +3 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: dfd9613e0faf6957907641ff2f7a8eee6e70d8d99478c43a910e65259537eb30
|
|
4
|
+
data.tar.gz: 4b5a3f2f27da015cdaa4899feed21bdedce47c9f3988e346ec4ed7dad06aa666
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b6010976ec3a99afee69a02c076d1da1ae44b41f0869f908e7239019bf06c948e3e67fe45221a2a0225ca00bad1f6278a6e02a38ba221e40e545cd88c54ce8aa
|
|
7
|
+
data.tar.gz: ce1ff1aeff6849d3f7f3b89bfc783a4cb140d82b9f7f0f3e6c5792ba84b19b66b33c3bdb464f5bccca56add517f0ac10102fbf65e6389ef91cc9041f80aa04d7
|
data/docs/application.md
CHANGED
|
@@ -61,6 +61,11 @@ When specifying a file there are a couple ways to reference the gloo file to ope
|
|
|
61
61
|
- By default gloo will look for a start.gloo file in the
|
|
62
62
|
root level of the project. That start.gloo file should load other files
|
|
63
63
|
and run the app.
|
|
64
|
+
- Any further parameter(s) after the project path are not loaded by
|
|
65
|
+
gloo as files - they're passed through as a single command for the
|
|
66
|
+
app's own command handling (e.g. a [shell] object, from the cli core
|
|
67
|
+
library, runs it once via its execute_once) and gloo exits once that
|
|
68
|
+
command completes, instead of starting an interactive session.
|
|
64
69
|
--script - Run in Script mode
|
|
65
70
|
- Run the script in the file parameter and then quit.
|
|
66
71
|
- If a file is provided as a parameter this option does not need to be specified.
|
data/lib/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
6.7.
|
|
1
|
+
6.7.2
|
data/lib/VERSION_NOTES
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
6.7.2 - 2026.09.16
|
|
2
|
+
- Fixes issue with logging errors in the dictionary.
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
6.7.1 - 2026.09.14
|
|
6
|
+
- Fix issue with running shell in single command mode.
|
|
7
|
+
|
|
8
|
+
|
|
1
9
|
6.7.0 - 2026.09.13
|
|
2
10
|
- Adds alternative secondary keywords for conditional verbs.
|
|
3
11
|
- Adds option to save an object subtree into its own file.
|
data/lib/gloo/app/args.rb
CHANGED
|
@@ -14,7 +14,7 @@ module Gloo
|
|
|
14
14
|
QUIET = 'quiet'.freeze
|
|
15
15
|
GLOO_ENV = 'GLOO_ENV'.freeze
|
|
16
16
|
|
|
17
|
-
attr_reader :switches, :files, :app_path
|
|
17
|
+
attr_reader :switches, :files, :app_path, :command_tokens
|
|
18
18
|
|
|
19
19
|
#
|
|
20
20
|
# Create arguments and setup.
|
|
@@ -24,6 +24,7 @@ module Gloo
|
|
|
24
24
|
@switches = []
|
|
25
25
|
@files = []
|
|
26
26
|
@app_path = nil
|
|
27
|
+
@command_tokens = []
|
|
27
28
|
|
|
28
29
|
params.each { |o| process_one_arg( o ) }
|
|
29
30
|
ARGV.each { |o| process_one_arg( o ) }
|
|
@@ -99,6 +100,16 @@ module Gloo
|
|
|
99
100
|
@switches.include?( Gloo::App::Mode::TEST.to_s )
|
|
100
101
|
end
|
|
101
102
|
|
|
103
|
+
#
|
|
104
|
+
# Were there CLI tokens after the app path, in App mode?
|
|
105
|
+
# When true, those tokens are meant for the app's own command
|
|
106
|
+
# handling (e.g. a [shell] object's one-shot command) - they are
|
|
107
|
+
# not files for gloo itself to load.
|
|
108
|
+
#
|
|
109
|
+
def single_command?
|
|
110
|
+
return @command_tokens.any?
|
|
111
|
+
end
|
|
112
|
+
|
|
102
113
|
#
|
|
103
114
|
# Detect the mode to be run in.
|
|
104
115
|
# Start by seeing if a mode is specified.
|
|
@@ -141,11 +152,19 @@ module Gloo
|
|
|
141
152
|
#
|
|
142
153
|
# Process one argument or parameter.
|
|
143
154
|
#
|
|
155
|
+
# In App mode, only the first non-switch token is the app path.
|
|
156
|
+
# Anything after that is a command token for the app's own
|
|
157
|
+
# handling, not a file for gloo to load - keeping it out of
|
|
158
|
+
# @files is what keeps load_files from also trying (and failing)
|
|
159
|
+
# to open it as a file.
|
|
160
|
+
#
|
|
144
161
|
def process_one_arg( arg )
|
|
145
162
|
if arg.start_with? '--'
|
|
146
163
|
switches << arg[ 2..-1 ]
|
|
147
|
-
elsif app? &&
|
|
164
|
+
elsif app? && @app_path.nil?
|
|
148
165
|
@app_path = arg
|
|
166
|
+
elsif app?
|
|
167
|
+
command_tokens << arg
|
|
149
168
|
else
|
|
150
169
|
files << arg
|
|
151
170
|
end
|
data/lib/gloo/app/engine.rb
CHANGED
|
@@ -67,7 +67,7 @@ module Gloo
|
|
|
67
67
|
@mode = @args.detect_mode
|
|
68
68
|
@running = true
|
|
69
69
|
|
|
70
|
-
@dictionary = Gloo::Core::Dictionary.get
|
|
70
|
+
@dictionary = Gloo::Core::Dictionary.get( self )
|
|
71
71
|
|
|
72
72
|
@parser = Gloo::Core::Parser.new( self )
|
|
73
73
|
@heap = Gloo::Core::Heap.new( self )
|
|
@@ -179,7 +179,7 @@ module Gloo
|
|
|
179
179
|
# Open any files specifed in args
|
|
180
180
|
load_files
|
|
181
181
|
|
|
182
|
-
unless @mode == Mode::SCRIPT || @args.quiet?
|
|
182
|
+
unless @mode == Mode::SCRIPT || @args.quiet? || @args.single_command?
|
|
183
183
|
self.loop
|
|
184
184
|
end
|
|
185
185
|
|
data/lib/gloo/core/dictionary.rb
CHANGED
|
@@ -27,10 +27,14 @@ module Gloo
|
|
|
27
27
|
#
|
|
28
28
|
# Get the singleton Dictionary and Initialize
|
|
29
29
|
# if this is the first time.
|
|
30
|
+
# The engine is optional -- verbs/objects self-register at class
|
|
31
|
+
# load time, before any engine (and its log) exists. When an
|
|
32
|
+
# engine is given, it's used to report a duplicate-registration
|
|
33
|
+
# error; without one, duplicates are just silently skipped.
|
|
30
34
|
#
|
|
31
|
-
def self.get
|
|
35
|
+
def self.get( engine=nil )
|
|
32
36
|
o = Gloo::Core::Dictionary.instance
|
|
33
|
-
o.init if o.verbs.count == 0
|
|
37
|
+
o.init( engine ) if o.verbs.count == 0
|
|
34
38
|
return o
|
|
35
39
|
end
|
|
36
40
|
|
|
@@ -51,9 +55,9 @@ module Gloo
|
|
|
51
55
|
#
|
|
52
56
|
# Initialize verbs and objects in the dictionary.
|
|
53
57
|
#
|
|
54
|
-
def init
|
|
55
|
-
init_verbs
|
|
56
|
-
init_objs
|
|
58
|
+
def init( engine=nil )
|
|
59
|
+
init_verbs( engine )
|
|
60
|
+
init_objs( engine )
|
|
57
61
|
end
|
|
58
62
|
|
|
59
63
|
#
|
|
@@ -145,15 +149,15 @@ module Gloo
|
|
|
145
149
|
#
|
|
146
150
|
# Register a verb after start up.
|
|
147
151
|
#
|
|
148
|
-
def register_verb_post_start( verb_class )
|
|
149
|
-
add_verb verb_class
|
|
152
|
+
def register_verb_post_start( verb_class, engine=nil )
|
|
153
|
+
add_verb verb_class, engine
|
|
150
154
|
end
|
|
151
155
|
|
|
152
156
|
#
|
|
153
157
|
# Register an object type after start up.
|
|
154
158
|
#
|
|
155
|
-
def register_obj_post_start( obj_class )
|
|
156
|
-
add_object obj_class
|
|
159
|
+
def register_obj_post_start( obj_class, engine=nil )
|
|
160
|
+
add_object obj_class, engine
|
|
157
161
|
end
|
|
158
162
|
|
|
159
163
|
#
|
|
@@ -200,28 +204,32 @@ module Gloo
|
|
|
200
204
|
#
|
|
201
205
|
# Init the list of objects.
|
|
202
206
|
#
|
|
203
|
-
def init_objs
|
|
207
|
+
def init_objs( engine=nil )
|
|
204
208
|
@obj_references.each do |o|
|
|
205
|
-
add_object o
|
|
209
|
+
add_object o, engine
|
|
206
210
|
end
|
|
207
211
|
end
|
|
208
212
|
|
|
209
213
|
#
|
|
210
214
|
# Init the list of verbs.
|
|
211
215
|
#
|
|
212
|
-
def init_verbs
|
|
216
|
+
def init_verbs( engine=nil )
|
|
213
217
|
@verb_references.each do |v|
|
|
214
|
-
add_verb v
|
|
218
|
+
add_verb v, engine
|
|
215
219
|
end
|
|
216
220
|
end
|
|
217
221
|
|
|
218
|
-
#
|
|
219
|
-
# Add an object to the dictionary
|
|
220
|
-
#
|
|
221
|
-
|
|
222
|
+
#
|
|
223
|
+
# Add an object to the dictionary.
|
|
224
|
+
# The engine is optional and is only used to report a
|
|
225
|
+
# duplicate-registration error -- when it's not given (e.g.
|
|
226
|
+
# self-registration at class load time), duplicates are just
|
|
227
|
+
# silently skipped.
|
|
228
|
+
#
|
|
229
|
+
def add_object( obj, engine=nil )
|
|
222
230
|
# Make sure it hasn't already been registered
|
|
223
231
|
if ( @objs.key?(obj.typename) || @objs.key?(obj.short_typename) )
|
|
224
|
-
|
|
232
|
+
engine&.err "duplicate object type '#{obj.typename}' or '#{obj.short_typename}'"
|
|
225
233
|
return
|
|
226
234
|
end
|
|
227
235
|
|
|
@@ -232,12 +240,13 @@ module Gloo
|
|
|
232
240
|
end
|
|
233
241
|
|
|
234
242
|
#
|
|
235
|
-
# Add a verb to the dictionary
|
|
243
|
+
# Add a verb to the dictionary.
|
|
244
|
+
# The engine is optional -- see add_object.
|
|
236
245
|
#
|
|
237
|
-
def add_verb( verb )
|
|
246
|
+
def add_verb( verb, engine=nil )
|
|
238
247
|
# Make sure it hasn't already been registered
|
|
239
248
|
if ( verb?( verb.keyword ) || verb?( verb.keyword_shortcut ) )
|
|
240
|
-
|
|
249
|
+
engine&.err "duplicate verb keyword '#{verb.keyword}' or '#{verb.keyword_shortcut}'"
|
|
241
250
|
return
|
|
242
251
|
end
|
|
243
252
|
|
data/lib/gloo/plugin/callback.rb
CHANGED
|
@@ -17,7 +17,7 @@ module Gloo
|
|
|
17
17
|
#
|
|
18
18
|
def register_verb( verb_class )
|
|
19
19
|
@engine.log.debug "Registering verb: #{verb_class} from callback helper"
|
|
20
|
-
@engine.dictionary.register_verb_post_start( verb_class )
|
|
20
|
+
@engine.dictionary.register_verb_post_start( verb_class, @engine )
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
#
|
|
@@ -25,7 +25,7 @@ module Gloo
|
|
|
25
25
|
#
|
|
26
26
|
def register_obj( object_class )
|
|
27
27
|
@engine.log.debug "Registering object: #{object_class} from callback helper"
|
|
28
|
-
@engine.dictionary.register_obj_post_start( object_class )
|
|
28
|
+
@engine.dictionary.register_obj_post_start( object_class, @engine )
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
end
|
data/lib/gloo/shell/runner.rb
CHANGED
|
@@ -40,7 +40,11 @@ module Gloo
|
|
|
40
40
|
# subclasses' command methods to query (dictionary, heap, etc).
|
|
41
41
|
# @param opts [Hash] :prompt, :on_error, :on_unknown_command,
|
|
42
42
|
# :on_empty_command, :before_action, :after_action - all Procs
|
|
43
|
-
# except :prompt (String)
|
|
43
|
+
# except :prompt (String), :include_quit (Boolean), and
|
|
44
|
+
# :command (Array<String>).
|
|
45
|
+
# @option opts :command [Array<String>] Tokens for a single
|
|
46
|
+
# command to run once, instead of entering the interactive
|
|
47
|
+
# REPL - see #single_command?.
|
|
44
48
|
#
|
|
45
49
|
def initialize( engine, opts = {} )
|
|
46
50
|
@engine = engine
|
|
@@ -51,6 +55,7 @@ module Gloo
|
|
|
51
55
|
@before_action = opts[ :before_action ]
|
|
52
56
|
@after_action = opts[ :after_action ]
|
|
53
57
|
@include_quit = opts[ :include_quit ] || false
|
|
58
|
+
@command = opts[ :command ]
|
|
54
59
|
|
|
55
60
|
@context = Gloo::Shell::Context.new
|
|
56
61
|
@root = Gloo::Shell::CommandNode.new( nil )
|
|
@@ -63,10 +68,24 @@ module Gloo
|
|
|
63
68
|
# ---------------------------------------------------------------------
|
|
64
69
|
|
|
65
70
|
#
|
|
66
|
-
#
|
|
71
|
+
# Were command tokens supplied at construction? When true, #start
|
|
72
|
+
# runs that one command via #execute_once and returns instead of
|
|
73
|
+
# entering the REPL.
|
|
74
|
+
#
|
|
75
|
+
def single_command?
|
|
76
|
+
return !( @command.nil? || @command.empty? )
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
#
|
|
80
|
+
# Start the shell: run the single supplied command and return,
|
|
81
|
+
# or enter the interactive REPL if none was supplied.
|
|
67
82
|
#
|
|
68
83
|
def start
|
|
69
|
-
|
|
84
|
+
if single_command?
|
|
85
|
+
execute_once( @command )
|
|
86
|
+
else
|
|
87
|
+
repl
|
|
88
|
+
end
|
|
70
89
|
end
|
|
71
90
|
|
|
72
91
|
#
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: gloo
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 6.7.
|
|
4
|
+
version: 6.7.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Eric Crane
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: exe
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: bundler
|
|
@@ -508,7 +507,6 @@ licenses:
|
|
|
508
507
|
- MIT
|
|
509
508
|
metadata:
|
|
510
509
|
documentation_uri: https://github.com/ecrane/gloo
|
|
511
|
-
post_install_message:
|
|
512
510
|
rdoc_options: []
|
|
513
511
|
require_paths:
|
|
514
512
|
- lib
|
|
@@ -523,8 +521,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
523
521
|
- !ruby/object:Gem::Version
|
|
524
522
|
version: '0'
|
|
525
523
|
requirements: []
|
|
526
|
-
rubygems_version:
|
|
527
|
-
signing_key:
|
|
524
|
+
rubygems_version: 4.0.17
|
|
528
525
|
specification_version: 4
|
|
529
526
|
summary: Gloo scripting language. A scripting language built on ruby.
|
|
530
527
|
test_files: []
|