gloo 2.1.0 → 2.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 20774ab083e3f97894367f2e5ab0ede6ae65edeb72e8153af73df130da3a728c
4
- data.tar.gz: 9225ba79729353ed2a21966dfdf380ad1d6b081615895d6bef1eec83720d428b
3
+ metadata.gz: f34d7102d0ca036b885dc482a76bd9e2e69056fd1fc24a94f85b019ad93ae2ec
4
+ data.tar.gz: b40a76f7f123e27bfa97e4d027cff20f520fecb46c2b11a7f4514817f31a6bfa
5
5
  SHA512:
6
- metadata.gz: 1c4d53f40b31c60a0d32f45bf5ab8a3a6489325f34fb4f488333a3fdc5c67b876b13bd7cf9ad7daa388124386ba866033b5c96357d6621239f9b02e466db13c4
7
- data.tar.gz: c3326a3b85ca3996cf5a0ecee1dbf4d49ada7f8ae37815bdfa053ba9c593bf1a01e508870ebff7b263e159d48472a37c874baddba78d2dfce52ba1aabe9dee99
6
+ metadata.gz: b70d8504a1fee2ce79639f4dc6e10e51195f5900a92e32666bf26f3233e61d14818346886c818d11c87f0738476f1e994a27742e019adef6bbc8b5f6f0845e83
7
+ data.tar.gz: 959b01d16677ad6e6e8a873ccea468a3da5c54c15da4734e611bdac188b4f686f187f32d2d29fc49f33af3c13f12f04dbbea8e0a4030bf7c1ee9ac1fbf78bd11
data/lib/VERSION CHANGED
@@ -1 +1 @@
1
- 2.1.0
1
+ 2.3.1
data/lib/VERSION_NOTES ADDED
@@ -0,0 +1,20 @@
1
+ 2.3.1 - 2023.06.26
2
+ - Fixes version number stuff.
3
+
4
+
5
+ 2.3.0 - 2023.06.26
6
+ - Adds version notes as option on the version verb.
7
+
8
+
9
+ 2.2 - 2023.06.23
10
+ - Adds color to list output.
11
+ - Updates in-app help with verb and object lists and shows settings.
12
+ - Expanded settings with list indent and levels.
13
+ - Fixes bug with the debug flag from settings.
14
+
15
+ 2.1 - 2023.05.24
16
+ - Updates menu to provide convention for simplified usage.
17
+
18
+ 2.0 - 2023.05.22
19
+ - Version 2 merges gloo-lang back into a single gloo gem.
20
+
data/lib/gloo/app/info.rb CHANGED
@@ -10,18 +10,31 @@ module Gloo
10
10
  module App
11
11
  class Info
12
12
 
13
+ APP_NAME = 'Gloo'.freeze
14
+ VERSION_FILE = 'VERSION'.freeze
15
+ VERSION_NOTES_FILE = 'VERSION_NOTES'.freeze
16
+
13
17
  #
14
18
  # Load the version from the VERSION file.
15
19
  #
16
20
  def self.get_version
17
21
  f = File.dirname( File.absolute_path( __FILE__ ) )
18
22
  f = File.dirname( File.dirname( f ) )
19
- f = File.join( f, 'VERSION' )
23
+ f = File.join( f, VERSION_FILE )
20
24
  return File.read( f )
21
25
  end
22
26
 
23
27
  VERSION = Gloo::App::Info.get_version
24
- APP_NAME = 'Gloo'.freeze
28
+
29
+ #
30
+ # Load the version notes from the VERSION_NOTES file.
31
+ #
32
+ def self.get_version_notes
33
+ f = File.dirname( File.absolute_path( __FILE__ ) )
34
+ f = File.dirname( File.dirname( f ) )
35
+ f = File.join( f, VERSION_NOTES_FILE )
36
+ return File.read( f )
37
+ end
25
38
 
26
39
  #
27
40
  # Get the application display title.
data/lib/gloo/app/log.rb CHANGED
@@ -26,6 +26,7 @@ module Gloo
26
26
  def initialize( engine, quiet=true )
27
27
  @engine = engine
28
28
  @quite = quiet
29
+ @debug = engine.settings.debug
29
30
 
30
31
  create_logger
31
32
 
@@ -60,6 +61,8 @@ module Gloo
60
61
  # Write a debug message to the log.
61
62
  #
62
63
  def debug( msg )
64
+ return unless @debug
65
+
63
66
  @logger.debug msg
64
67
  end
65
68
 
@@ -12,7 +12,7 @@ module Gloo
12
12
 
13
13
  attr_reader :user_root, :log_path,
14
14
  :config_path, :project_path,
15
- :start_with, :list_indent, :tmp_path,
15
+ :start_with, :list_indent, :list_levels, :tmp_path,
16
16
  :debug_path, :debug
17
17
 
18
18
  #
@@ -33,51 +33,28 @@ module Gloo
33
33
  # Can be seen in app with 'help settings'
34
34
  #
35
35
  def show
36
- puts "\nApplication Settings:"
37
- puts ' Startup with: ' + @start_with
38
- puts ' Indent in Listing: ' + @list_indent.to_s
39
- puts ' Screen Lines: ' + Gloo::App::Settings.lines( @engine ).to_s
40
- puts ' Page Size: ' + Gloo::App::Settings.page_size( @engine ).to_s
41
- puts ''
36
+ puts "\n Application Settings:".blue
37
+ puts ' Startup with: '.yellow + @start_with.white
38
+ puts ' Indent in Listing: '.yellow + @list_indent.to_s.white
39
+ puts ' List Levels: '.yellow + @list_levels.to_s.white
40
+ puts ' Debug? '.yellow + @debug.to_s.white
41
+ puts ' Screen Lines: '.yellow + Gloo::App::Settings.lines( @engine ).to_s.white
42
+ puts ' Page Size: '.yellow + Gloo::App::Settings.page_size( @engine ).to_s.white
42
43
  self.show_paths
43
- puts ''
44
44
  end
45
-
45
+
46
46
  #
47
47
  # Show path settings
48
48
  #
49
49
  def show_paths
50
- puts ' User Root Path is here: ' + @user_root
51
- puts ' Projects Path: ' + @project_path
52
- puts ' Tmp Path: ' + @tmp_path
53
- puts ' Debug Path: ' + @debug_path
50
+ puts "\n Application Paths:".blue
51
+ puts ' User Root Path is here: '.yellow + @user_root.white
52
+ puts ' Projects Path: '.yellow + @project_path.white
53
+ puts ' Tmp Path: '.yellow + @tmp_path.white
54
+ puts ' Debug Path: '.yellow + @debug_path.white
55
+ puts "\n"
54
56
  end
55
57
 
56
- # #
57
- # # Show the current application settings.
58
- # # Can be seen in app with 'help settings'
59
- # #
60
- # def show
61
- # puts "\nApplication Settings:".blue
62
- # puts ' Startup with: '.yellow + @start_with.white
63
- # puts ' Indent in Listing: '.yellow + @list_indent.to_s.white
64
- # puts ' Screen Lines: '.yellow + Gloo::App::Settings.lines.to_s.white
65
- # puts ' Page Size: '.yellow + Gloo::App::Settings.page_size.to_s.white
66
- # puts ''
67
- # self.show_paths
68
- # puts ''
69
- # end
70
- #
71
- # #
72
- # # Show path settings
73
- # #
74
- # def show_paths
75
- # puts ' User Root Path is here: '.yellow + @user_root.white
76
- # puts ' Projects Path: '.yellow + @project_path.white
77
- # puts ' Tmp Path: '.yellow + @tmp_path.white
78
- # puts ' Debug Path: '.yellow + @debug_path.white
79
- # end
80
-
81
58
  #
82
59
  # Get the number of vertical lines on screen.
83
60
  #
@@ -162,6 +139,7 @@ module Gloo
162
139
 
163
140
  @start_with = settings[ 'gloo' ][ 'start_with' ]
164
141
  @list_indent = settings[ 'gloo' ][ 'list_indent' ]
142
+ @list_levels = settings[ 'gloo' ][ 'list_levels' ]
165
143
 
166
144
  @debug = settings[ 'gloo' ][ 'debug' ]
167
145
  end
@@ -191,7 +169,8 @@ module Gloo
191
169
  gloo:
192
170
  project_path: #{projects}
193
171
  start_with:
194
- list_indent: 1
172
+ list_indent: 2
173
+ list_levels: 3
195
174
  debug: false
196
175
  TEXT
197
176
  return str
@@ -14,24 +14,29 @@ module Gloo
14
14
  HELP_NOT_FOUND_ERR = 'Help command could not be found:'.freeze
15
15
 
16
16
  DISPATCH = {
17
+ s: 'show_settings',
17
18
  settings: 'show_settings',
18
- keywords: 'show_keywords',
19
19
  verb: 'show_verbs',
20
20
  verbs: 'show_verbs',
21
21
  v: 'show_verbs',
22
+ o: 'show_objs',
22
23
  obj: 'show_objs',
23
24
  object: 'show_objs',
24
- objects: 'show_objs',
25
- o: 'show_objs',
26
- topics: 'show_topics'
25
+ objects: 'show_objs'
27
26
  }.freeze
28
27
 
29
28
  #
30
29
  # Run the verb.
31
30
  #
32
31
  def run
33
- data = "\n For documentation use the gloo website. \n\n"
34
- @engine.log.show data
32
+ opts = @tokens.second if @tokens
33
+ opts = opts.strip.downcase if opts
34
+
35
+ if opts
36
+ dispatch opts
37
+ else
38
+ show_default_help
39
+ end
35
40
  end
36
41
 
37
42
  #
@@ -77,6 +82,105 @@ module Gloo
77
82
  @engine.dictionary.show_keywords
78
83
  end
79
84
 
85
+ #
86
+ # Show default help.
87
+ # No parameters were given.
88
+ #
89
+ def show_default_help
90
+ data = "\n"
91
+ data << " Help Options:\n"
92
+ data << " ? objects (obj, o) \n"
93
+ data << " ? verbs (v) \n"
94
+ data << " ? settings (s) \n"
95
+ data << "\n For detailed documentation use the gloo website. \n"
96
+ data << "\n https://gloo.ecrane.us/doc/. \n\n"
97
+ @engine.log.show data
98
+ end
99
+
100
+ #
101
+ # Dispatch the help to the right place.
102
+ #
103
+ def dispatch( opts )
104
+ # return if dispatch_help_page( opts )
105
+
106
+ @engine.log.debug 'looking for help topic'
107
+ cmd = DISPATCH[ opts.to_sym ]
108
+ if cmd
109
+ @engine.log.debug 'found help command'
110
+ send cmd
111
+ else
112
+ report_help_error opts
113
+ end
114
+ end
115
+
116
+ #
117
+ # Show application settings.
118
+ #
119
+ def show_settings
120
+ @engine.settings.show
121
+ end
122
+
123
+ #
124
+ # Report an error with the inline help.
125
+ #
126
+ def report_help_error( opts )
127
+ @engine.err "#{HELP_NOT_FOUND_ERR} '#{opts}'"
128
+ end
129
+
130
+ #
131
+ # List the verbs
132
+ #
133
+ def show_verbs
134
+ data = "\n"
135
+ data << " Verbs (shortcut, name)\n".blue
136
+ data << "#{get_verbs}\n\n"
137
+ @engine.log.show data
138
+ end
139
+
140
+ #
141
+ # List the object types
142
+ #
143
+ def show_objs
144
+ data = "\n"
145
+ data << " Objects \n".blue
146
+ data << "#{get_objects}\n\n"
147
+ @engine.log.show data
148
+ end
149
+
150
+ #
151
+ # Get the text for the list of verbs.
152
+ #
153
+ def get_verbs
154
+ str = ''
155
+ verbs = @engine.dictionary.get_verbs.sort_by( &:keyword )
156
+ verbs.each_with_index do |v, i|
157
+ cut = v.keyword_shortcut.ljust( 5, ' ' ).yellow
158
+ name = v.keyword.ljust( 20, ' ' ).white
159
+ str << " #{cut} #{name} \n"
160
+ end
161
+
162
+ return str
163
+ end
164
+
165
+ #
166
+ # Get the text for the list of objects.
167
+ #
168
+ def get_objects
169
+ str = ''
170
+ objs = @engine.dictionary.get_obj_types.sort_by( &:typename )
171
+ objs.each_with_index do |o, i|
172
+ if o.short_typename != o.typename
173
+ short = "(#{o.short_typename})".yellow
174
+ name = "#{o.typename.white} #{short}"
175
+ else
176
+ name = o.typename.white
177
+ end
178
+ str << " #{name.ljust( 30, ' ' )}\n"
179
+ end
180
+
181
+ return str
182
+ end
183
+
80
184
  end
81
185
  end
82
186
  end
@@ -18,9 +18,11 @@ module Gloo
18
18
  def run
19
19
  levels = determine_levels
20
20
  target = self.determine_target
21
+ indent = self.determine_indent
22
+
21
23
  obj = target.resolve
22
24
  if obj
23
- show_target( obj, levels )
25
+ show_target( obj, levels, indent )
24
26
  else
25
27
  @engine.err "#{TARGET_MISSING_ERR} #{target}"
26
28
  end
@@ -63,7 +65,7 @@ module Gloo
63
65
  return if levels.zero?
64
66
 
65
67
  obj.children.each do |o|
66
- show_target( o, levels - 1, "#{indent} " )
68
+ show_target( o, levels - 1, "#{indent}#{determine_indent}" )
67
69
  end
68
70
  end
69
71
 
@@ -72,12 +74,17 @@ module Gloo
72
74
  #
73
75
  def show_obj( obj, indent = ' ' )
74
76
  if obj.multiline_value? && obj.value_is_array?
75
- @engine.log.show "#{indent}#{obj.name} [#{obj.type_display}] :"
77
+ str = "#{indent}#{obj.name}".white
78
+ str << " [#{obj.type_display}] : ".yellow
79
+ @engine.log.show str
76
80
  obj.value.each do |line|
77
81
  @engine.log.show "#{indent} #{line}"
78
82
  end
79
83
  else
80
- @engine.log.show "#{indent}#{obj.name} [#{obj.type_display}] : #{obj.value}"
84
+ str = "#{indent}#{obj.name}".white
85
+ str << " [#{obj.type_display}] : ".yellow
86
+ str << "#{obj.value}"
87
+ @engine.log.show str
81
88
  end
82
89
  end
83
90
 
@@ -86,13 +93,27 @@ module Gloo
86
93
  #
87
94
  def determine_levels
88
95
  # Check settings for the default value.
89
- levels = @engine.settings.list_indent
96
+ levels = @engine.settings.list_levels
90
97
  return levels if levels
91
98
 
92
99
  # Last chance: use the default
93
100
  return 1
94
101
  end
95
102
 
103
+ #
104
+ # Determine the level of indentation in the outline.
105
+ #
106
+ def determine_indent
107
+ # Check settings for the default value.
108
+ indent = @engine.settings.list_indent
109
+ if indent
110
+ return ( ' ' * indent )
111
+ end
112
+
113
+ # Last chance: use the default
114
+ return 2
115
+ end
116
+
96
117
  end
97
118
  end
98
119
  end
@@ -10,12 +10,14 @@ module Gloo
10
10
 
11
11
  KEYWORD = 'version'.freeze
12
12
  KEYWORD_SHORT = 'v'.freeze
13
+ NOTES = 'notes'.freeze
14
+ NOTES_SHORT = 'n'.freeze
13
15
 
14
16
  #
15
17
  # Run the verb.
16
18
  #
17
19
  def run
18
- @engine.log.show Gloo::App::Info.full_version
20
+ vers_notes? ? show_vers_notes : show_vers
19
21
  end
20
22
 
21
23
  #
@@ -32,6 +34,42 @@ module Gloo
32
34
  return KEYWORD_SHORT
33
35
  end
34
36
 
37
+
38
+ # ---------------------------------------------------------------------
39
+ # Private functions
40
+ # ---------------------------------------------------------------------
41
+
42
+ private
43
+
44
+ #
45
+ # Show basic version numbers.
46
+ #
47
+ def show_vers
48
+ @engine.log.show Gloo::App::Info.full_version
49
+ @engine.log.show "\nUse `#{KEYWORD} #{NOTES}` to see version notes."
50
+ end
51
+
52
+ #
53
+ # Show version notes.
54
+ #
55
+ def show_vers_notes
56
+ @engine.log.show "Gloo version notes..."
57
+ notes = Gloo::App::Info.get_version_notes
58
+ @engine.platform.show( notes, false, true )
59
+ end
60
+
61
+ #
62
+ # Is the request to show version notes?
63
+ #
64
+ def vers_notes?
65
+ if ( @tokens.token_count > 1 ) && (
66
+ ( @tokens.last == NOTES ) || ( @tokens.last == NOTES_SHORT ) )
67
+ return true
68
+ end
69
+
70
+ return false
71
+ end
72
+
35
73
  end
36
74
  end
37
75
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gloo
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Crane
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-05-24 00:00:00.000000000 Z
11
+ date: 2023-06-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -270,6 +270,7 @@ files:
270
270
  - exe/o
271
271
  - gloo.gemspec
272
272
  - lib/VERSION
273
+ - lib/VERSION_NOTES
273
274
  - lib/dependencies.rb
274
275
  - lib/gloo.rb
275
276
  - lib/gloo/app/args.rb